Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Windowed IDDraw7 App still receives keyboard input while not focused/forground


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 MajinMLF   Members   -  Reputation: 129

Like
0Likes
Like

Posted 21 November 2011 - 10:40 AM

I hooked an old game to enable windowed mode which uses DirectDrawCreateEx (by basically hooking CreateWindowExA, the game itself has already code for windowed mode i hooked too, so its enabled) - this works - however for some reason it still receives input while not focused.
I hooked into the container windows wndproc function and even made sure that no keypresses are dispatched whatsover when the app is not in forground - it didnt help.

My theory is, that through DirectInput the keyboard will still be queried through non WIn32 msg calls - however i debugged this and

IDDraw7::SetCooperativeLevel

is not using BACKGROUND or EXCLUSIVE bits - its just using DDSCL_NORMAL

Its not receiving mouse input only keyboard tho (maybe its a software mouse and only the keyboard is directinput, no idea). - Also weird is that while the game has focus - i can see the window desktop mouse moving - even when using SetCursor null - i worked around this issue and set the cursor rectangle to be at windowed game size - at least its hidden behind the window now - still not optimal.


Additionally, i tried to hook the DirectDrawCreateEx call - that works, but for some reason i cant use the object myself


HRESULT WINAPI Hook_DirectDrawCreateEx(GUID FAR * lpGuid, LPVOID  *lplpDD, REFIID  iid, IUnknown FAR *pUnkOuter) {
	debug_print("Hook_DirectDrawCreateEx\n");

	HRESULT res = Real_DirectDrawCreateEx(lpGuid,lplpDD,iid,pUnkOuter);


	//LPDIRECTDRAW7  testlplpDD;
	//testlplpDD = (LPDIRECTDRAW7)lplpDD;

	// Crash
	//testlplpDD->SetCooperativeLevel( 0, DDSCL_NORMAL );

	return res;
}


when i try to use any function it crashes here with an access violation - however just proxxying this works fine!

Any hints?

Thanks!





EDIT: Alright - i was confused about the IDDraw7::SetCooperativeLevel - thats actually for the display - the game uses IDirectInputDevice7::SetCooperativeLevel(DISCL_BACKGROUND) which is the issue why its receiving input while not focused - switching to FORGROUND fixes that




Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS