使用未公开函数问题
我在VB中使用了未公开的函数(它的顺序号是62),在VB中的声明中和使用如下:
Private Declare Function PickIconDlg Lib "Shell32" Alias "#62" (ByVal hwndOwner As Long, _
ByVal lpstrFile As String, ByVal nMaxFile As Long, lpdwIconIndex As Long)As Boolean
Private Sub Command1_Click()
Dim a As Long
Dim astr As String
Dim test As Boolean
astr = "c:\windows\notepad.exe"
test=PickIconDlg(Form1.hWnd, astr, 1, a) '成功调用返回1,否则为0
End Sub
我想在VC中调用此函数,可我怎样声明此函数的参数呢?我在VC中声明如下:
typedef BOOL(*PICKICON)(HWND hWnd,LPCTSTR lpFileName,UINT nMaxFile,
LPDWORD lpdwIconIndex);
//调用如下:
PICKICON PickIcon;
…… //使用了LoadLibrary GetProcAddress 并且都成功返回值
PickIcon(GetSafeHwnd(),"c:\\windows\\notepad.exe",1,lpi);
可是在调用此函数时没有什么问题,当函数调用完并返回时,发生了错误。
错误提示如下:
------------------------------------------------------------------
Debug Error!
Program:C:\MY DOCUMENTS\TEST\DEBUG\TEST.EXE
Module:
File:i863\chkesp.c
Line:42
The Value of ESP was not properly saved across a function call. This
is usually a result of calling a function declared with one calling
convention with a function pointer declared with a different calling
convertion
(Press Retry to debug the application)
------------------------------------------------------------------
我也试着使用其它的声明方式:
typedef BOOL(*PICKICON)(HWND hWnd,LPCTSTR lpFileName,int nMaxFile,
LPDWORD lpdwIconIndex);
f
等等
我能肯定是参数的声明错误,不知怎么声明。有高手指点吗?高分相送。
另外,我想知道那里有能查看DLL中函数的入口参数的工具.(VC自带的一些工具只能
查看DLL中函数中的函数名称,而不能查看函数的参数),有人知道的告诉,同样高分相送。
问题点数:0、回复次数:4Top
1 楼yonghengdizhen(等季节一过,繁花就凋落)回复于 2002-12-03 12:57:06 得分 0
声明没错调用有错..Top
2 楼riverboat(诸葛不亮)回复于 2002-12-03 13:11:55 得分 0
试试下面的方式:
typedef BOOL(*PICKICON)(HWND hWnd,LPCTSTR lpFileName,long* npMaxFile,
LPDWORD lpdwIconIndex);
如果你在VB中的声明能正确调用的话,nMaxFile应该是一个long型的传值调用,应该是用指针来传递数据的吧!
调用:
int nMaxFile=1;
PickIcon(GetSafeHwnd(),"c:\\windows\\notepad.exe",&nMaxFile,lpi);Top
3 楼afxtian(DancingCodes)回复于 2002-12-05 10:10:17 得分 0
我试过了还是不行!
请问还有什么好的建议吗?Top
4 楼afxtian(DancingCodes)回复于 2002-12-09 16:45:32 得分 0
我试过了还是不行!
请问还有什么好的建议吗?Top




