Results 1 to 9 of 9

Thread: Using ShellExecute (Another one for the Guru's)

  1. #1

    Thread Starter
    Addicted Member VB6Coder's Avatar
    Join Date
    Apr 2001
    Location
    Northampton, UK
    Posts
    185

    Question Using ShellExecute (Another one for the Guru's)

    I'm using ShellExecute to show the Find All dialog, which works fine.
    http://support.microsoft.com/support...n_SRCH&SPR=VBB

    The problem is getting a window handle to the Find All dialog I've just displayed.

    Say I already have 2 Find All dialogs open and I call ShellExecute to display another, how do I get the window handle to the Find All dialog I've just displayed.

    I can't use FindWindowEx because the window caption will be the same for all the Find All dialogs.

    It says on www.vbapi.com that ShellExecute should return the window handle, but I keep getting 33 returned when I run it in Windows 2000 and 123 when I run it in Windows 95.

    How do I get the correct window handle?

    Thanks in advanced

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    That information is incorrect. According to MSDN, the return code will be > 32 if success, <32 if failed. There is no way to get the window handle.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3
    jim mcnamara
    Guest
    Goto www.vbapi.com

    Look up ShellExecuteEx.

    It returns, among other things, the hWnd of the window created.

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

  5. #5
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    hey

    Try using CreateProcessA function it returns handles to both the process, and the thread that is subsequently created in the PROCESS_INFORMATION structure.

    It also allows you to specify priority such as REALTIME_PRIORITY_CLASS [bad idea, btw!]

    This function is far superior to Shell, ShellExecute etc. You may also find CreateProcessAsUser which is even better .. .

    Hope this helps

  6. #6

    Thread Starter
    Addicted Member VB6Coder's Avatar
    Join Date
    Apr 2001
    Location
    Northampton, UK
    Posts
    185

    Question

    How do you display the Windows Find All Files dialog using CreateProcessA yrwyddfa?

  7. #7
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    ah.

    good point - I will try to find out . . .

    How do you do it with ShellExecute?

  8. #8
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Shellexecute has a special adjuster for the find dialog, i.e.
    Code:
             Call ShellExecute(Me.hwnd, _
                               "find", _
                               StrPtr("C:,D:" & vbNullChar), _
                               vbNullString, _
                               vbNullString, _
                               SW_SHOWNORMAL)
    so if you can do this with CreateProcess i'll be quite moved...
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  9. #9
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Explorer

    Find All Files dialogue seems to be driven from Windows Explorer:

    explorer.exe /e,/C:

    But I can't find the switch for the dialogue - I will keep looking though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width