VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Run the Associated file using ShellExecute

by Mohammad Faisal (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 2nd February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Run the Associated file using ShellExecute

API Declarations



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


Rate Run the Associated file using ShellExecute



   MsgBox RunAssociateFile("C:\tempDoc.htm")
End Sub


Public Function RunAssociateFile(ByVal strDocName As String) As Long
    Dim Scr_hDC As Long
    Dim lngRes As Long
    Scr_hDC = GetDesktopWindow()
    RunAssociateFile = ShellExecute(Scr_hDC, "Open", strDocName, "", "C:\", SW_SHOWNORMAL)
End Function


Download this snippet    Add to My Saved Code

Run the Associated file using ShellExecute Comments

No comments have been posted about Run the Associated file using ShellExecute. Why not be the first to post a comment about Run the Associated file using ShellExecute.

Post your comment

Subject:
Message:
0/1000 characters