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. I tried hacking the function to return the value 1 and this gave me the result I had hoped where it did not call up a graphical window but at a later point I get the error:
wine: Unhandled exception (thread 000d), starting debugger...
Any ideas on what GetConsoleWindow() should actually return?
Cheers,
Mark
Any ideas on what GetConsoleWindow() should actually return?
it should return the handle of the window (user32) where the console actually runs (it is attached to a console). Anyway, are you sure the segfault you see is related to returning a non NULL value in GetConsoleWindow compared to another bug in Wine (because you are running on another codepath - the first one being the graphical display). Where does you program actually crash ? A+
"Ewert, Mark" mark.ewert@intel.com wrote in message news:C6F5CF431189FA4CBAEC9E7DD5441E0104A23E5A@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