Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ShellExecute

Posted on 2002-04-23
6
Medium Priority
?
512 Views
Last Modified: 2010-04-04
Hi,
I'm using ShellExecute to run a 16bit app. The command is as follows :
       ShellExecute (Handle, 'open',
                     PChar ('Pro16.exe'),
                     '', 'c:\Testpr~1\Test16~1', SW_HIDE);

The 16bit app windows supposed to be invisible... but it doesn't.

How to hide the window?

Thanks
0
Comment
Question by:llkhor
6 Comments
 
LVL 3

Expert Comment

by:SteveWaite
ID: 6964581
try ShellExecute(Application.Handle, nil, PChar(...
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6964991
if it's still visible then set it's visibility with ShowWindow(hWin, false);
0
 
LVL 1

Accepted Solution

by:
nrico earned 150 total points
ID: 6965344
Run it with WinExec('Pro16.exe', SW_HIDE);

This works (definately) for console applications. Dunno if it works for 16-bit windows apps too, since the program is nog obligated to follow the startup Display flags.

If it's still visible retrieve its window handle using FindWindow and then use ShowWindow(hWindow, SW_HIDE) as Lee suggested.

Good luck.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:CyberUFO
ID: 6968507
I think it can be solved by retrieve the app's handle and set it to hide, but dunno why
Execute(Application.Hanlde,
        nil,PChar(...)...)
can't work . :-(

BTW: Through, ur application is 16-bit,  WinExec() function is only provided for compatibility with 16-bit Windows, I don't think ur Win32-based app need to use it.
But maybe it works :-(
0
 
LVL 1

Expert Comment

by:nrico
ID: 6968564
Sure, but WinExec still works (as an alias for CreateProcess I believe), it's LOTS easier to use because it requires less parameters and supports exactly what you want, namely a filename and a show parameter.
0
 

Author Comment

by:llkhor
ID: 6970331
thanks to all.

nrico,

firstly, my mistake of including the ShellExec in Pro32's FormCreate.

WinExec() doesn't work and I need to use:
 
   in Pro32's onFormActivate -  

     ShellExecute (Application.Handle, 'open',
              PChar('Pro16.exe'), '', 'c:\', SW_HIDE);  

     h := FindWindow('TfPro16',nil);
     if h <> 0 then
          ShowWindow(h,SW_HIDE);

and it works.

thanks.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question