Jump to content

Problem with using _IsPressed()


Recommended Posts

Hello to all,

I've written a script using following part is inserted.
 

Func _CallFolder()
; ....
Local $_hDLL = DllOpen("user32.dll")
; ....
; ....
While 1
    ; ....
    ; ....
    If _IsPressed("1b",$_hDLL) then _Terminate($_hDll,$_iPID,$_hGUI)
    Sleep(10)
WEnd
; ....
; ....
EndFunc

Func _Terminate($_para1, $_para2, $_para3)
    DllClose($_para1)
    ProcessClose($_para2)
    GUIDelete($_para3)
    Exit
EndFunc

The script is working right. But on typing "ESC" not only my script is closing all other open programs using "ESC" for termination too going closed.
I've no idea why that happens.

Maybe one of the "profis" :) can help me on it.

Please ecxuse my bad English but I'm a German trying his best.

Thank you and best regards, HalleMike

Link to comment
Share on other sites

Thank you VIP. I hired the function HorKeySet() and fired the function _IsPressed() in my script and all things are fine. The script works how I want.
But nevertheless I would like to know why I got this problem with _IsPressed(). I don't understand how it comes to "repeating after pressing a key".
There're no words about it in the help explanation.

Maybe you know it and have a minute to write it down here.

Thanks again, HalleMike

Link to comment
Share on other sites

  • Moderators

HalleMike,

Quote

There're no words about it in the help explanation

Oh yes there are, because I added some code to the example in the Help file specifically to cover that case. You need to check for the key no longer being pressed in the function before returning - look for the code after the "Wait until key is released" comment.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...