I've been working my way round the forum and the MSDN website yesterday trying to sort this out and am still confused. I know this is a simple problem, but if anyone could provide add the minimum code necessary to the following program outline, that would be so helpful and instructive.
What I want to be able to do is to get the key pressed on the keyboard (all of them, not just the letters!), along with information on whether the <SHIFT>, <CONTROL>, <ALT> or <ALTGR> keys were pressed at the same time. In PBCC, the latter information was provided by the INSHIFT function, but missing in PBWin.
I've looked at the various TranslateMessage and ToASCIIEx functions described on the MSDN website, but really can't see whether, how and/or where to insert these into the simple callback code above.
Can the above callback loop be simply modified to get the keyboard codes easily?
Peter
Code:
#COMPILER PBWIN 9 #COMPILE EXE #INCLUDE "Win32API.inc" DEFLNG a-z GLOBAL main_handle AS LONG FUNCTION PBMAIN () AS LONG DIALOG NEW 0, a$, , , 400, 200,_ %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_CLIPCHILDREN, 0 TO main_handle DIALOG SHOW MODAL main_handle, CALL GS_DlgProc() TO a END FUNCTION CALLBACK FUNCTION GS_DlgProc() SELECT CASE CB.MSG CASE %WM_INITDIALOG CASE %WM_KEYDOWN MSGBOX "Key pressed" CASE %WM_SYSKEYDOWN MSGBOX "<ALT> Key pressed" END SELECT END FUNCTION
I've looked at the various TranslateMessage and ToASCIIEx functions described on the MSDN website, but really can't see whether, how and/or where to insert these into the simple callback code above.
Can the above callback loop be simply modified to get the keyboard codes easily?
Peter
Comment