Link to home
Start Free TrialLog in
Avatar of arsmed840
arsmed840Flag for United States of America

asked on

Shell Execute VB Error Message - Unbalanced Stack

Hi Experts

I am trying to open a doc file using a VB application.
The code I am using is as below:

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

ShellExecute(0&, "Open", "MyFileName.doc", CommandLine, vbNullString, 1)

i end up in getting the error message "A call to PInvoke function 'SampleWorkFlowAppln!SampleWorkFlowAppln.Form1::ShellExecute' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature."

Any suggestions on what could be wrong?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial