Author Topic: Form Always Has Focus Unless Key Combination - Possible?  (Read 6171 times)

0 Members and 1 Guest are viewing this topic.

Offline davidshq

  • Newbie
  • Posts: 55
    • View Profile
Form Always Has Focus Unless Key Combination - Possible?
« on: July 06, 2019, 12:09:23 am »
I'm thinking of a game for toddlers. Thing is toddlers tend to bang on the keyboard a bit and this oftentimes results in unwanted things occurring - for example, they might close out the open program, resize the window, open another program, etc. I'm wondering if there is a simple way to force the form to be the focus and only allow exiting using a keystroke combination (e.g. Ctrl+Alt+E) - this would keep the program present but also allow parents to exit the app when desired. Thoughts?

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Form Always Has Focus Unless Key Combination - Possible?
« Reply #1 on: July 06, 2019, 06:13:22 pm »
HI
IMHO it is not possible in QB64 if you don't use calling to Windows API
see here from the Wiki
FOCUS http://qb64.org/wiki/Windows_Libraries#Focus
Mouse AREA http://qb64.org/wiki/Windows_Libraries#Mouse_Area
SendKeys http://qb64.org/wiki/Windows_Libraries#Send_Keys
Losing Focus http://qb64.org/wiki/Windows_Libraries#Window_Focus

I hope this can be useful for you.

Good Coding
Programming isn't difficult, only it's  consuming time and coffee