Solved

New to VS C++ and need help with ShellExecute

Posted on 2006-07-08
5
956 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now