c++.windows.32-bits - Removing dos window for win32 applications
- Manuel Sandoval (81/81) Dec 18 2003 Hi:
- KTC (10/15) Dec 18 2003 user32+kernel32+gdi32+comdlg32.lib
- Manuel Sandoval (1/18) Dec 21 2003
Hi: How Should I compile a win32 application, so I do not get an ugly dos window behind my win32 program? Currently I use: c:\dmc\bin\dmc.exe File.cpp /o /WA /L/ user32+kernel32+gdi32+comdlg32.lib where File.cpp contains the winmain function. I used compiler version 8.35.10 Thanks! PD: If you want a sample to compile try this simple code: ///////////////BEGIN FILE.CPP #include <windows.h> /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; /* This function is called by the Windows function DispatchMessage( ) */ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage(0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof(WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor(NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use light-gray as the background of the window */ wincl.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); /* Register the window class, if fail quit the program */ if(!RegisterClassEx(&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow(hwnd, nFunsterStil); /* Run the message loop. It will run until GetMessage( ) returns 0 */ while(GetMessage(&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage( ) gave */ return messages.wParam; } //////////////END
Dec 18 2003
"Manuel Sandoval" wrote ...Hi: How Should I compile a win32 application, so I do not get an ugly doswindowbehind my win32 program? Currently I use: c:\dmc\bin\dmc.exe File.cpp /o /WA /L/user32+kernel32+gdi32+comdlg32.libTry the following command: C:\dmc\bin\dmc.exe File.cpp /o /WA /L/EXETYPE:NT /L/SUBSYSTEM:WINDOWS user32+kernel32+gdi32+comdlg32.lib KTC -- Experience is a good school but the fees are high. - Heinrich Heine
Dec 18 2003
In article <brtpsc$2ffb$1 digitaldaemon.com>, KTC says..."Manuel Sandoval" wrote ...Hi: How Should I compile a win32 application, so I do not get an ugly doswindowbehind my win32 program? Currently I use: c:\dmc\bin\dmc.exe File.cpp /o /WA /L/user32+kernel32+gdi32+comdlg32.libTry the following command: C:\dmc\bin\dmc.exe File.cpp /o /WA /L/EXETYPE:NT /L/SUBSYSTEM:WINDOWS user32+kernel32+gdi32+comdlg32.lib KTC -- Experience is a good school but the fees are high. - Heinrich Heine
Dec 21 2003