hexagon logo

Wish Escape key 'worked'?

JUST REALIZED THIS IS IN THE WRONG FORUM. IT SHOULD BE IN CODE SAMPLES.


A little project I've been working on to handle my biggest pet peeve about PcDmis. The Escape key doesn't close every window like I wish it did, like in most other software I use. I am huge on only using the keyboard when I'm programming (as much as possible of course), I am too lazy to reach over to the mouse hehe I'm probably going to hear it but let's face it...it slows you down. PCDMIS looses focus to dialogue windows like if the developers did it on purpose. I'll stop knocking on my fav CMM software now before there are threats of switching over to something 'better' from my management.

Anyway, paste this code in a VB.NET project and please take it further and touch back with your improvements. I will keep furthering this little project until I have everything taken care of. Right now it 'should' handle all windows when the ESCAPE key is pressed it closes the dialogue. When RETURN or ENTER key is pressed it accepts or 'OK' the dialogue (Auto Feature only at the moment give me some time, I'll to the rest).



AGAIN please share your code don't be [....].

Thanks,
KP61dude!

EDIT:

Reached maximum text limit, see next post for source code.
Parents
  • Imports System.Text
    Imports System.Runtime.InteropServices
    Imports System.ComponentModel
    Public Class PcdHelper
    #Region "Global Vars"
        'Globals
        Private ParentHandle As IntPtr
        Private pcdTask As Integer
        Public PcdWindows() As String = {
                      "Auto Feature",'00
               "Alignment Utilities",'01
                   "Probe Utilities",'02
                     "CAD Transform",'03
                      "CAD Assembly",'04
             "CAD and Graphic Setup",'05
                             "Angle",'06
                        "Angularity",'07
                       "Circularity",'08
                        "Coaxiality",'09
                     "Concentricity",'10
                      "Cylindricity",'11
                          "Distance",'12
                          "Flatness",'13
                  "Feature Location",'14
                       "Parallelism",'15
                  "Perpendicularity",'16
                          "Position",'17
               "Position In-Between",'18
                      "Line Profile",'19
                   "Surface Profile",'20
                   "Circular Runout",'21
                      "Total Runout",'22
                      "Straightness",'23
                          "Symmetry",'24
                    "Pattern Offset",'25
            "Hide and Show Graphics",'26
                 "Dimensional Keyin",'27
                     "No Task Found" '28 Must remain last and must not change!
                     }
    
        Enum KeyModifier
            None = 0
            Alt = &H1
            Control = &H2
            Shift = &H4
            Winkey = &H8
        End Enum 'This enum is just to make it easier to call the registerHotKey function: The modifier integer codes are replaced by a friendly "Alt","Shift" etc.
    
        Private Const BM_CLICK As Integer = &HF5
    
        Public Const WM_HOTKEY As Integer = &H312
    
        'Find virtual key codes here: https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes using decimal values use this http://www.bluesock.org/~willg/dev/ascii.html
        Public Const VK_ESCAPE As Integer = 27 'Escape Key
        Public Const VK_RETURN As Integer = 13 ' Return Key
    #End Region
    


    EDIT: more limitations!!! continued on next post.
Reply
  • Imports System.Text
    Imports System.Runtime.InteropServices
    Imports System.ComponentModel
    Public Class PcdHelper
    #Region "Global Vars"
        'Globals
        Private ParentHandle As IntPtr
        Private pcdTask As Integer
        Public PcdWindows() As String = {
                      "Auto Feature",'00
               "Alignment Utilities",'01
                   "Probe Utilities",'02
                     "CAD Transform",'03
                      "CAD Assembly",'04
             "CAD and Graphic Setup",'05
                             "Angle",'06
                        "Angularity",'07
                       "Circularity",'08
                        "Coaxiality",'09
                     "Concentricity",'10
                      "Cylindricity",'11
                          "Distance",'12
                          "Flatness",'13
                  "Feature Location",'14
                       "Parallelism",'15
                  "Perpendicularity",'16
                          "Position",'17
               "Position In-Between",'18
                      "Line Profile",'19
                   "Surface Profile",'20
                   "Circular Runout",'21
                      "Total Runout",'22
                      "Straightness",'23
                          "Symmetry",'24
                    "Pattern Offset",'25
            "Hide and Show Graphics",'26
                 "Dimensional Keyin",'27
                     "No Task Found" '28 Must remain last and must not change!
                     }
    
        Enum KeyModifier
            None = 0
            Alt = &H1
            Control = &H2
            Shift = &H4
            Winkey = &H8
        End Enum 'This enum is just to make it easier to call the registerHotKey function: The modifier integer codes are replaced by a friendly "Alt","Shift" etc.
    
        Private Const BM_CLICK As Integer = &HF5
    
        Public Const WM_HOTKEY As Integer = &H312
    
        'Find virtual key codes here: https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes using decimal values use this http://www.bluesock.org/~willg/dev/ascii.html
        Public Const VK_ESCAPE As Integer = 27 'Escape Key
        Public Const VK_RETURN As Integer = 13 ' Return Key
    #End Region
    


    EDIT: more limitations!!! continued on next post.
Children
No Data