0

error C2664: 'strcmp' : cannot convert parameter 1 from 'WCHAR [260]' to 'const char *'

HANDLE pSnapList;
        PROCESSENTRY32 p32Info;
    BOOL     p32Status;

    pSnapList = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );    
    p32Info.dwSize = sizeof( PROCESSENTRY32 );

                p32Status = Process32First( pSnapList, &p32Info );
                while( Process32Next( pSnapList, &p32Info ) )
                {
                        [b][u]if( !strcmp( p32Info.szExeFile, processName.c_str() ) )[/u][/b] 
                   {
                                 processID = p32Info.th32ProcessID;
                         return;

}



                };
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pseudorandom21
1

Microsoft unicode stuff.

http://msdn.microsoft.com/en-us/library/aa272960%28v=vs.60%29.aspx

You will likely opt to use either the "char" type of string, or the "wchar_t" type.
Visual Studio provides a std::wstring.

http://msdn.microsoft.com/en-us/library/wt3s3k55%28v=vs.71%29.aspx

Note that wstring is a basic_string<> templated to wchar_t.

You may also opt to convert the "char" string to "wchar_t".
See MultiByteToWideChar: http://msdn.microsoft.com/en-us/library/dd319072

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.