質問編集履歴

3

VBAタグ追加しました

2020/03/23 07:29

投稿

yuujiMotoki
yuujiMotoki

スコア90

test CHANGED
File without changes
test CHANGED
File without changes

2

修正

2020/03/23 07:29

投稿

yuujiMotoki
yuujiMotoki

スコア90

test CHANGED
File without changes
test CHANGED
@@ -50,7 +50,7 @@
50
50
 
51
51
 
52
52
 
53
- Type Point
53
+ Public Type Point
54
54
 
55
55
  x As Integer
56
56
 
@@ -60,25 +60,29 @@
60
60
 
61
61
 
62
62
 
63
+
64
+
63
65
  Sub test()
64
66
 
65
67
  Dim file1, file2, file3
66
68
 
67
69
  Dim shot
68
70
 
71
+ Dim x
72
+
69
73
 
70
74
 
71
- Dim x
72
-
73
- str file1 = "C:\Users\Desktop\after.bmp"
75
+ str file1 = "C:\Users\mm05162\Desktop\after.bmp"
74
-
76
+
75
- str file2 = "C:\Users\Desktop\before.bmp"
77
+ str file2 = "C:\Users\mm05162\Desktop\before.bmp"
76
-
78
+
77
- str file3 = "C:\Users\Desktop\drop.bmp"
79
+ str file3 = "C:\Users\mm05162\Desktop\drop.bmp"
78
80
 
79
81
  Set shot = New ScreenShot
80
82
 
81
- shot.Imagediff file1, file2, file3
83
+ x = shot.Imagediff(file1, file2, file3)
84
+
85
+
82
86
 
83
87
  End Sub
84
88
 

1

内容変更

2020/03/23 06:32

投稿

yuujiMotoki
yuujiMotoki

スコア90

test CHANGED
File without changes
test CHANGED
@@ -10,13 +10,19 @@
10
10
 
11
11
 
12
12
 
13
+ C#から呼び出したTEST.EXEでは問題なく、受け渡しができていました。
14
+
15
+ VBAで実施すると下記のエラーが出ます。
16
+
17
+
18
+
13
19
  ```error
14
20
 
15
21
 
16
22
 
17
- 実行時エラー '-2146233036(80311534)'
23
+ 実行時エラー '-2147467261(80004003)'
18
-
24
+
19
- 'OpenCVsharp.nativemethods'のタイプ初期化子が例外をスローしました
25
+ 値をNullすることができません。パラメータ名:path
20
26
 
21
27
 
22
28
 
@@ -40,36 +46,44 @@
40
46
 
41
47
  ```VBA
42
48
 
43
- Sub image(record As ClsRecord)
49
+ Option Explicit
50
+
51
+
52
+
44
-
53
+ Type Point
54
+
45
- With record
55
+ x As Integer
46
-
47
- Dim tmp As Variant
56
+
48
-
49
- tmp = Split(.cmd, ",")
50
-
51
- If UBound(tmp) <> 2 Then Exit Sub
52
-
53
- Dim p As POINT
57
+ y As Integer
54
-
58
+
55
- End With
59
+ End Type
60
+
61
+
62
+
56
-
63
+ Sub test()
64
+
57
-
65
+ Dim file1, file2, file3
66
+
58
-
67
+ Dim shot
68
+
69
+
70
+
59
- Dim w
71
+ Dim x
72
+
60
-
73
+ str file1 = "C:\Users\Desktop\after.bmp"
74
+
75
+ str file2 = "C:\Users\Desktop\before.bmp"
76
+
77
+ str file3 = "C:\Users\Desktop\drop.bmp"
78
+
61
- Set w = New ClassLibraryForVBA.ScreenShot
79
+ Set shot = New ScreenShot
62
-
80
+
63
- p = w.Imagediff(ActiveWorkbook.Path & "\" & tmp(0) & ".bmp", ActiveWorkbook.Path & "\" & tmp(1) & ".bmp", ActiveWorkbook.Path & "\" & tmp(2) & ".bmp")
81
+ shot.Imagediff file1, file2, file3
64
-
65
-
66
82
 
67
83
  End Sub
68
84
 
69
85
 
70
86
 
71
-
72
-
73
87
  ```
74
88
 
75
89
 
@@ -213,3 +227,55 @@
213
227
 
214
228
 
215
229
  ```
230
+
231
+ ```c#
232
+
233
+
234
+
235
+ テストコード
236
+
237
+
238
+
239
+ using System.Runtime.InteropServices;
240
+
241
+ using System.IO;
242
+
243
+ using System.Drawing;
244
+
245
+ using ClassLibraryForVBA;
246
+
247
+
248
+
249
+
250
+
251
+ namespace im_test
252
+
253
+ {
254
+
255
+ class Program
256
+
257
+ {
258
+
259
+ static void Main()
260
+
261
+ {
262
+
263
+ string file1 = Path.GetFullPath(@"C:\Users\mm05162\Desktop\after.bmp");
264
+
265
+ string file2 = Path.GetFullPath(@"C:\Users\mm05162\Desktop\before.bmp");
266
+
267
+ string file3 = Path.GetFullPath(@"C:\Users\mm05162\Desktop\drop.bmp");
268
+
269
+ var shot = new ScreenShot();
270
+
271
+ Point x = shot.Imagediff(file1, file2, file3);
272
+
273
+
274
+
275
+ }
276
+
277
+ }
278
+
279
+ }
280
+
281
+ ```