Results 1 to 2 of 2

Thread: open a file?

  1. #1

    Thread Starter
    Junior Member dries's Avatar
    Join Date
    Dec 2001
    Posts
    20

    Question open a file?

    How do I open a file using APIs?

    Thanks

    dries

  2. #2
    Matthew Gates
    Guest
    Use the ShellExecute API function.


    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" _
    2. Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
    3. String, ByVal lpFile As String, ByVal lpParameters As String, ByVal _
    4. lpDirectory As String, ByVal nShowCmd As Long) As Long
    5.  
    6. Private Sub OpenFile(sFile As String)
    7.     ShellExecute Me.hwnd, vbNullString, sFile, vbNullString, vbNullString, 1
    8. End Sub
    9.  
    10. Private Sub Command1_Click()
    11.     Call OpenFile("C:\MyFile.txt")
    12. End Sub

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