开发者

What is wrong with my header setup

开发者 https://www.devze.com 2023-04-10 03:22 出处:网络
What is wrong with my setup with DWORD and LPCTSTR? class myApp : public CApplication { public: unsigned int DWORD;

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号