Recent

Author Topic: window handle  (Read 5606 times)

Pegasus_Seiya

  • New Member
  • *
  • Posts: 25
window handle
« on: December 18, 2006, 01:47:24 am »
hi

how to create a window handle on Lazarus (Windows)?



Thanks

JanH

  • Guest
RE: window handle
« Reply #1 on: December 18, 2006, 08:51:32 am »
Handle is a property of all descendants of TWinControl.
If you want to Create your own Handle (WinAPI - CreateWindow(...)) then your code is platformspecific.

Pegasus_Seiya

  • New Member
  • *
  • Posts: 25
Re: RE: window handle
« Reply #2 on: December 18, 2006, 06:53:52 pm »
Quote from: "JanH"
Handle is a property of all descendants of TWinControl.
If you want to Create your own Handle (WinAPI - CreateWindow(...)) then your code is platformspecific.


thanks

Pegasus_Seiya

  • New Member
  • *
  • Posts: 25
RE: Re: RE: window handle
« Reply #3 on: December 18, 2006, 08:01:30 pm »
how to make it on lazarus??

hWindow     := Classes.AllocateHWND(WindowEvent);

JanH

  • Guest
Re: RE: Re: RE: window handle
« Reply #4 on: December 20, 2006, 07:19:08 am »
Quote from: "Pegasus_Seiya"
how to make it on lazarus??

hWindow     := Classes.AllocateHWND(WindowEvent);



Try it like this:

Code: [Select]

TMyForm=class(TForm)
private
  procedure WndProc(var TheMessage : TMessage); override;
end;

procedure TMyForm.WndProc(var TheMessage : TMessage);
begin
  if( TheMessage.Msg=WM_ACTIVATE )then begin
    //do anything
  end;
  inherited WndProc( TheMessage );
end;


Then you have a form object with an new window procedure without accessing windows api directly. and it works ;-)

Pegasus_Seiya

  • New Member
  • *
  • Posts: 25
Re: RE: Re: RE: window handle
« Reply #5 on: December 21, 2006, 12:27:01 am »
hi

thanks

I'll try it

=)

 

TinyPortal © 2005-2018