各位大虾好!我最近编了一个多文档程序,现在建立一个没有边框并且大小不定的对话框,可我在用SetWindowRgn()函数后出现对话框创建出来,但不能显示的问题??请问那位大虾帮忙指导一下!!谢谢!!

解决方案 »

  1.   

    看看你的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);
      

  2.   

    看看你的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);