主题:[讨论]关于API声明时的参数类型的问题
以FindWindow为例,
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
也可以改成
Private Declare Function FindWindowString Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
或
Private Declare Function FindWindowLong Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
参数的类型都可以适当地改变。
但在以前使用GetSaveFileName()时,仅仅时由于声明OPENFILENAME结构时的元素的顺序不一致,就导出了IDE崩溃。真是无语了~~~
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
也可以改成
Private Declare Function FindWindowString Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
或
Private Declare Function FindWindowLong Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
参数的类型都可以适当地改变。
但在以前使用GetSaveFileName()时,仅仅时由于声明OPENFILENAME结构时的元素的顺序不一致,就导出了IDE崩溃。真是无语了~~~