Solved

New to VS C++ and need help with ShellExecute

Posted on 2006-07-08
5
988 Views
Last Modified: 2007-12-19
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
Comment
Question by:teald4347
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 50 total points
ID: 17067084
Is this managed application? In this case use Process::Start method.
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17068600
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
 

Author Comment

by:teald4347
ID: 17069769
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
 
LVL 48

Expert Comment

by:AlexFM
ID: 17070754
Accordint to the name Form1.h this is managed application. Please post some code fragment from Form1.h.
0
 

Author Comment

by:teald4347
ID: 17078098
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question