?
Solved

Invoke shellexecute API call from a windows form .h file

Posted on 2005-03-10
2
Medium Priority
?
466 Views
Last Modified: 2008-01-09
When I start a standard form app and type the line #include <shellapi.h> at the top of my form1.h, it sets off >100 errors! A lot of them are redefinition errors. If I don't include the include line, I get a function not defined error.
0
Comment
Question by:jamesxi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 352 total points
ID: 13514620
I have managed C++ application whixch works with SHFileOperation function. h-file begins with:

#pragma once

#include <windows.h>
#include <shellapi.h>

namespace ShellTest
{
   ...

BTW, you don't need ShellExecute in managed C++ application. Use Process.Start(StartupInfo*) function with ProcessStartInfo.UseShellExecute = true.
0
 

Author Comment

by:jamesxi
ID: 13515965
I tried adding in the <windows.h> line that you have and it worked the first time! Apparently some or all of the Windows API includes require the windows.h header to be included as well. Also, thanks for the additional info on the process object... C++ is so monsterous with all its libraries these days!
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

771 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