Ooops
October 19, 2021, 23:05:14

Author Topic: GetAsyncKeyState error porting from Blitzmax to NG  (Read 299 times)

Offline fielder

  • Full Member
  • ***
  • Posts: 110
GetAsyncKeyState error porting from Blitzmax to NG
« on: May 30, 2021, 10:28:42 »
i receive this error:

Code: [Select]
In file included from C:/SequenceF/.bmx/SequenceFinder-clipboard.bmx.gui.release.win32.x86.c:1:
C:/SequenceF/.bmx/SequenceFinder-clipboard.bmx.gui.release.win32.x86.h:14:25: error: conflicting types for 'GetAsyncKeyState'
 extern BBINT __stdcall  GetAsyncKeyState(BBINT bbt_vKey);
                         ^~~~~~~~~~~~~~~~
In file included from C:/BlitzMax/MinGW32x86/i686-w64-mingw32/include/windows.h:72,
                 from C:/BlitzMax/mod/brl.mod/blitz.mod/blitz_thread.h:11,
                 from C:/BlitzMax/mod/brl.mod/blitz.mod/blitz.h:28,
                 from C:/BlitzMax/mod/brl.mod/blitz.mod/.bmx/blitz.bmx.release.win32.x86.h:4,
                 from C:/SequenceF/.bmx/SequenceFinder-clipboard.bmx.gui.release.win32.x86.h:4,
                 from C:/SequenceF/.bmx/SequenceFinder-clipboard.bmx.gui.release.win32.x86.c:1:
C:/BlitzMax/MinGW32x86/i686-w64-mingw32/include/winuser.h:2492:27: note: previous declaration of 'GetAsyncKeyState' was here
   WINUSERAPI SHORT WINAPI GetAsyncKeyState(int vKey);
                           ^~~~~~~~~~~~~~~~

because the Async is already declared on winuser.h ... there is a way to compile this on NG (is the keylogger code taken from here: https://www.syntaxbomb.com/index.php?topic=4082.0 )

Offline Henri

  • Sr. Member
  • ****
  • Posts: 355
Re: GetAsyncKeyState error porting from Blitzmax to NG
« Reply #1 on: May 30, 2021, 13:45:47 »
Hi,

I think the original bug concerning shift keys was fixed as it's not present in my setup.

If you need GetAsyncKeyState Windows API function in NG then declare it like this:
Code: BlitzMax
  1. Extern "Win32"
  2.    Function GetAsyncKeyState:Short(key:Int) = "SHORT GetAsyncKeyState(INT)!"
  3. End Extern
  4.  

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Offline fielder

  • Full Member
  • ***
  • Posts: 110
Re: GetAsyncKeyState error porting from Blitzmax to NG
« Reply #2 on: May 31, 2021, 10:53:53 »
I have this line I'm using the sources linked... and on NG I have a compilation error... on old Blitzmax the example is working

Offline Henri

  • Sr. Member
  • ****
  • Posts: 355
Re: GetAsyncKeyState error porting from Blitzmax to NG
« Reply #3 on: May 31, 2021, 14:55:35 »
Martin's/Derron's code in the link is for old Blitzmax.

If you replace the extern part with what I provided above (there is a difference if you look closely) it should work without error.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Offline fielder

  • Full Member
  • ***
  • Posts: 110
Re: GetAsyncKeyState error porting from Blitzmax to NG
« Reply #4 on: June 04, 2021, 08:58:00 »
OMG thank you!!!

it's working :)

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal