Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1065
  • Last Modified:

New to VS C++ and need help with ShellExecute

Hi,
I have started a C++ windows forms app and want to lanuch other windows apps at the click of a button - I'm doing this to learn the language and Windows programming. I have reviewed several answers on ShellExecute, but I still have problems. Here's what I did: I created a new project using C++, Windows Forms application. I then started dragging buttons from the toolbox to the form and positioning/naming them. I double click one and see where the code will go upon clicking, so that's where I put: ShellExecute(0,"open","http://www.netscape.com",0,0,0); since this button is to run Netscape. However when I build it, I get: error C3861: 'ShellExecute': identifier not found. Ok, so the function hasn't been defined, but I've tried to place this include: #include <shellapi.h> statement just below the other includes (like#include "stdafx.h" and #include "Form1.h") but then I get 153 errors when I build. I know the answer has to be a simple one, and I apologize in advance for the trivial issue.
0
teald4347
Asked:
teald4347
  • 2
  • 2
1 Solution
 
AlexFMCommented:
Is this managed application? In this case use Process::Start method.
0
 
mahesh1402Commented:
Try to link with library shell32.lib ...

But before check that what _WIN32_IE macro definbed as..I think you need to set _WIN32_IE macro to 0x0500 or higher.

-MAHESH
0
 
teald4347Author Commented:
Alex,
I don't think it's a managed application - how can I check for sure? Just C++ using VS 2005. I guess I could change that, but wanted to stay with C++ for now.

Mahesh,
Don't know how to link that lib but will research it.
Doesn't the _WIN32_IE macro deal with Internet Explorer? I'm not trying to use IE.

Thanks,
DCT
0
 
AlexFMCommented:
Accordint to the name Form1.h this is managed application. Please post some code fragment from Form1.h.
0
 
teald4347Author Commented:
It turns out that it is a managed app and the Process::Start method worked fine after I added the using namespace System::Diagnostics. Answer accepted.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now