Getting A Window's HWND as a Byte Ptr
BlitzMax Forums/BlitzMax Programming/Getting A Window's HWND as a Byte Ptr
| ||
Query apppears to return an Integer, and I'm trying to pass the Window to another library, which requires the HWND to be a Byte Ptr. Clearly a pointer to the integer returned by Query isn't going to cut it, so is there any way to achieve this? |
| ||
I would say not without using another external library that spits back the Integer hWnd as a Byte Ptr. I dont see why CreateWindowExA returns hWnd as an Int, It would be more logical to return something more useful such as hWnd in the Byte Ptr form. Authough, if you're desperate, you could just modify the Win32 module to do as you wish? |
| ||
greetings Gabriel. been a while :) hope all is well. im assuming this is for 3Impact? Int casts to Byte Ptr for the purposes of HWND. plug this into the appropriate locations. just tried this in the AlphaTexture demo and it ran fine. Import BRL.Win32MaxGUI Local window:TGadget=CreateWindow("test",100,100,640,480,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_HIDDEN) i3ImpactOpen(Byte Ptr(Query(window,TGadget.BBQID_WIN32HWND))) you can also try to put it in a panel if you want, similar to what im trying to do with the Irrlicht win32 example. while the Irrlicht example works, i have not been successful with 3Impact, getting the error DirectInput Initialization Failed (8). i think 3Impact is trying to overtake the input and its having issues. here is the code i was trying. Local window:TGadget=CreateWindow("test",100,100,800,600,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS | WINDOW_HIDDEN) Local panel:TGadget=CreatePanel(50,80,640,480,window,PANEL_ACTIVE|PANEL_BORDER) i3ImpactOpen(Byte Ptr(Query(panel,TGadget.BBQID_WIN32HWND))) HTH |
| ||
Ahh so he was referring to 3impact then, could have been more specific I guess. |
| ||
@Leiden - not sure, was just an assumption on my part... but i decided to go ahead since the Byte Ptr to Int 3Impact example would apply across the board. |
| ||
Hi GMan, thanks for that. Yep, it's for 3Impact. I didn't realize I could just recast an integer to a Byte Ptr, but it works perfectly. I was just about to begin work on a level editor in B3d, when I realized that I could probably get 3Impact and MaxGUI to cooperate well enough to have DX8 pixel shader graphics and native Win32 GUI in the same Window with BMax. And sure enough, I can. Thanks again. |
| ||
@Gabriel - were you able to get it to work passing a child control instead of the main form HWND? |
| ||
Sorry, I didn't try originally. I've played around with it, and no, I can't get it to accept a child control. As you say, 3Impact takes over input, like how pressing escape closes the Window by default. I guess that would be problem if it was attached to a child control instead of the window. I haven't tried a canvas yet ( still can't figure out what mods the canvas wants imported, apparently MaxGUI and Max2d is not enough ) but I suspect the result would be the same. |