Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Can you please tell me everything I need to know to make a line like:

ShellExecute(handle, NULL, "c:\\windows\\onemore.bat", NULL, NULL, SW_HIDE);

work in my visual c++ enviroment + any headers or include files.

Thank you.
Posted
Updated 18-Dec-10 22:53pm
v2
Comments
Abhinav S 19-Dec-10 4:53am    
Code tage added.

You need a variable called handle, and you may need to include the header and/or .lib that defines SW_HIDE and ShellExecute. Did you consider reading the MSDN help to find out what header that is ? Do you have an understanding of how C++ works, and why certain things will make this code work, while other times it may not ? What issues have you had running this code ?
 
Share this answer
 
Comments
Niklas L 15-Jul-10 5:14am    
Reason for my vote of 5
I also think he needs a file named C:\windows\onemore.bat
ShellExecute(handle, NULL, "c:\\windows\\onemore.bat", NULL, NULL, SW_HIDE);

Why did you keep second parameter to NULL?

SQL
For Windows 2000 and later systems, the default verb is used if available. If not, the "open" verb is used. If neither verb is available, the system uses first verb listed in the registry i.e. 'edit'
- Source from MSDN
 
Share this answer
 
All you need to now is right here[^]. Bookmark that link.

Pressing F1 once in a while in your development environment is also recommended.
 
Share this answer
 
Comments
Abhinav S 19-Dec-10 4:55am    
Nice link.
At most, you need to include two headers
ShellAPI.h
Windows.h
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900