Reputation: 12183
I just discovered a weird bug in my Delphi Application. When I run the application, the Taskbar shows the icon, but I have to press it in order for the form to show. By setting a breakpoint in the OnShow event, I found that the OnShow event is being fired when I click on the Icon on the Taskbar.
Also, when I use Hide;
, the form hides, but the taskbar icon does not disappear, however when I click on it, the form does not show again (which is the point, but the taskbar icon is not supposed to be there when hidden).
Here is my project file source, in case that could have something to do with it:
var
PreviousHandle : THandle;
begin
PreviousHandle := FindWindow('TfrmMain',APP_CAPTION);
if PreviousHandle = 0 then
Begin
Application.Initialize;
// So my Log and Mainform can overlap each other
Application.MainFormOnTaskbar := False;
Application.Title := 'MyApp';
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmLog, frmLog);
Application.Run;
End else
begin
SetForegroundWindow(PreviousHandle);
end;
end.
I also tried disabling my Skinning Engine, which did not help either.
Upvotes: 2
Views: 524
Reputation: 21
frm_login.hide;
Application.MainFormOnTaskbar := false;
ShowWindow(Application.Handle, SW_SHOW);
frm_login is my primary form. frm_menu is not creating. it will creating by code after.
Upvotes: 0
Reputation: 12183
The WindowState was set to wsMinimized, and the editor does that randomly somehow. I just had to set it to wsNormal and it was all good. Both problems solved.
Upvotes: 1