void CImExAPIDemoDlg: : EnumDevice () {
TCHAR szDisk [26]={0};
DWORD dwSize;
Cstrings csValue=https://bbs.csdn.net/topics/_T (" ");
Int count=EnumateUSBDevice (szDisk);
M_ComList. ResetContent ();
For (int iLoop=0; ILoop
DwSize=GetUDiskCapacity (szDisk [iLoop]);
CsValue. The Format (_T (" % c: % d (GB) "), szDisk [iLoop], dwSize/2048);
M_ComList. AddString (csValue);
}
I write vb part...
Private Declare Function EnumateUSBDevice Lib "ImExLAPI. DLL" (ByVal szdisk As String) As Boolean
Private Sub Command1_Click ()
Text1. Text=EnumateUSBDevice (f)
End sub
49 why errors generated exe can occasionally error program debugging is definitely an error, what is going wrong? This is enumerated to connect u mouth equipment program
The entire program a lot, I will first take a look at the estimate this would extrapolate the,,, thank you master!
CodePudding user response:
CodePudding user response:
You posted the c code, see EnumateUSBDevice function form of the statement,From its call statement:
Int count=EnumateUSBDevice (szDisk);
Your VB6 API statement should be:
Private Declare Function EnumateUSBDevice Lib "ImExLAPI. DLL" (ByVal szdisk As String) As Long
CodePudding user response:
No, API statement should be like this:Private Declare Function EnumateUSBDevice Lib "ImExLAPI. DLL" (lpBuffer as Any) as Long
Use:
Dim arrBuffer (51) as byte
Dim n as long
N=EnumateUSBDevice (arrBuffer (0))
C code in TCHAR szDisk [26]={0};
The szDisk buffer is used to "output", it is the 26 (26) drive, it is possible that 26 bytes, it could also be 52 bytes,
So I think in VB6 to better it 52 bytes of buffer (after all, now one little memory, not counting the matter),
CodePudding user response:
Or not, and why error, when debugging generated EXE run after can I write that soCodePudding user response:
Int EnumateUSBDevice (TCHAR * szDisk);This is to declare this is a pointer???????
CodePudding user response:
API function must have the complete interface specification, otherwise, who know how to call?