質問編集履歴

5

訂正

2019/12/19 02:16

投稿

ParaParaDance
ParaParaDance

スコア56

test CHANGED
File without changes
test CHANGED
@@ -8,17 +8,19 @@
8
8
 
9
9
  【C#でのCode内容】
10
10
 
11
+ ```ここに言語を入力
12
+
11
13
  [DllImport("API_ver1.0.0.dll", CallingConvention = CallingConvention.StdCall)]
12
14
 
13
15
  public static extern int GetData();
14
16
 
15
-
16
-
17
17
  tBox_Angle.Text = Convert.ToString(DLLimpo.GetData());
18
18
 
19
-
19
+ ```
20
20
 
21
21
  【DLL側のメソッド】
22
+
23
+ ```ここに言語を入力
22
24
 
23
25
  extern "C" DllExport int __stdcall GetData();
24
26
 
@@ -38,6 +40,10 @@
38
40
 
39
41
 
40
42
 
43
+ ```
44
+
45
+
46
+
41
47
  しかし、正の値は正しく表示されるが、負の値が正の値として表示されてしまいます。
42
48
 
43
49
  例えば、-1474であれば、64061と表示される。

4

訂正

2019/12/19 02:16

投稿

ParaParaDance
ParaParaDance

スコア56

test CHANGED
File without changes
test CHANGED
@@ -22,6 +22,8 @@
22
22
 
23
23
  extern "C" DllExport int __stdcall GetData();
24
24
 
25
+
26
+
25
27
  int __stdcall GetData() {
26
28
 
27
29
  static int buff;

3

訂正

2019/12/19 01:59

投稿

ParaParaDance
ParaParaDance

スコア56

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  【C#でのCode内容】
10
10
 
11
- [DllImport("IXXAT_API_ver1.0.0.dll", CallingConvention = CallingConvention.StdCall)]
11
+ [DllImport("API_ver1.0.0.dll", CallingConvention = CallingConvention.StdCall)]
12
12
 
13
13
  public static extern int GetData();
14
14
 

2

内容追記

2019/12/19 01:57

投稿

ParaParaDance
ParaParaDance

スコア56

test CHANGED
File without changes
test CHANGED
@@ -6,9 +6,33 @@
6
6
 
7
7
 
8
8
 
9
- [Code内容]
9
+ C#でのCode内容
10
+
11
+ [DllImport("IXXAT_API_ver1.0.0.dll", CallingConvention = CallingConvention.StdCall)]
12
+
13
+ public static extern int GetData();
14
+
15
+
10
16
 
11
17
  tBox_Angle.Text = Convert.ToString(DLLimpo.GetData());
18
+
19
+
20
+
21
+ 【DLL側のメソッド】
22
+
23
+ extern "C" DllExport int __stdcall GetData();
24
+
25
+ int __stdcall GetData() {
26
+
27
+ static int buff;
28
+
29
+ while (1) {
30
+
31
+ oApi.Receive(0, &MSGbuff);
32
+
33
+ buff = MSGbuff.Parameters[0];
34
+
35
+ return buff; } }
12
36
 
13
37
 
14
38
 

1

内容補足

2019/12/19 01:55

投稿

ParaParaDance
ParaParaDance

スコア56

test CHANGED
File without changes
test CHANGED
@@ -18,4 +18,4 @@
18
18
 
19
19
 
20
20
 
21
- アドバイス頂けますでしょうか。
21
+ 負の値がちゃんと表示されるようにるためにはどうすれば良いでしょうか。