Results 1 to 2 of 2

Thread: Filelist control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    karachi
    Posts
    90

    Filelist control

    Hello,
    I made a programm of file viewer i want to open txt file
    in notepad whenever i double click in the filelistbox 's file extension txt.
    Is it Possible
    B R

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can use the ShellExecute API
    VB Code:
    1. 'put this in a module or decalre it as private instead of public
    2. 'declares for shell by association
    3. 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
    4. Private Const SW_SHOW As Integer = 5
    5. Public Const SW_NORMAL = 1
    6.  
    7. 'then whereever you want to open the file do this
    8. dim ret as integer
    9.         ret = ShellExecute(0&, "open", File1.Path & "\" & File1.FileName,vbNullString, vbNullString, SW_NORMAL)
    10.         If ret < 32 Then
    11.             msgbox "An error occurred"
    12.         Else
    13.             msgbox "it worked"
    14.         End If

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