看看你的region句柄,在负值是是否有效,还有在SetWindowRgn后句柄不能删除,系统会自动删除,看看下面的代码,我这里可以显示//create a round rect region for the main window hRegionMainWindow = CreateRectRgn(0,0,iMainWidth,iMainHeight); hWnd = CreateWindow(szAppWindowClass,"KerSoft Virtual Mouse 1.0",WS_POPUP, 0,0,iMainWidth,iMainHeight,NULL,NULL,hInstance,NULL); //set the main window 's region SetWindowRgn(hwndMain,hRegionMainWindow,TRUE); int iScreenWidth=GetSystemMetrics(SM_CXSCREEN); int iScreenHeight=GetSystemMetrics(SM_CYSCREEN); SetWindowPos(hWnd,HWND_TOPMOST,iScreenWidth-iMainWidth-60,iScreenHeight-iMainHeight-60,0,0,SWP_NOSIZE); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd);
看看你的region句柄,在负值是是否有效,还有在SetWindowRgn后句柄不能删除,系统会自动删除,看看下面的代码,我这里可以显示//create a round rect region for the main window hRegionMainWindow = CreateRectRgn(0,0,iMainWidth,iMainHeight); hWnd = CreateWindow(szAppWindowClass,"KerSoft Virtual Mouse 1.0",WS_POPUP, 0,0,iMainWidth,iMainHeight,NULL,NULL,hInstance,NULL); //set the main window 's region SetWindowRgn(hwndMain,hRegionMainWindow,TRUE); int iScreenWidth=GetSystemMetrics(SM_CXSCREEN); int iScreenHeight=GetSystemMetrics(SM_CYSCREEN); SetWindowPos(hWnd,HWND_TOPMOST,iScreenWidth-iMainWidth-60,iScreenHeight-iMainHeight-60,0,0,SWP_NOSIZE); ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd);
hRegionMainWindow = CreateRectRgn(0,0,iMainWidth,iMainHeight); hWnd = CreateWindow(szAppWindowClass,"KerSoft Virtual Mouse 1.0",WS_POPUP,
0,0,iMainWidth,iMainHeight,NULL,NULL,hInstance,NULL); //set the main window 's region
SetWindowRgn(hwndMain,hRegionMainWindow,TRUE); int iScreenWidth=GetSystemMetrics(SM_CXSCREEN);
int iScreenHeight=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(hWnd,HWND_TOPMOST,iScreenWidth-iMainWidth-60,iScreenHeight-iMainHeight-60,0,0,SWP_NOSIZE); ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
hRegionMainWindow = CreateRectRgn(0,0,iMainWidth,iMainHeight); hWnd = CreateWindow(szAppWindowClass,"KerSoft Virtual Mouse 1.0",WS_POPUP,
0,0,iMainWidth,iMainHeight,NULL,NULL,hInstance,NULL); //set the main window 's region
SetWindowRgn(hwndMain,hRegionMainWindow,TRUE); int iScreenWidth=GetSystemMetrics(SM_CXSCREEN);
int iScreenHeight=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(hWnd,HWND_TOPMOST,iScreenWidth-iMainWidth-60,iScreenHeight-iMainHeight-60,0,0,SWP_NOSIZE); ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);