How to handle accented characters with events KeyCode vb.net

I’m capturing the keyboard keys that are pressed by the CreateKeyboardHook event, where it returns all the keys that were pressed (making it a keylogger, without storing or anything like that, just printing to the console)

    Sub Main()
        Try
            Dim Kbd As New KeyboardStroke
            Dim hookTask As Task = Task.Run(Sub()
                                                Kbd.CreateKeyboardHook(Sub(keyPressed)
                                                                           Console.Write(keyPressed)
                                                                       End Sub)
                                                Application.Run()
                                            End Sub)
            hookTask.Wait()
        Catch ex As Exception
        End Try
    End Sub

I “ran into” a problem (I don’t know if it can be said to be a problem, as it is a function that listens to the keyboard keys) which is the issue of accentuation. I did several searches to try to combine accent + letter and didn’t find anything related (any function specifically for this)

Would there be any way to deal with this? I thought of something related to recording the last key pressed and if that key is an accent, it waits for the next letter or key pressed, so if it is a vowel, it would combine the accent + the vowel (as vowels are the only letters that receive an accent , different from consonants..)

However, I was unable to apply or find any function that performs this “correction”.
Of course this is something specific, like pt-BR keyboard layouts (for example)

The CreateKeyboardHook function follows:

Public Sub CreateKeyboardHook(ByVal keyPressedCallback As Action(Of KeyPressed))
        Me.keyPressedCallback = keyPressedCallback
        Me.HookKeyboardDelegate = AddressOf HookKeyboardCallbackImplementation
        Me.globalKeyboardHookId = User32.SetWindowsHookEx(WH_KEYBOARD_LL, Me.HookKeyboardDelegate, Me.currentModuleId, 0)
    End Sub

For a better understanding (avoid huge codes, but if necessary I will share them with you..)

  • the keyPressedCallback parameter is executed whenever the key is pressed (it is a way of defining what should happen when a keyboard event occurs)

  • the SetWindowsHookEx method is used to install a keyboard hook procedure, it receives some parameters such as the hook type (in this case WH_KEYBOARD_LL) a pointer to the function that will be called whenever a keyboard event occurs (the HookKeyboardDelegate), the handle of the current module, and a handle to the thread associated with the keyboard hook.

  • the HookKeyboardCallbackImplementation method is the function that will be called whenever a keyboard event occurs. It receives event information, such as the key code (nCode), the type of message (wParam) and a pointer to a structure that contains information about the key (lParam) here is where the actual processing of keyboard events happens

Below is a capture of the event:

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật