After Ctl+Alt+Delete is pressed, continous Alt key is sent

Windows specific questions.
lassar
Posts: 298
Joined: Jan 17, 2006 1:35
Contact:

After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby lassar » Aug 12, 2018 23:45

Did Ctrl+Alt+Delete, to get to task manager, to check memory use.

Been using multikey to detect Alt key press.

Either Windows 10 has a bug after pressing Ctrl+Alt+Delete, or there is
a problem with multikey.

I tried several other alt key combinations, and can't get any continuous
alt key presses.

It only does it on Ctrl+Alt+Delete.

The work around is to press the same Alt key you used in Ctrl+Alt+Delete.

Here's the test code.

After the program is running, press Ctrl+Alt+Delete, then bring the test
window back up.

Let me know what results you get.


Code: Select all


#LANG "fblite"

ScreenRes 640, 480, 8
Do
    Dummy% = GetMouse (x%, y%, , Button%)
    ControlKey% = MultiKey(&h38)
    PRINT "ControlKey% = ";ControlKey%
Loop UNTIL Button% > 0
SLEEP 7000
End

fxm
Posts: 8351
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby fxm » Aug 13, 2018 4:59

Same behavior with Win10.
badidea
Posts: 975
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby badidea » Aug 13, 2018 17:07

Can't reproduce on linux. Whats happens on e.g. ALT+TAB?
fxm
Posts: 8351
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby fxm » Aug 13, 2018 17:44

badidea wrote:Whats happens on e.g. ALT+TAB?
No problem.
grindstone
Posts: 556
Joined: May 05, 2015 5:35
Location: Germany

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby grindstone » Aug 13, 2018 23:24

No problems here with WinXP and "Process hacker" (instead of task manager) installed.
coderJeff
Site Admin
Posts: 2693
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby coderJeff » Aug 14, 2018 21:20

Same behaviour with win7. On windows, MULTIKEY is really just a call to short GetAsyncKeyState(int vkey). There's no magic; it's as close to the WIN API as you can get. It appears that ALT key gets "stuck", if ctrl+alt+delete is followed by Task Manager, or Lock This Computer. And not a problem if ctrl+alt+delete, followed by Cancel or Switch User. I don't think there will be any fix for this behaviour.
Pierre Bellisle
Posts: 30
Joined: Dec 11, 2016 17:22

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby Pierre Bellisle » Aug 17, 2018 5:46

On my Seven machine,
if the MultiKey console window have focus,
the LeftMenu(Alt) pushed key down is detected,
the going up key release is not always detected,
probably because it occur while the ctrl-alt-del screen is active and it's a barrier to MultiKey.

If the focus is on another window,
the LeftMenu(Alt) key up seems to be always detected on my pc.
Using GetAsyncKeyState(VK_MENU) always return a good status.

Code: Select all

#Include Once "Windows.bi"
#LANG "fblite"
ScreenRes 640, 480, 8
Do
    Dummy%      = GetMouse (x%, y%, , Button%)
    'SLEEP 2
    ControlKey& = MultiKey(&h38) 'LeftMenu(Alt) 56dec 0x38: 20380001-LeftMenuDown, C0380001-LeftMenuUp
    PRINT "ControlKey& = "; ControlKey&, " GetAsyncKeyState"; GetAsyncKeyState(VK_MENU)
Loop UNTIL Button% > 0
SLEEP 2000
End
coderJeff
Site Admin
Posts: 2693
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby coderJeff » Aug 17, 2018 8:55

Thanks, Pierre. I missed seeing the real problem and your tests helped me realize that.

There are several versions of MULTIKEY.

CONSOLE uses GetAysncKeyState() - OK
FBGFX/GDI uses GetKeyboardState() - OK

FBGFX/DirectX uses IDirectInputDevice_GetDeviceState() - Not OK

I think problem appears to be only with FBGFX/DirectX version.
Which might be used if running fbc-32bit on win-64bit.
fxm
Posts: 8351
Joined: Apr 22, 2009 12:46
Location: Paris (suburb), FRANCE

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby fxm » Aug 17, 2018 9:09

BTW:
For Windows, why not set GDI by default for fbc-32bit because it's the only one available for fbc-64bit?
St_W
Posts: 1379
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby St_W » Aug 18, 2018 11:21

Probably because GDI is usually considerably slower than DirectX/OpenGL. I don't know however, how that influences the speed of FB's gfxlib2. Did anyone do some benchmarks of the different rendering backends?
coderJeff
Site Admin
Posts: 2693
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby coderJeff » Aug 23, 2018 1:03

Currently, for our gfxlib2, looks like
fbc-32 on win32 - DirectX - OK
fbc-32 on win64 - DirectX - breaking
fbc-64 on win64 - DirectX - broken, I think. See here

Maybe a run-time check? Is there a win32 api call that can determine if the host windows is 32 or 64bit?
GDI should be the default always in 64bit until we have an alternative I think.
jj2007
Posts: 852
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby jj2007 » Aug 23, 2018 3:03

coderJeff wrote:Is there a win32 api call that can determine if the host windows is 32 or 64bit?

- is any 64-bit process is running, e.g. C:\Windows\SysWOW64\cmd.exe?
- folder C:\Windows\SysWOW64 exists?
- environment variable %PROCESSOR_ARCHITEW6432% is AMD64?
- environment variable %ProgramFiles(x86)% is set?

Somewhat simpler:

Code: Select all

#include "Windows.bi"
function Os64() as ulong
  Dim as integer hKernel=LoadLibrary("Kernel32")
  Dim as integer Is64=GetProcAddress(hKernel, "IsWow64Process")
  FreeLibrary(hKernel)
  return Is64
end function

if Os64() then
   print "it's a 64-bit OS"
else
   print "it's a 32-bit OS"
endif
sleep()
paul doe
Posts: 777
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby paul doe » Aug 23, 2018 3:32

jj2007 wrote:Somewhat simpler:

Nice! A very small correction if I may, to avoid a myriad of warnings:

FbTemp.bas(3) warning 5(0): Implicit conversion
FbTemp.bas(4) warning 1(1): Passing scalar as pointer, at parameter 1 of GETPROCADDRESS()
FbTemp.bas(4) warning 5(0): Implicit conversion
FbTemp.bas(5) warning 1(1): Passing scalar as pointer, at parameter 1 of FREELIBRARY()

Code: Select all

function Os64() as boolean
  var hKernel = LoadLibrary( "Kernel32" )
  var Is64 = GetProcAddress( hKernel, "IsWow64Process" )
  FreeLibrary( hKernel )
 
  return( cbool( Is64 <> cptr( any ptr, 0 ) ) )
end function
jj2007
Posts: 852
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby jj2007 » Aug 23, 2018 3:59

paul doe wrote:Nice!
Thanks, Paul. Unfortunately, I just found out that it won't work, see Detect if your Windows version is 32- or 64-bit for the reasons and alternatives. Umpffff....
Josep Roca
Posts: 389
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: After Ctl+Alt+Delete is pressed, continous Alt key is sent

Postby Josep Roca » Aug 23, 2018 4:10

In Windows, WMI is a great technology to retrieve all kind of hardware information. Using the CWmiServices class of my WinFBX framework, it has been a piece of cake to write a function to retrieve the OS bitness.

Code: Select all

' ========================================================================================
' Returns the address width of the operating system.
' On a 32-bit operating system, the value is 32 and on a 64-bit operating system it is 64.
' ========================================================================================
PRIVATE FUNCTION AfxGetWindowsBitness (BYREF wszServerName AS WSTRING = ".") AS LONG
   DIM pServices AS CWmiServices = $"winmgmts:{impersonationLevel=impersonate}!\\" & wszServerName & $"\root\cimv2"
   IF pServices.ServicesPtr = NULL THEN RETURN 0
   pServices.ExecQuery("SELECT AddressWidth FROM Win32_Processor")
   pServices.GetNamedProperties
   RETURN pServices.PropValue("AddressWidth").ValLong
END FUNCTION
' ========================================================================================

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 0 guests