Solved

ShellExecute

Posted on 2002-04-23
6
507 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 50 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
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.

 

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 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