473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

ShellExecute error

Hi.

I have the following code:

Option Compare Database

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 Integer) As Long
Private Sub Command86_Click()
r = ShellExecute(0, "open", "C:\Windows\System32\Notepad.exe", "",
"C:\", 1)
End Sub
When I click the button, I get the following error message:

"The expression On Open you entered as the event property settings
produced the following error: constants, fixed-lenght strings, arrays,
user defines types and Declare statments are not allowed as Public
members of object modules"

Can I have some help, please?

Thanks
H. Martins

Nov 12 '07 #1
2 1829
On Nov 12, 11:50 am, "H. Martins" <HJRMart...@gmail.comwrote:
Hi.

I have the following code:

Option Compare Database

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 Integer) As Long

Private Sub Command86_Click()
r = ShellExecute(0, "open", "C:\Windows\System32\Notepad.exe", "",
"C:\", 1)
End Sub

When I click the button, I get the following error message:

"The expression On Open you entered as the event property settings
produced the following error: constants, fixed-lenght strings, arrays,
user defines types and Declare statments are not allowed as Public
members of object modules"

Can I have some help, please?

Thanks
H. Martins
I highly suspect you are in the wrong newsgroup. The Access newsgroup
is at comp.databases.ms-access

Thanks,

Seth Rowe

Nov 12 '07 #2
H. Martins wrote:
Public Declare Function ShellExecute Lib "Shell32.dll" . . .
Private Sub Command86_Click()
r = ShellExecute(0, "open", "C:\Windows\System32\Notepad.exe", "",
"C:\", 1)
End Sub
"The expression On Open you entered as the event property settings
produced the following error: constants, fixed-lenght strings, arrays,
user defines types and Declare statments are not allowed as Public
members of object modules"
The last part is the important one ...

"... Declare statements are not allowed as Public members ..."

Make the "Declare Function" Private and you should be OK.

Private Declare Function ShellExecute Lib "Shell32.dll" . . .

HTH,
Phill W.
Nov 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and...
0
by: the_openFace | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: the openBack | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd,...
0
by: David | last post by:
We have an mfc application in which we use ShellExecute to launch the browser with an initial web site. {ShellExecute( NULL, "open", "http://www.SomeWebSite.com", NULL, NULL, SW_SHOWNORMAL ) } ...
4
by: fdmaxey | last post by:
I currently start a target executable written in VB.Net from an application that uses a C-script language. I start the target executable using ShellExecute in the C-script. The target runs fine...
2
by: Terry Olsen | last post by:
When starting a process, what is the difference between using ShellExecute or not using it? I need to start IE when a link is clicked in my app. I want as little impact to my app as possible....
3
by: devecibasi | last post by:
Hi, I am trying to use ShellExecute function to invoke the ax program. The code below works perfect: ShellExecute(0&, "open", "ax.exe", "C:\2runtemp2.run", "C:\axfolder", 5) The code below...
5
by: =?Utf-8?B?aGtNaWNybw==?= | last post by:
Having problems compiling the following code in C USING CL.EXE // shell.c LANGUAGE = .NET 2003 #include <iostream.h> #include <windows.h> int main() { SHELLEXECUTE(NULL, "open",...
0
by: khokhar.hassan | last post by:
i hava a VB application that is used to run different application by using ShellExecute. These applications also includes Adode reader to open .pdf files. The application is working fine with...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.