Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error C2146: syntax error 1

Status
Not open for further replies.

Moxx

Technical User
Aug 20, 2001
16
US
error C2146: syntax error : missing ')' before identifier 'WinExec'

I'm trying to launch some programs from a app i'm creating, but Visual C++ keeps giving me that error message. What is the identifier that is supossed to go with the WinExec. My code is listed below.
My OS is XP if that matters.







// TODO: Add your control notification handler code here

///////////////////////////
//MY CODE STARTS HERE
///////////////////////////

// Get the current values from the screen
UpdateData(TRUE);

// Declare a local variable for holding the program name
CString strPgmName;

// Copy the program name to the local variable
strPgmName = m_strProgToRun;

// Make the program name all uppercase
strPgmName.MakeUpper();

// Did the user select to run the Paint program?
if (strPgmName == "PAINT"
// yes, Run the Paint program
WinExec("pbrush.exe", SW_SHOW);

// Did the user select to run the Notepad program?
if (strPgmName == "NOTEPAD"
// yes, run the Notepad program
WinExec("notepad.exe",SW_SHOW);

// Did the user select to run the Solitaire program?
if (strPgmName == "SOLITAIRE"
// yes, run the Solitaire program
WinExec("sol.exe",SW_SHOW);


////////////////////////////////
//MY CODE ENDS HERE
///////////////////////////////

}


 
You have to complete the if-statements with a closing ')' :

Change this
if (strPgmName == "NOTEPAD"

to this :
if (strPgmName == "NOTEPAD")
Do it all 3 places

/JOlesen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top