求解下面的程序,怎么强制转换??
/*
*Author:lichao
*Date:01-14-2012
*Description:Shutdown the computer remotely by mobile phone
*/
#include<windows.h>
#include<stdio.h>
#define TITLE_LENGTH 256
#define EXIT_SUCCESS 0
#pragma comment(linker,"/subsystem:"windows" /entry:"mainCRTStartup"")
BOOL CALLBACK lpMyEnumFunc(HWND hwnd, LPARAM lParam)
{
TCHAR szTitle[TITLE_LENGTH];
GetWindowTextW(hwnd,szTitle,TITLE_LENGTH);
if( 0==wcscmp(szTitle,TEXT("RemotingShutDownWorker")))
{
BOOL *pDetected=(BOOL *)lParam;
*pDetected=true;
return 0;
}
return 1;
}
int main()
{
BOOL bDetected=false;
BOOL *pDetected=&bDetected;
while(!bDetected)
{
EnumWindows(lpMyEnumFunc,(LPARAM)pDetected);
Sleep(5000);
}
//::MessageBoxW(NULL,TEXT("将要关机"),TEXT("远程关机"),MB_OK);
system("shutdown -s -t 20");
return EXIT_SUCCESS;
}
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
D:\C++\测试\控制台\QQ远程关机\Cpp1.cpp(27) : error C2664: 'GetWindowTextW' : cannot convert parameter 2 from 'char [256]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\C++\测试\控制台\QQ远程关机\Cpp1.cpp(29) : error C2664: 'wcscmp' : cannot convert parameter 1 from 'char [256]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
执行 cl.exe 时出错.