初学WINAPI抄了个程序HELLOWIN,我现在编了一个进程遍历的方法,放在HELLOWIN里发现不对,怎么办
TCHAR* findprocess() //新写的方法{
PROCESSENTRY32 pe32;
pe32.dwSize=sizeof(pe32);
int count=0;
HANDLE hProcessSnap=::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
BOOL bMore=::Process32First(hProcessSnap,&pe32);
while (bMore)
{
count++;
if(wcscmp(pe32.szExeFile,TEXT("smss.exe")) == 0)
{
break;
return TEXT("smss.exe");
}
bMore=::Process32Next(hProcessSnap,&pe32);
}
return 0;
}
想把这个方法加到HELLOWIN里边
LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
TCHAR* findproc = this.findprocess();//<<<<<<<<<<<<<<<THIS 这里有错
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch(message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
GetClientRect(hwnd,&rect);
DrawText (hdc,findproc,-1,&rect, //<<<<<<<<<<<<<<<<<<<<<<<<<想把遍历的返回值代入这里发现不得
DT_SINGLELINE|DT_CENTER|DT_VCENTER);
EndPaint(hwnd,&ps);
return 0 ;
怎么办