Solved

ShellExecute in VC++ 5

Posted on 1998-12-15
5
560 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
[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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

751 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