0

I am trying to hide a console window of WinCE using WEC 7 (Windows Embedded Compact 7).

From my desktop windows, I've confirmed that this can be done using the following code:

HWND hWnd = FindWindow(L"ConsoleWindowClass",NULL);
ShowWindow(hWnd, SW_HIDE);

However, FindWindow returns a null pointer if I use this code on WinCE.

Probably, the class name of the console window of WinCE is different from the desktop windows.

Is there any way to get the hWnd of the console window?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
  • I've also trived 'GetConsoleWindow()' function to get the hWnd of the console window, but it didn't work. WinCE doesn't support 'GetConsoleWindow()' – Rokkyu Lee Aug 10 '15 at 02:56
  • Additionally, I've also found that 'GetForegroundWindow()' can be used to find the opened console application. However, the returned HWND might not the HWND of the console window for some cases. – Rokkyu Lee Aug 10 '15 at 06:27

2 Answers2

0

Use EnumWindows API to find your window HWND, example:

BOOL CALLBACK FindWindowByEnumProc(HWND hwnd, LPARAM lParam) {
    if ( IsConsole(hwnd) ) {
        // use hwnd.
        return FALSE;
    }
    return TRUE;
}
::EnumWindows(FindWindowByEnumProc, NULL);

inside IsConsole add your logic to decide if that is a console or not. You might get window text using GetWindowText or check its class using GetClassName. You can also query for process exe file path using GetWindowThreadProcessId and GetModuleFileName.

marcinj
  • 48,511
  • 9
  • 79
  • 100
0

You can discover all information you need by "Windows CE Remote Spy" from Visual Studio 2008 Remote Tools. In my case (Windows CE 6), console window have "ConDev_AppCls" class name.

JustAnotherCoder
  • 621
  • 7
  • 13