I'm having problems using "ShellExecute" in VB.NET. In using ShellExecute I only need to specify target file and the OS will work out which application to use to open the specified file. For my example below I get target application run and open the supplied file however I get an error (in the calling VB.NET application) indicating unbalanced stack, suggesting inappropriate parameters supplied to ShellExecute. I tried a few variations but get similar/worse results.
What am I doing wrong in the code below?
Dim R As Long
Dim Scr_hDC As Long = GetDesktopWindow()
R = ShellExecute(Scr_hDC, TargetFileName, "Open", vbNullString, vbNullString, SW_SHOWNORMAL)
P.S. In my VB6 application I used:
R = ShellExecute(Scr_hDC, "Open", TargetFileName, "", TargetDirpath, SW_SHOWNORMAL)
and that worked for me but not for VB.NET.