Newbie: Compile error: Argument (ShellExecute) not optional 
Author Message
 Newbie: Compile error: Argument (ShellExecute) not optional

When compiling Ed's code (below) I get the following error: Compile error -
Argument not optional.  It is the ShellExecute argument that is highlighted.
Any ideas?

Ed Phillippe's code:

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 Sub Command1_Click()

Dim RetVal As Long
RetVal = ShellExecute(Me.hwnd, App.Path & _
"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.
End Sub



Sat, 21 Jul 2001 03:00:00 GMT  
 Newbie: Compile error: Argument (ShellExecute) not optional
looks like u are missing an argument (vbNullString) in ur call...

ItheG

Quote:

>When compiling Ed's code (below) I get the following error: Compile error -
>Argument not optional.  It is the ShellExecute argument that is
highlighted.
>Any ideas?

>Ed Phillippe's code:

>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 Sub Command1_Click()

>Dim RetVal As Long
>RetVal = ShellExecute(Me.hwnd, App.Path & _
>"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.
>End Sub



Sat, 21 Jul 2001 03:00:00 GMT  
 Newbie: Compile error: Argument (ShellExecute) not optional
Try:

RetVal = ShellExecute(Me.hwnd, vbNullString, App.Path & _
"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.

Quote:

>When compiling Ed's code (below) I get the following error: Compile error -
>Argument not optional.  It is the ShellExecute argument that is
highlighted.
>Any ideas?

>Ed Phillippe's code:

>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 Sub Command1_Click()

>Dim RetVal As Long
>RetVal = ShellExecute(Me.hwnd, App.Path & _
>"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.
>End Sub



Sat, 21 Jul 2001 03:00:00 GMT  
 Newbie: Compile error: Argument (ShellExecute) not optional
When you read the error message, what did you think the problem was?  If you
count the number of parameters in the declaration, you will find 6.  If you
count the number of arguments in your function call, you will find 5.  There's
one missing.  It's the Operation string.  Change the function call to:

RetVal = ShellExecute(Me.hwnd, "open", App.Path & _
"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.

Lee Weiner
weiner AT fuse DOT net


Quote:

>When compiling Ed's code (below) I get the following error: Compile error -
>Argument not optional.  It is the ShellExecute argument that is highlighted.
>Any ideas?

>Ed Phillippe's code:

>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 Sub Command1_Click()

>Dim RetVal As Long
>RetVal = ShellExecute(Me.hwnd, App.Path & _
>"\movies\sisside1.rm", vbNullString, vbNullString, 1)  ' Run Movie.
>End Sub



Sat, 21 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Argument no optional/ Compile error

2. Argument not optional

3. Argument is not optional

4. Argument Not Optional: ac97, calling a function

5. Argument not optional

6. VB-Bug ---->argument not optional

7. VB4 Update Argument Not Optional DAO 3.5

8. argument not optional

9. Argument Not Optional

10. Argument not optional :/

11. Argument not optional in VB6 function

12. asp/vbscript/vb optional procedure arguments not passed....

 

 
Powered by phpBB® Forum Software