win32编程隐藏窗口

else if ( wParam == ID_LOGIN ) {
               GetDlgItemText ( hWnd , IDC_USER , szuserbuf , sizeof ( szuserbuf )/ sizeof ( WCHAR ));
               GetDlgItemText ( hWnd , IDC_PASS , szpassbuf , sizeof ( szpassbuf )/ sizeof ( WCHAR ));
               if ( wcscmp ( szuserbuf , L"123" ) == 0 && wcscmp ( szpassbuf , L"1234" ) ==0 )
              {
                      //SendMessage(hWnd, WM_CLOSE, 0, 0);
                      ShowWindow ( hWnd , SW_HIDE );                                      //隐藏窗口
                      DialogBox ( hInst , MAKEINTRESOURCE ( IDD_REGIST ), hWnd , About );
               //     DialogBox(hInst, MAKEINTRESOURCE(IDD_Show), hWnd, About);
                     
                     
                     
              }


////
[System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint="ShowWindow")]
public static extern  bool ShowWindow(System.IntPtr hWnd, int nCmdShow) ;

public const int SW_SHOW = 5;

public const int SW_HIDE = 0;

显示窗体
ShowWindow(handler,SW_SHOW );

隐藏窗体
ShowWindow(handler,SW_HIDE );

handler是窗体句柄

猜你喜欢

转载自blog.csdn.net/assyiran/article/details/72058956
今日推荐