怎么找不到这个窗口(FINDWINDOW)
蒙飞鸿 2010-06-17 11:30:06 一个窗口这么注册并显示了:
static TCHAR szAppName[] = TEXT ("Start File Process") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox ( NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow( szAppName, // window class name
szAppName, // window caption
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
250, // initial x size
100, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
///////////////////////////////////////////////////////////////////////////////////////////////
但是,用HWND hWndDll = FindWindow(TEXT ("Start File Process"),NULL);
char tembuf[20];
DWORD dwHWndErr = GetLastError();
sprintf(tembuf,"%d",dwHWndErr);
if(hWndDll == 0)MessageBox(NULL,tembuf,"FindWindowError:",MB_OK)
;查找窗口却找不到,LASTERROR返回2,怎么意思?