質問編集履歴
2
表示が崩れていたので修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
C# 内で CWnd* にキャストすることは可能でしょうか?
|
5
5
|
|
6
6
|
DLL 関数
|
7
|
+
```c++
|
7
8
|
|
8
9
|
#ifdef AAA_EXPORTS
|
9
10
|
#define AAA __declspec(dllexport)
|
@@ -14,17 +15,17 @@
|
|
14
15
|
extern "C" {
|
15
16
|
AAA void WINAPI xxx(CWnd* pWnd);
|
16
17
|
}
|
18
|
+
```
|
17
19
|
|
18
|
-
|
19
20
|
C# 側
|
20
|
-
|
21
|
+
```c#
|
21
22
|
public unsafe void fun()
|
22
23
|
{
|
23
24
|
System.IntPtr hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
|
24
25
|
xxx(hWnd);
|
25
26
|
}
|
27
|
+
```
|
26
28
|
|
27
|
-
|
28
29
|
エラーメッセージ
|
29
30
|
|
30
31
|
追加情報: 保護されているメモリに読み取りまたは書き込み操作を行おうとしました。他のメモリが壊れていることが考えられます。
|
1
C# 側及びエラーメッセージ追記。
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,4 +15,19 @@
|
|
15
15
|
AAA void WINAPI xxx(CWnd* pWnd);
|
16
16
|
}
|
17
17
|
|
18
|
+
|
19
|
+
C# 側
|
20
|
+
|
21
|
+
public unsafe void fun()
|
22
|
+
{
|
23
|
+
System.IntPtr hWnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
|
24
|
+
xxx(hWnd);
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
エラーメッセージ
|
29
|
+
|
30
|
+
追加情報: 保護されているメモリに読み取りまたは書き込み操作を行おうとしました。他のメモリが壊れていることが考えられます。
|
18
|
-
よろしくご教授のほどお願い致します。
|
31
|
+
よろしくご教授のほどお願い致します。
|
32
|
+
|
33
|
+
(編集しました)
|