Masonok
asked on
Button on the Desktop!
Hi everyone!
I have a 1 form and 1 button on it! (It's a sample). By pressing on Button1 should be created Button2 on Windows Desktop (or somewhere else).
Procedure TForm1.Proc1(Sender : TObject);
begin
ShowMessage('Cool');
end;
procedure TForm1.Button1Click(Sender : TObject);
var MyBut : TButton;
begin
MyBut:=TButton.Create(nil) ;
(1)//MyBut.ParentWindow:=F orm1.Handl e;
(2)MyBut.ParentWindow:=Get DesktopWin dow;
MyBut.Caption:='MyBut';
MyBut.onclick:=Proc1;
end;
Check this out - (1) is working properly - it is create MyButton and This button shows Message "COOL",
But... (2) I see the Button, I can change Caption but... OnClick doesn't work and also on task bar appear one more button(as for application)
What else? May be..... HEEEELP Please!!
I have a 1 form and 1 button on it! (It's a sample). By pressing on Button1 should be created Button2 on Windows Desktop (or somewhere else).
Procedure TForm1.Proc1(Sender : TObject);
begin
ShowMessage('Cool');
end;
procedure TForm1.Button1Click(Sender
var MyBut : TButton;
begin
MyBut:=TButton.Create(nil)
(1)//MyBut.ParentWindow:=F
(2)MyBut.ParentWindow:=Get
MyBut.Caption:='MyBut';
MyBut.onclick:=Proc1;
end;
Check this out - (1) is working properly - it is create MyButton and This button shows Message "COOL",
But... (2) I see the Button, I can change Caption but... OnClick doesn't work and also on task bar appear one more button(as for application)
What else? May be..... HEEEELP Please!!
Your right, very interesting, I will be checking into it and listening in case someone comes up with a good solution.
Can't seem to get any kind of control to accept focus. You could, however just stick em on a form sized fit.
GL
Mike
GL
Mike
The problem is that you are not catching the mouse messages for the button created on the desktop. When you made the form the parent, the form handled the messaging. For the desktop button, you will need to use the SetCapture API to capture the mouse messages.
Good luck!!
Good luck!!
listening
delphi, so you capture the mouse messages, and everytime someone clicks... you then do (manually) button.click; And simulate it?.... I have code to capture the mouse clicks, just that this code was given to me, but i could never use it due to stability...... ok heres the code.....
http://tenerife1.com/cjc/catchd4.zip <<If you can get this more stable, this will help you.....
http://tenerife1.com/cjc/catchd4.zip <<If you can get this more stable, this will help you.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
listenning
well, the simplest way of creating an 'alien' button in other application was well described by Alex Xacker from utilmind.com - he shows how to put tbutton in calc.exe... go there and check it out...
Hope this helped
GL
Mike
GL
Mike