Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error C2065: 'ShellExecute' : undeclared identifier?

724 views
Skip to first unread message

abba

unread,
Jan 7, 2001, 6:31:24 PM1/7/01
to
Can some explain why when I compile the following:

#include "stdafx.h"
#include "windows.h"
#include "string.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
char szCurDir[MAX_PATH];
printf("Hello World!\n");
GetCurrentDirectory( MAX_PATH, szCurDir );
// ShellExecute(0,TEXT("open"), TEXT("test.txt"), NULL,szCurDir, 0);
ShellExecute(0,"open","test.txt",NULL,szCurDir,0);
return 0;
}

I get this error:

C:\cons\cons.cpp(16) : error C2065: 'ShellExecute' : undeclared identifier

Jakob Bieling

unread,
Jan 7, 2001, 11:33:14 AM1/7/01
to
include shlwapi.h

you could have found this out easily yourself by searchig for ShellExecute in the MSDN

bye
jb

<abba> schrieb im Newsbeitrag news:93a28...@news1.newsguy.com...

abba

unread,
Jan 7, 2001, 8:37:45 PM1/7/01
to
It is still doing it!
I also _did_ search the msdn, but aparently the shell api's
reside in the client sdk area, and these help files don't
have the header requirement info that other api's do?
"Jakob Bieling" <net...@gmx.net> wrote in message
news:93a5p5$6tv$02$1...@news.t-online.com...

John A. Grant

unread,
Jan 7, 2001, 5:06:17 PM1/7/01
to
<abba> wrote in message news:93a9l...@news2.newsguy.com...

> "Jakob Bieling" <net...@gmx.net> wrote in message
> news:93a5p5$6tv$02$1...@news.t-online.com...
> > include shlwapi.h

> It is still doing it!

[...]
#include <shellapi.h>

--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here

Jussi Jumppanen

unread,
Jan 8, 2001, 4:11:12 PM1/8/01
to
abba wrote:
>
> Can some explain why when I compile the following:

I removed the stafx include to be left with this:

#include "windows.h"
#include "string.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[])
{
char szCurDir[MAX_PATH];
printf("Hello World!\n");
GetCurrentDirectory( MAX_PATH, szCurDir );
// ShellExecute(0,TEXT("open"), TEXT("test.txt"), NULL,szCurDir, 0);
ShellExecute(0,"open","test.txt",NULL,szCurDir,0);
return 0;
}

and then compiled the file using BCC++ 5.02 and this was the result:

---------------------------------------------------------------------
Zeus for Windows Programmers Editor - Version 3.50
Copyright (c) Xidicone Pty Ltd 1991-2001. All rights reserved.
---------------------------------------------------------------------

Borland C++ 5.0 for Win32 Copyright (c) 1993, 1996 Borland
c:\temp\t.cpp:
Warning c:\temp\t.cpp 14: Parameter 'argc' never used in ....
Warning c:\temp\t.cpp 14: Parameter 'argv' never used in ....

and as you can see it compiled fine.

Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, HTML, Pascal, Cobol, Fortran programmer's text editor"
http://www.zeusedit.com

0 new messages