遇到一个奇怪的问题,请大家多帮忙,对不起小弟没分了:((0分)

  • 主题发起人 主题发起人 yqkx
  • 开始时间 开始时间
Y

yqkx

Unregistered / Unconfirmed
GUEST, unregistred user!
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 《根据一位网友的文章》<br>我加入了自己的事件<br>procedure ClickFunction(sender:tobject);<br>begin<br>showmessage('出现提示');<br>end;<br>------------------------------------------------------------------------------<br>var <br>&nbsp; b: TButton; &nbsp;// or another Type of button ,比如flatButton之类的。<br>&nbsp; h, TrayWindow : hwnd; <br>begin <br>&nbsp; TrayWindow := FindWindow('Shell_TrayWnd', nil); <br>&nbsp; b := TButton.Create(nil); <br>&nbsp; b.ParentWindow := TrayWindow; <br>&nbsp; b.Caption := 'Start'; <br>&nbsp; b.Width := 60; <br>&nbsp; b.font.style := [fsbold];<br>&nbsp; b.OnClick := ClickFunction ; <br>------------------------------------------------------------------------------<br>开始按钮是替换掉了, 但是为什么没有出现“出现提示”呢小弟刚学编程请大家多帮忙我<br>点好吗? 谢谢大家:) 可惜没分了。
 
可能是它们不在一个进程中的原因。
 
此句procedure ClickFunction(sender:tobject);<br>应写为:<br>procedure TForm1.ClickFunction(sender:tobject);<br>
 
是的我这样写的:<br>procedure TForm1.ClickFunction(sender:tobject);<br>
 
不知道。
 
对了,请问一下,您那样做,是否成功的在那个窗体上加了一个按钮?<br>那么,的确可能是它们不在一个进程中的原因?<br>您应该把处理过程编译到dll中,否则一个exe是不可能执行另一个exe中代码的。<br>也就是说,您定义的处理过程是在您的exe中,而另外的exe是不可能调用您的exe中的代码的
 
后退
顶部