Reinvent the wheel: Center window and add Icon.
BlitzMax Forums/BlitzMax Programming/Reinvent the wheel: Center window and add Icon.
| ||
Hello everyone. Sorry to bother you... :/ How can I change the module code for win32 (non gui!) so that: a) the main window is centered on the desktop by default b) the window icon is displayed = object file. Thanks a lot. Grisu P.S.: I hate to ask this question each time a new bmx version is released. Anyone else out there feeling the same? |
| ||
Ditto these would both be a very nice to have in the language by default!? for adding an icon for positioning the window Maybe a sticky FAQ or most frequently searched for view of the forum is needed? |
| ||
I thought someone posted that you could just use incbin to change the .exe icon? |
| ||
I hate to ask this question each time a new bmx version is released. Then don't. ;opIt's *always* the same... In dxgraphics.mod/d3d7graphics.bmx - 'TD3D7Graphics.Create()':- To add the icon, find... wc.hCursor=LoadCursorA( Null,Byte Ptr IDC_ARROW )...and add... wc.hIcon = LoadIconA(GetModuleHandleA(Null), Byte Ptr(101)) ' Add icon (if included as resource '101')...below it (or anywhere within the wc definition block). To centre the window, replace... Local rect[]=[32,32,width+32,height+32]...with... Local rect[4], wx, wy ' Centre window GetWindowRect(GetDesktopWindow(), rect) ' ~"~ wx = (rect[2] - width) / 2 ' ~"~ wy = (rect[3] - height) / 2 ' ~"~ rect = [wx, wy, wx + width, wy + height] ' ~"~ Done! If BRL were going to add this, I'd of thought they would have done it by now. |
| ||
Thanks! Someone please make that a sticky! |
| ||
I thought someone posted that you could just use incbin to change the .exe icon? I use a program somebody wrote (Yan, I think) to convert an icon to a .o file, which I can then use with Import.As for centering the window, be nice if Blitzmax could do this natively/easily, without faffing about. |
| ||
agreed |