Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Feb : Hide Main Form when Showing Child Window
| Subject: | Hide Main Form when Showing Child Window |
| Posted by: | "Michael Fritz" (spam_athome@yahoo.de) |
| Date: | Tue, 15 Feb 2005 16:34:04 |
Hi,
Hiding the main form has been discussed here many times. It works for me
too however when showing a child window the main form or at least the task
bar shows up the application again.
I'm using a non-VCL coding to create a window which is hidden from the task
bar and a tray icon. The following code creates the window and the main
message loop.
Any ideas on how to hide the main form and to display child forms anyway?
procedure WinMain;
var
oMsg: TMsg;
oClass : TWndClass;
begin
// Register the window class
FillChar(oClass, SizeOf(oClass), 0);
oClass.lpfnWndProc := @DummyWindowProc;
oClass.hInstance := hInstance;
oClass.lpszClassName := APP_TITLE;
RegisterClass(oClass);
// Now create a dummy window
iWnd := CreateWindowEx(WS_EX_TOOLWINDOW,
APP_TITLE,APP_TITLE,WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
0, 0, hInstance, Nil);
// we received a valid handle?
if (iWnd <> 0) then
begin
ShowWindow (iWnd, SW_HIDE);
// message loop
while GetMessage (oMsg, 0, 0, 0) do
begin
TranslateMessage(oMsg);
DispatchMessage(oMsg);
end;
end;
end;
--
cu,
Michael