Solved

ShellExecute

Posted on 2002-04-23
6
503 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
Comment Utility
try ShellExecute(Application.Handle, nil, PChar(...
0
 
LVL 12

Expert Comment

by:Lee_Nover
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Expert Comment

by:CyberUFO
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now