Solved

ShellExecute in VC++ 5

Posted on 1998-12-15
5
556 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Would like to move button in a function 3 83
Exception thrown at 0x00007FFD5BC81F28 7 55
C++ mouse_event mouse look 7 111
FMX TCameraComponent Problem 2 92
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 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