Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ShellExecute

Posted on 2002-04-23
6
Medium Priority
?
511 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

688 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