刘
刘李子
Unregistered / Unconfirmed
GUEST, unregistred user!
怎样使用WINDOWS API<br>HWND CreateDialog(<br><br> HINSTANCE hInstance, // handle to application instance<br> LPCTSTR lpTemplate, // identifies dialog box template name <br> HWND hWndParent, // handle to owner window<br> DLGPROC lpDialogFunc // pointer to dialog box procedure<br> <br>下面代码的错误之处? ? ? <br>procedure TForm1.Button5Click(Sender: TObject);<br> function dlgpro(dlghandle:hwnd;dlgmsg:uint;dlgwp:wparam;dlglp:lparam):boolean;stdcall;<br> var<br> adc:hdc;<br> arect:trect;<br> agdiobj:hgdiobj;<br> begin<br> case dlgmsg of<br> wm_initdialog:<br> begin<br> getwindowrect(dlghandle,arect);<br> agdiobj:=getstockobject(black_brush);<br> adc:=getdc(dlghandle);<br> fillrect(adc,arect,agdiobj);<br> result:=true;<br> end;<br> wm_paint:<br> begin<br> updatewindow(dlghandle);<br> end;<br> end;<br> end;<br>var<br> ainstance,ret:thandle;<br>begin<br> ainstance:=loadlibrary('comdlg32.dll');<br> if ainstance <> 0 then begin<br> ret:=createdialog(ainstance,'open',application.handle,@dlgpro);<br> if ret=0 then showmessage('Create dialog failed !');<br> freelibrary(ainstance);<br> end<br> else showmessage('Load library failed !');<br>end;<br>