Solved

ShellExecute in VC++ 5

Posted on 1998-12-15
5
544 Views
Last Modified: 2006-11-17
I'm  trying to get ShellExecute to work but
I think I misunderstood how it works and
this came up:

: error C2660: 'ShellExecuteA' : function does not take 3 parameters
Error executing cl.exe.

Some working source code would be appreciated

Thanx
0
Comment
Question by:atsui
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
stsanz earned 100 total points
ID: 1180216
The compiler is right : ShellExecute function does not take 3 parameters but 6 parameters :

HINSTANCE ShellExecute (    
  HWND hwnd,    
  LPCTSTR lpOperation,
  LPCTSTR lpFile,    
  LPCTSTR lpParameters,    
  LPCTSTR lpDirectory,
  INT nShowCmd) ;      

Source code example follows.

0
 
LVL 6

Expert Comment

by:stsanz
ID: 1180217
To execute an application (e.g. NOTEPAD), use :
ShellExecute(NULL,"open","notepad.exe","",NULL,SW_SHOW) ;

To print a file (e.g. C:\TEMP\TEST.TXT), use :
ShellExecute(NULL,"print","C:\\TEMP\\TEST.TXT",NULL,NULL,SW_SHOW) ;

0
 
LVL 1

Author Comment

by:atsui
ID: 1180218
Hehe, turns out, I forgot about the escape character "\"
THanks for the source man
0
 

Expert Comment

by:sureshmovva
ID: 1180219
To execute an application (e.g. COMMAND), use :
     ShellExecute(NULL,"open","command.com","",NULL,SW_SHOW) ;

     To print a file (e.g. C:\TEMP\TEST.TXT), use :
     ShellExecute(NULL,"print","C:\\TEMP\\TEST.TXT",NULL,NULL,SW_SHOW);
0
 

Expert Comment

by:sureshmovva
ID: 1180220
ShellExecute function does not take 3 parameters but 6
   parameters :
        To execute an application (e.g. WINFILE), use :
        ShellExecute(NULL,"open","winfile","",NULL,SW_SHOW) ;

        To print a file (e.g. C:\TEMP\TEST.TXT), use :
        ShellExecute(NULL,"print","C:\\TEMP\\TEST.TXT",NULL,NULL,SW_SHOW);
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

707 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

15 Experts available now in Live!

Get 1:1 Help Now