Any ideas?
TMyDataModule = class(TDataModule)
procedure DataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject);
private
FHWND : HWND;
procedure WindProc(var Msg : TMessage);
public
property Handle : HWND read FHWND;
end;
procedure TMyDataModule.DataModuleCreate(Sender: TObject);
begin
FHWND := AllocateHWND(WindProc); // get a new window handle
end;
procedure TMyDataModule.DataModuleDestroy(Sender: TObject);
begin
DeallocateHWND(FHWND);
end;
This creates a handle and allows you to post messages to the datamodule.
Johann.
"bora" <bora.a...@gmail.com> wrote in message
news:46a25439$1...@newsgroups.borland.com...
The functions moved to another unit as part of the reorganization for
Linux/Kylix compatibility. The versions in Forms.pas are deprecated and
only there for backwards compatibility. The versions you are supposed
to use are in the Classes unit. To get rid of the warning qualify the
called function with the unit name: Classes.AllocateHwnd instead of
just AllocateHwnd.
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
Yes. Forms.AllocateHWND is replaced by Classes.AllocateHWND.
Just a move from one unit to another so that the forms unit is not taken
into programs which doesn't need the all forms stuff but still need a window
handle. This reduce the size of many console mode programs.
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
francoi...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
>Thanks, this solved a problem for me also.
>D7 flags AllocateHWND and deallocateHWND as deprecated. Is there a replacement?
There is one in the DSiWin32 unit, since the original ones are not
thread safe.
Regards from Germany
Franz-Leo
procedure TMyDataModule.WindProc(var Msg: TMessage);
begin
if Msg.Msg = WM_MYMESSAGE then
begin
DoSomething();
end
else
// let the default handler process the message
Msg.Result := DefWindowProc(FHWND, Msg.Msg, Msg.WParam, Msg.LParam);
end;
Johann.
"bora" <bora.a...@gmail.com> wrote in message
news:46a27903$1...@newsgroups.borland.com...
> Can I post a message to a datamodule?
Not directly. You would have to create a separate HWND for that, such as
with the VCL's AllocateHWnd() function, or the Win32 API's CreateWindow/Ex()
function.
> It has no handle property.
It is not a windowed control to begin with. It derives directly from
TComponent. It is not a TWinControl descendant.
Gambit