回答編集履歴

2

WindowsのAPI関数についてコードを追加

2018/12/08 05:47

投稿

TanakaHiroaki
TanakaHiroaki

スコア1063

test CHANGED
@@ -29,3 +29,65 @@
29
29
 
30
30
 
31
31
  私は試しておりませんが、やってみる価値はあると思います。
32
+
33
+
34
+
35
+ <追記>
36
+
37
+ WindowsのAPI関数を64bitと32bitのどちらでも呼び出しできる記述を
38
+
39
+ 以下に示します。ただし、よく理解しないままにAPI関数を使うことは
40
+
41
+ お勧めしません。
42
+
43
+ ```VBA
44
+
45
+ 'API関数
46
+
47
+ #If VBA7 And Win64 Then
48
+
49
+ Private Declare PtrSafe Function FindWindowEx Lib "User32" Alias "FindWindowExA" ( _
50
+
51
+ ByVal hWndParent As LongPtr, _
52
+
53
+ ByVal hWndChildAfter As Long, _
54
+
55
+ ByVal lpszClass As String, _
56
+
57
+ ByVal lpszWindow As String) As LongPtr
58
+
59
+ Private Declare PtrSafe Function ShowWindow Lib "User32" ( _
60
+
61
+ ByVal hWnd As Long, _
62
+
63
+ ByVal nCmdShow As Long) As LongPtr
64
+
65
+ 'FindWindowExの戻り値を入れる変数
66
+
67
+ Dim hNavBar As LongPtr
68
+
69
+ #Else
70
+
71
+ Private Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" ( _
72
+
73
+ ByVal hWndParent As Long, _
74
+
75
+ ByVal hWndChildAfter As Long, _
76
+
77
+ ByVal lpszClass As String, _
78
+
79
+ ByVal lpszWindow As String) As Long
80
+
81
+ Private Declare Function ShowWindow Lib "User32" ( _
82
+
83
+ ByVal hWnd As Long, _
84
+
85
+ ByVal nCmdShow As Long) As Long
86
+
87
+ 'FindWindowExの戻り値を入れる変数
88
+
89
+ Dim hNavBar As Long
90
+
91
+ #End If
92
+
93
+ ```

1

表現修正

2018/12/08 05:47

投稿

TanakaHiroaki
TanakaHiroaki

スコア1063

test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  下記サイトが参考なると思いましたが、実行させるために
12
12
 
13
- 64bitに対応していないで、API関数の知識が必要す。
13
+ 64bitのAPI関数を準備する必要があります。
14
14
 
15
15
  https://www.ka-net.org/blog/?p=7697
16
16