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是窗體句柄
發佈了46 篇原創文章 · 獲贊 35 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章