Help with GetConsoleWindow()

Jason pcunite at fsmail.net
Sat Sep 18 08:18:26 CDT 2004


"Ewert, Mark" <mark.ewert at intel.com> wrote in message 
news:C6F5CF431189FA4CBAEC9E7DD5441E0104A23E5A at orsmsx402.amr.corp.intel.com...
I'm running an application that calls the stubbed out function 
GetConsoleWindow(). I want the application to stay in the dos console when 
it runs but unfortunately when it sees a NULL from GetConsoleWindow() it 
loads a graphical window.
Any ideas on what GetConsoleWindow() should actually return?

If you only want to run in a console then do not use a main(void)
entry like:
int main(int argc, char *argv[])

Change it to the following example app.
Note that if using MSVC remove the
"subsystem :console" from the linker
options.


#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR     lpCmdLine,
int       nCmdShow)
{
    /* new console for this process */
    AllocConsole();

 /* Get handle to standard out */
 HANDLE hwnd = GetStdHandle(STD_OUTPUT_HANDLE);

 unsigned long ulWritten;

 for (int i = 0; i < 5; i++)
 {
  /* writes a character string to a console screen buffer */
  WriteConsole(hwnd,"Hello World\n",12,&ulWritten,NULL);

  Sleep(1000);
 }

    return 0;
}

GetConsoleWindow is only implemented on newer versions of windows.

Jason
http://goffconcepts.com







More information about the wine-devel mailing list