Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_WINDOWHANDLE
#2
(06-05-2024, 09:57 PM)TerryRitchie Wrote: Just a head's up for everyone. I've just spent an hour cursing at my code until I figured out what was going on.

SCREEN _NEWIMAGE(640, 480, 32)
hWnd&& = _WINDOWHANDLE

The above code will not return the correct window handle.

SCREEN _NEWIMAGE(640, 480, 32)
_DELAY .25
hWnd&& = _WINDOWHANDLE

This code above will. Very frustrating.

I've wrote about this before.   Here's the basic issue:

<QB64 starts, assigns a window handle to that SCREEN 0 startup screen you see.>
SCREEN _NEWIMAGE is called.   Starts to make a new window... asks system for a handle...
hWnd tries to get the current handle.   It gets one.

But what's the only handle available to get??   The one associated with the SCREEN 0 startup screen!

Adding that _DELAY after the call to _NEWIMAGE gives the system time to create and assign a handle to the new screen, so it can return that handle to you, as you intended.  Smile



Edit: Matt's right (see below). We fixed the issue I was thinking of. This really shouldn't be such an issue with the current versions of QB64PE. Any chance you can share some test code which reproduces the issue. And share with us which OS and QB64PE version you're testing with?
Reply


Messages In This Thread
_WINDOWHANDLE - by TerryRitchie - 06-05-2024, 09:57 PM
RE: _WINDOWHANDLE - by SMcNeill - 06-05-2024, 10:11 PM
RE: _WINDOWHANDLE - by DSMan195276 - 06-05-2024, 10:26 PM
RE: _WINDOWHANDLE - by TerryRitchie - 06-05-2024, 11:21 PM
RE: _WINDOWHANDLE - by SMcNeill - 06-05-2024, 11:33 PM
RE: _WINDOWHANDLE - by DSMan195276 - 06-05-2024, 11:41 PM
RE: _WINDOWHANDLE - by TerryRitchie - 06-06-2024, 12:42 AM
RE: _WINDOWHANDLE - by DSMan195276 - 06-06-2024, 01:44 AM
RE: _WINDOWHANDLE - by TerryRitchie - 06-06-2024, 06:04 AM



Users browsing this thread: 1 Guest(s)