Solved

ShellExecute

Posted on 2002-04-23
6
509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
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!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

624 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