Reinvent the wheel: Center window and add Icon.

BlitzMax Forums/BlitzMax Programming/Reinvent the wheel: Center window and add Icon.

I hate to ask this question each time a new bmx version is released.
Then don't. ;op

It'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.