What is wrong with my setup with DWORD and LPCTSTR?
class myApp : public CApplication
{
public:
unsigned int DWORD;
const char *LPCTSTR;
开发者_如何学JAVA myApp( CApplication::ApplicationByteAware theAppByte = CApplication::AB_SINGLEBYTE );
virtual ~myApp( void );
DWORD IsProcessRunning(LPCTSTR procname);
bool TerminateProcess(LPCTSTR procname);
}
You've declared DWORD as a variable name (member name) and then tried to specify it as a return type for IsProcessRunning. The latter should return unsigned int instead. Use a typedef if you want to alias a type name.
You're declaring DWORD
and LPCTSTR
as member variables but trying to use them as types. What you want to do instead is
// declare the typedefs here
typedef unsigned int DWORD;
typedef const char *LPCTSTR;
class myApp : public CApplication
{
public:
myApp( CApplication::ApplicationByteAware theAppByte = CApplication::AB_SINGLEBYTE );
virtual ~myApp( void );
// then you can use them here
DWORD IsProcessRunning(LPCTSTR procname);
bool TerminateProcess(LPCTSTR procname);
};
Usually a Windows program will include <windows.h>
which in turn includes other files which define these widely used macros.
精彩评论