i'm using the following call:
running on a timer, to check for an 'F10' keypress. While my app does not have the focus (is in background somewhere,not minimized)Code:Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
When the key is pressed, I Show the form and setfocus to it, then ask for userinput.
But the inputbox is not ready to receive input, and it still needs a manual click to be able to receive input.
i tried:
and API call:Code:Form1.Show Form1.SetFocus 'DoEvents 'Ask for filename Filename$ = InputBox("Input Filename: when no name is given+(OK), a date and time will be used", "Save image to file") 'Ask for filename
Code:'Set Form1 Topmost Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) 'Ask for filename Filename$ = InputBox("Input Filename: when no name is given+(OK), a date and time will be used", "Save image to file") 'Ask for filename 'Check for input, ok or cancel If StrPtr(Filename$) = 0 Then 'Checks if cancel was pressed 'User pressed cancel Form1.Label1.Caption = "User canceled filename input." Exit Function ElseIf Filename$ = "" Then 'User provided no input but clicked 'OK' Filename$ = Replace(Now(), ":", "-") End If 'Return Form1 NotTopMost Call SetWindowPos(Form1.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
i was expecting the inputbox to be available immediately, but it somehow isn't. The problem is not there when form1 already has the focus while F10 is pressed.
What could be the cause, or how can i achieve it to be ready for input without interaction




Reply With Quote
