Sign in to follow this  

ShellExecute not working in Vis C++ Express?

This topic is 4339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this