[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2088
  • Last Modified:

WinExec - SW_ShowMinimized

I must be getting tired....

I Launch an app (from Delphi 1) using WinExec and I specify SW_ShowMinimized for the visibility.  If the program is something like Notepad etc.. everything works OK, the app is minimized.  If I specify one of my Delphi apps, it is like SW_ShowNormal.  The new app doesn't minimize.  

What am I missing here ??
0
icampbe1
Asked:
icampbe1
  • 2
1 Solution
 
bsysCommented:
I don't have any Delphi IDE with me here but could it be that when you launch your proggy that the first form is set to normal because it is stated in the source that way??
0
 
icampbe1Author Commented:
No. I don't do anything to specifically keep the form at full size.  Send me a comment with a Delphi example.  I'm gonn reject this so I can get some other answers.

Thanks,

Ian C.

0
 
buemohCommented:
Hallo icampbe1,

your problem is, that your programs, written with Delphi, don't recognize the SW_SHOWMINIMIZED, because each Delphi program has a hidden application window, which gets this information and not the shown form.

If you want, that your program should be minimized, then you've to set the main form window as minimized like this:

procedure TForm1.FormCreate( Sender : TObject );
begin
  ShowWindow( Handle, cmdShow );
end;

If now the application is called with SW_SHOWMINIMIZED then your form window recognize this and is shown minimized.

Hope, that's what you want.

Bye

Hartwig

-----------------------------------------------------------------------------------------------------
///\\\ Hartwig MOTAL ///\\\  e-mail: moh@bue.magwien.gv.at
 Weinberggasse 60/9/7, A-1190  Vienna/Austria/Europe

0
 
icampbe1Author Commented:
That is exactly what I wanted.  Note however that minimizing the form leaves the application still there.  I want the application to be iconic as well.  If I showform( application.handle, cmdshow ) as well, then I get two icons on the task bar.  But I can solve this.  Your answer is excellent.

Thanks,

Ian Campbell
Toronto.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now