Advanced : Shell doesn't appear to be running asynchronously 
Author Message
 Advanced : Shell doesn't appear to be running asynchronously

In my previously experience Shell has normally always returned the process
id almost instantaneously.
However, recently I have come across two instances where it hasn't doesn't
this.

The first time was when calling an exe, which added data to a database. The
ProcID didn't return until the code had finished
executing, which was a pain because I wanted to be able to abort the
execution if it took over a specified period of time.

The second time was when shelling the DLL to show the printer control panel

I couldn't get the 'Printer' Dialog to display unless I put a message box in
the calling code. i.e.:

    lRetVal = Shell(CommandLine, State)

    If lRetVal Then
        Sleep 200
        'Need to display a msgbox to pick up the windows handle of the DLL
dialog
        MsgBox "Install a Printer, then Close the dialog " & Chr(13) & "and
Compass will continue running...  ", vbInformation + vbSystemModal
        lRetVal = FindWindow("CabinetWClass" & vbNullString, ByVal
vbNullString)

I actually wanted to use the Proc ID and then OpenProcess along with
WaitForSingleObject, to see when the window had closed, but I couldn't get
it to work??!!

This leads me to believe that the Proc ID isn't returned until a specific
message has been given from the called application, this seems to happen
when
a form or message box is displayed. Does anyone know how to force the Proc
ID to return at the start of execution????

--

Regards,

Andrew Baker

http://www.*-*-*.com/



Mon, 09 Dec 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Make SHELL run non-asynchronously?

2. Using the Shell function to run a program asynchronously

3. WScript.Shell Run Doesn't Work???

4. Wscript.shell Run doesn't work

5. Shell() running asynchronously w/ VB code

6. Advanced : Excel doesn't close when i release it's object

7. ADO Help doesn't appear (Access 2000, Windows 2000)

8. Item doesn't appear until after 1/2 hour

9. Help doesn't appear

10. Email text doesn't appear in sent items (sometimes)

11. Macros doesn't appear in list of commands

12. ImageURL doesn't appear

 

 
Powered by phpBB® Forum Software