Results 1 to 9 of 9

Thread: *sigh*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257

    Question

    Does anyone know how to open a program like notepad or anything else without the OLE control(I want to be able to click on a command button to open the program) ??

    I'm guessing it's the "OpenFile" API call...

    Public Declare Function OpenFile Lib "kernel32"_
    Alias "OpenFile" (ByVal lpFileName As String, lpReOpenBuff_ As OFSTRUCT, ByVal wStyle As Long) As Long

    if it is, then what do i use for lpReOpenBuff ??

    thnx!!

  2. #2
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    I'm thinking you actually want

    Code:
    Public 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

    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  3. #3
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    oh, and

    Code:
    Public Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
    will give you the exe associated with a given file.



    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257
    Thanx Alot !!!

  5. #5
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362

    OFSTRUCT

    if you need it...

    Code:
    Public Type OFSTRUCT
            cBytes As Byte
            fFixedDisk As Byte
            nErrCode As Integer
            Reserved1 As Integer
            Reserved2 As Integer
            szPathName as String * 28
            '/szPathName(OFS_MAXPATHNAME) As Byte
    End Type
    ignore Reserved1 and 2

    cBytes is the length of the struct
    fFixedDisk is not zero if your reading of a disk
    nErrCode is a error identifier (there's a big list of 'em)
    szPathName is the full path name to the file (using the OEM char set)


    wStyle is a flag setting for the open operation (OF_CREATE, OF_READ, OF_DENY_READ etc)



    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257
    thnx again.
    For the ShellExecute function, it wants a window handle.
    handle from which window ?

  7. #7
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    It wants the handle to tell who the owner is.
    Give it something like me.hWnd (e.g. your hWnd of your form)


    td.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257
    k, tnx 4 the help
    much appreciated.

  9. #9
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    The OpenFile function creates, opens, reopens, or deletes a file.

    Yes I did get that straight from MSDN

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