Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 405 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Tasten auslesen per Windows API #458200
02/25/16 11:28
02/25/16 11:28
Joined: Sep 2005
Posts: 352
Germany
preacherX Offline OP
Senior Member
preacherX  Offline OP
Senior Member

Joined: Sep 2005
Posts: 352
Germany
Weiß jemand, wie ich mit der Windows API Tasten auslesen kann?
Ich möchte nämlich zuverlässig wissen, ob die Taste "Z" gedrückt wurde, egal um welches Länderlayout es sich handelt (Z/Y Verwechslungsfehler)... Danke schonmal im voraus!

Re: Tasten auslesen per Windows API [Re: preacherX] #458327
03/04/16 17:38
03/04/16 17:38
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Code:
#include <windows.h>

LRESULT CALLBACK AcknexMsgLoop(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK typewriter_msgLoop(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

LRESULT CALLBACK typewriter_msgLoop(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	char c = (char)wParam;
	
	if (message == WM_CHAR)
	{
		if ((c > 31) && (c < 127)) 	
		{
			
			//do something useful
		}

		//backspace handling
		else if (c == 8)
		{
			//do something backspacy
		}
		//del handling
		else if (c == 127)
		{
			//delete something
		}

	}
	//engine message loop
	return AcknexMsgLoop(hwnd, message, wParam, lParam);       
}

void typewriter_startup()
{
	AcknexMsgLoop = on_message;
	on_message = typewriter_msgLoop;
}



A quick and dirty example. The numbers represent ASCII. (https://www.uni-due.de/hummell/infos/ascii/)

I have doubts whether this fixes the key mapping, though.

Re: Tasten auslesen per Windows API [Re: FBL] #458363
03/06/16 22:23
03/06/16 22:23
Joined: Sep 2005
Posts: 352
Germany
preacherX Offline OP
Senior Member
preacherX  Offline OP
Senior Member

Joined: Sep 2005
Posts: 352
Germany
Thanks for the info!


Moderated by  TWO 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1