ShellExecute not working in Vis C++ Express?

Started by
2 comments, last by Davaris 18 years, 2 months ago
I just noticed that the ShellExecute function doesn't seem to work in Vis C++ 2005 Express. These are the calls to open a webpage. I used the second one with no problems in the past. Now I've upgraded to Express, it doesn't seem to work. ShellExecute(NULL,"open","http://www.gamedev.net/", NULL, NULL, SW_SHOWNORMAL); ShellExecute (NULL, "open", "iexplore.exe", http://www.gamedev.net/", NULL, SW_SHOWMAXIMIZED); Does anyone know of a work around?
"I am a pitbull on the pantleg of opportunity."George W. Bush
Advertisement
I use C++ 2005 Express and it works for me. It's probably because I've declared all the Windows libraries at the top of my main header or main cpp files. By default, C++ 2005 does not have support for Win32 "out-of-the-box" as it's intended to use the .NET Framework. There's a couple of things you can do:

1. Declare Windows libraries at the start of your main file.
2. Edit a file to include everything for each project.

1. At the start of your main file, type:

#pragma comment(lib, "kernel32.lib")#pragma comment(lib, "user32.lib")and so on (include the rest: gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib)


2. Go to: "C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults" or wherever you installed C++ 2005, open the file called "corewin_express.vsprops" and insert all those names into the "additional dependencies" variable. So it should look like this:

<?xml version="1.0"?><VisualStudioPropertySheet 	ProjectType="Visual C++" 	Version="8.00" 	Name="Core Windows Libraries">	<Tool 		Name="VCLinkerTool" 		AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" /></VisualStudioPropertySheet>


Or something to that effect. For the function ShellExecute I believe that shell32.lib is the main one you need. Though it wouldn't hurt to add the rest if you'll be using them later. I hope this works, or is on the right track lol.
You upgraded to express? I thought express was the trial version.. Unless you went from vs 2003 or something.

Anyways, visual C++ requires you to download the PSDK from windows' website. If you don't have it you can't compile most of your programs because windows has almost no headers otherwise. If you already have the PSDK(Platform Software Development Kit) then some compilation errors would be nice.
Hello?
Kryptus:
I tried your suggestion, but no luck unfortunately. Is your Code Generation Setting Multi-Threaded or Single Threaded? Mine is multi.


>Anyways, visual C++ requires you to download the PSDK from windows' website

I downloaded and installed it so I could make Win 32 programs.
"I am a pitbull on the pantleg of opportunity."George W. Bush

This topic is closed to new replies.

Advertisement