Results 1 to 8 of 8

Thread: Powerful API question

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Question

    I've noticed that many of the more powerful API calls involve either ShellExecuteA,

    ShellExecuteB, or something along those lines. What exactly can be done with that API?

    And while I'm at it, does anyone know how to make the control-panel pop up?

    I've tried it in a windows NT4 environment, but it didn't work. Why?

  2. #2
    Megatron
    Guest
    It opens a file with its default app.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Unhappy How about these?

    there's a way to open the find file dialog, any folder, a vb program
    anything else along those lines?

  4. #4
    Megatron
    Guest
    To open a folder, you don't even need to use ShellExecute. Use VB's Shell method instead.
    Code:
    Shell "explorer C:\MyFolder", 1
    This example shells "Explorer" (Windows explorer) and passes the folder name as the command line argument. In most programs, whatever is passed in the command line argument is what file should be opened.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Wink Anything else?

    Okay, that's useful, but with this api, you can open the folder up as if you clicked on it.

    Does anyone know a website, or could they list any other calls here?

    What I'm asking is: What goes here:?
    ---------------
    Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal _
    lpOperation As String, ByVal lpFile As String, ByVal _
    lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
    Private Const SW_SHOWNORMAL = 1

    ShellExecute 0,{HERE},{MAYBE HERE}, vbNullString, vbNullString, 1
    ---------------
    Or anywhere else in that last line?

  6. #6
    Megatron
    Guest
    Code:
    ShellExecute hwnd, "open", "C:\Myfile.txt", "", "", 1

  7. #7
    Matthew Gates
    Guest
    To open the Find Files Dialog, use this:


    Code:
    Private Declare Function ShellExecute _
    Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As _
    Long, ByVal lpOperation As String, ByVal lpFile As String, _
    ByVal lpParameters As String, ByVal lpDirectory As _
    String, ByVal nShowCmd As Long) As Long
    
    
    
    Private Sub Command1_Click()
    
        Dim strPathToSearch As String
        strPathToSearch = "C:\"
        ShellExecute Me.hwnd, "find", strPathToSearch, _
        vbNullString, vbNullString, 1
    
    End Sub

    For more on the ShellExecute API function, take a look at this link.

    http://www.vbapi.com/ref/s/shellexecute.html

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Cool

    I know this works with the shell function but I'm not sure about the API calls. Maybe this might help you figure it out. When you do can you post it?

    'Control Panel itself:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL")

    'Display:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3")

    'Background:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0")

    'Apperance:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,2")

    'Screen Saver:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1")

    'Settings:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3")

    'Date/Time:
    X = Shell("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl")

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