Author Topic: NewWindowLibrary  (Read 3505 times)

0 Members and 2 Guests are viewing this topic.

Peter

  • Guest
NewWindowLibrary
« on: December 10, 2011, 01:44:38 PM »
Deleted
« Last Edit: April 11, 2015, 10:15:41 AM by Peter »

Charles Pegge

  • Guest
Re: NewWindowLibrary
« Reply #1 on: December 10, 2011, 11:20:26 PM »

Thank you Peter,

I have put in bit masks for GetAsyncKeyState: 0x8001 as per MSDN spec.

There are quite a few changes. Is it safe to resynchronise all the examples to this new library?

Charles

Charles Pegge

  • Guest
Re: NewWindowLibrary
« Reply #2 on: December 11, 2011, 10:14:50 AM »
Hi Peter in one program, I forget which, higher bits were set causing a false keypress.
Setting the return type of GetAsyncKeyState to short instead of integer may help

efgee

  • Guest
Re: NewWindowLibrary
« Reply #3 on: December 11, 2011, 03:30:17 PM »
...WINXP hasn't  64 Bit, is too old therefor. ...     :D

Sorry, but this is not true: Microsoft released Windows XP in 64 bit.

Here more information:
http://en.wikipedia.org/wiki/Windows_XP_Professional_x64_Edition

bye

efgee

  • Guest
Re: NewWindowLibrary
« Reply #4 on: December 11, 2011, 03:48:26 PM »
According to Microsoft GetAsyncKeyState returns SHORT.

Code: [Select]
SHORT WINAPI GetAsyncKeyState(
  __in  int vKey
);

Everything else is wrong!


Charles Pegge

  • Guest
Re: NewWindowLibrary
« Reply #5 on: December 11, 2011, 09:30:43 PM »
Yes, I ran a number of tests and found various high bits were set in 64 bit mode (Vista 64bit).

If you change the return type for GetAsyncKeyState to short, the compiler will sign-extend the 16 bits to 64 bits as it should, and the high bits will be overwritten.

Then there is no need to apply a bitmask. (Still needed if using MinWin)

I checked this with 'FileTest' and without this modification the program locks into a loop

Charles



PS: This does not apply to your libraries  Peter but I had to make an adjustment for functions returning shorts or bytes, treated as booleans thus:


while GetAsyncKeyState(27)
wend

while not GetAsyncKeyState(27)
wend


On my latest update now, this mode of expression will work correctly for 64 bit binaries.

« Last Edit: December 11, 2011, 11:25:36 PM by Charles Pegge »

Charles Pegge

  • Guest
Re: NewWindowLibrary
« Reply #6 on: December 12, 2011, 07:55:02 AM »
Hi Peter,

Discussing problem areas like this is beneficial from my point of view, as they often indicate where Oxygen needs further attention.

efgee

  • Guest
Re: NewWindowLibrary
« Reply #7 on: December 12, 2011, 12:07:27 PM »
I do not know why we discuss about key usage, only we both got it. On the other side, no interest here!
The people expect OxygenBasic as divine ability, that makes their programs.

Peter,
Oxygen is young, so the objective must be to build a set of include files that work in conjunction with the OS-API.
(according to our best knowledge...)

Doing otherwise is just foolish and short sighted.

There is no reason to get mad about it...

Stay cool  8)