DLL向窗体发消息,请大家看看我的代码错在哪里?(100分)

  • 主题发起人 notnoname
  • 开始时间
N

notnoname

Unregistered / Unconfirmed
GUEST, unregistred user!
Form1中的代码:<br>...<br>const NEW_IE = WM_APP+$0001;<br><br>type<br>&nbsp; TIeCreMessage=record<br>&nbsp; &nbsp; Msg:Cardinal;<br>&nbsp; &nbsp; wParam:DWORD;<br>&nbsp; &nbsp; lParam:DWORD;<br>&nbsp; &nbsp; Result:Longint;<br>&nbsp; end;<br>type<br>&nbsp; TForm1 = class(TForm)<br>...<br>&nbsp; protected<br>&nbsp; &nbsp; procedure CreateIeOle(var Msg:TIeCreMessage); message NEW_IE;<br>&nbsp; end;<br>...<br>procedure TForm1.CreateIeOle(var Msg:TIeCreMessage);<br>begin<br>&nbsp; &nbsp; if Msg.Msg = NEW_IE then<br>&nbsp; &nbsp; &nbsp; ShowMessage('Find new ie')<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; inherited;<br>end;<br>...<br>----------------------------------<br>DLL中的代码<br>...<br>const NEW_IE=WM_APP+$0001;<br>...<br>&nbsp; SendMessage(MainFormHandle,Cardinal(NEW_IE),0,0);//程序运行无任何结果<br>...<br>请大侠帮忙!!<br>
 
动态库中的MainFormHandle 不对
 
MainFormHandle:=Form1.handle;
 
如您所说,是那个问题。可能是我参数传递的方法不对!谢谢了!
 
顶部