load windows icon from Configrc

This commit is contained in:
cxgeorge 2001-02-26 03:40:45 +00:00
parent bcfe441d0e
commit 2b378c3dc4
6 changed files with 24 additions and 5 deletions

View File

@ -16,6 +16,8 @@ ConfigureFn(config_wdxdisplay) {
init_libwdxdisplay(); init_libwdxdisplay();
} }
string IconFileName = config_wdxdisplay.GetString("win32-window-icon","");
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: init_libwdxdisplay // Function: init_libwdxdisplay
// Description: Initializes the library. This must be called at // Description: Initializes the library. This must be called at

View File

@ -11,6 +11,8 @@
NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX); NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
extern string IconFileName;
extern EXPCL_PANDADX void init_libwdxdisplay(); extern EXPCL_PANDADX void init_libwdxdisplay();
#endif /* __CONFIG_WDXDISPLAY_H__ */ #endif /* __CONFIG_WDXDISPLAY_H__ */

View File

@ -1093,17 +1093,23 @@ void wdxGraphicsWindow::config(void) {
// Create a GSG to manage the graphics // Create a GSG to manage the graphics
make_gsg(); make_gsg();
HINSTANCE hinstance = GetModuleHandle(NULL);
WNDCLASS wc; WNDCLASS wc;
HINSTANCE hinstance = GetModuleHandle(NULL);
// Clear before filling in window structure! // Clear before filling in window structure!
ZeroMemory(&wc, sizeof(WNDCLASS)); ZeroMemory(&wc, sizeof(WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW; //CS_OWNDC; wc.style = CS_HREDRAW | CS_VREDRAW; //CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) static_window_proc; wc.lpfnWndProc = (WNDPROC) static_window_proc;
wc.hInstance = hinstance; wc.hInstance = hinstance;
wc.hIcon = LoadIcon(hinstance, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL/*hinstance*/, IDC_CROSS); if(!IconFileName.empty()) {
wc.hIcon = (HICON) LoadImage(NULL, IconFileName.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
} else {
wc.hIcon = NULL; // use default app icon
}
wc.hCursor = LoadCursor(NULL, IDC_CROSS);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = "wdxDisplay"; wc.lpszClassName = "wdxDisplay";

View File

@ -16,6 +16,8 @@ ConfigureFn(config_wgldisplay) {
init_libwgldisplay(); init_libwgldisplay();
} }
string IconFileName = config_wgldisplay.GetString("win32-window-icon","");
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: init_libwgldisplay // Function: init_libwgldisplay
// Description: Initializes the library. This must be called at // Description: Initializes the library. This must be called at

View File

@ -11,6 +11,8 @@
NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL); NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
extern string IconFileName;
extern EXPCL_PANDAGL void init_libwgldisplay(); extern EXPCL_PANDAGL void init_libwgldisplay();
#endif /* __CONFIG_WGLDISPLAY_H__ */ #endif /* __CONFIG_WGLDISPLAY_H__ */

View File

@ -33,12 +33,17 @@ wglGraphicsPipe::wglGraphicsPipe(const PipeSpecifier& spec)
stdwc.style = CS_OWNDC; stdwc.style = CS_OWNDC;
stdwc.lpfnWndProc = (WNDPROC)static_window_proc; stdwc.lpfnWndProc = (WNDPROC)static_window_proc;
stdwc.hInstance = hinstance; stdwc.hInstance = hinstance;
stdwc.hIcon = LoadIcon(hinstance, IDI_WINLOGO); stdwc.hCursor = LoadCursor(NULL, IDC_CROSS);
stdwc.hCursor = LoadCursor(hinstance, IDC_CROSS);
stdwc.hbrBackground = NULL; stdwc.hbrBackground = NULL;
stdwc.lpszMenuName = NULL; stdwc.lpszMenuName = NULL;
stdwc.lpszClassName = "wglStandard"; stdwc.lpszClassName = "wglStandard";
if(!IconFileName.empty()) {
stdwc.hIcon = (HICON) LoadImage(NULL, IconFileName.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
} else {
stdwc.hIcon = NULL; // use default app icon
}
if (!RegisterClass(&stdwc)) { if (!RegisterClass(&stdwc)) {
wgldisplay_cat.fatal() wgldisplay_cat.fatal()
<< "wglGraphicsPipe::construct(): could not register standard window " << "wglGraphicsPipe::construct(): could not register standard window "