K
Kingron
Unregistered / Unconfirmed
GUEST, unregistred user!
我用下面的API,总是不能调用出来,那位兄弟给看看?<br>错误信息是:参数错误。<br>type<br> TLPOFNHOOKPROC=function(h:hwnd;uMsg:UINT;wp:wparam;lp:lParam):integer;<br>type<br> TOpenInfo=packed record<br> lStructSize:dword;<br> hwndOwner:hwnd;<br> hInstance:Hwnd;<br> lpstrFilter:LPCTSTR;<br> lpstrCustomFilter:LPTSTR;<br> nMaxCustFilter:dword;<br> nFilterIndex:dword;<br> lpstrFile:lptstr;<br> nMaxFile:dword;<br> lpstrFileTitle:lptstr;<br> nMaxFileTitle:dword;<br> lpstrInitialDir:lpctstr;<br> lpstrTitle:lpctstr;<br> Flags:dword;<br> nFileOffset:word;<br> nFileExtension:word;<br> lpstrDefExt:lpctstr;<br> lCustData:Lparam;<br> lpfnHook:TLPOFNHOOKPROC;<br> lpTemplateName:lpctstr;<br> pvReserved:integer;<br> dwReserved:dword;<br> FlagsEx:dword;<br> end;<br><br>function GetOpenFileName(var info:TOpenInfo):boolean;stdcall; external 'comdlg32.dll' name 'GetOpenFileNameA';<br><br><br>procedure TForm1.BitBtn1Click(Sender: TObject);<br>var<br> info:TOpenInfo;<br>begin<br> info.lStructSize:=sizeof(info);<br> info.hWndOwner:=handle;<br> info.hInstance:=hinstance;<br> info.lpstrFilter:='';<br> info.lpstrCustomFilter:='';<br> info.nMaxCustFilter:=0;<br> info.nFilterIndex:=0;<br> info.lpstrFile:='c:/text.txt';<br> info.nMaxFile:=2;<br> info.lpstrFileTitle:='Open';<br> info.lpstrInitialDir:='c:/';<br> info.lpstrTitle:='Open Test';<br> info.Flags:=OFN_ENABLESIZING+OFN_EXPLORER;<br> info.nFileOffset:=0;<br> info.nFileExtension:=1;<br> info.lpstrDefExt:='.txt';<br> info.lCustData:=0;<br> info.lpfnHook:=nil;<br> info.lpTemplateName:='';<br> info.pvReserved:=0;<br> info.dwReserved:=0;<br> info.FlagsEx:=0;<br> GetOpenFileName(info);<br> caption:=SysErrorMessage(getlasterror);<br>end;