Hotkey Help?
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Hotkey mapping can be complex if you are doing it between different programs.
You can use this code to register a system-wide hotkey: viewtopic.php?f=32&t=7564&p=55919#p56005
Based on this code, you can use this sample to see if the game is in focus and then you could send some keys:
You can use this code to register a system-wide hotkey: viewtopic.php?f=32&t=7564&p=55919#p56005
Based on this code, you can use this sample to see if the game is in focus and then you could send some keys:
Code: Select all
<DllImport("user32.dll")> Shared Function GetWindowText(ByVal hWnd As IntPtr, ByVal lpString As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
<DllImport("user32.dll")> Shared Function GetForegroundWindow() As IntPtr
End Function
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_HOTKEY Then
Dim foreground As IntPtr = GetForegroundWindow()
Dim sb As StringBuilder = New StringBuilder(255)
GetWindowText(foreground, sb, sb.MaxCapacity)
Dim winTitle As String = sb.ToString()
If winTitle = "Untitled - Notepad" Then 'example
SendKeys.SendWait("test")
End If
End If
MyBase.WndProc(m)
End Sub
I'm so sorry.. but i still do not understand how to use this code! Is it possible if you send a source code to me written in vb.net? Thanks a ton! Oh right.. is it possible to make a ingame menu in vb.net? It will be much convinent if you could just change the hotkeys ingame.
*Edit*
Nvm.... i've got it, seems like sendkeys work for that. Now.. How can i only activate the hotkeys when the game is focused, so that the hotkeys only work in the game and not anywhere else like notepad? Oh.. and how do i make user defined hotkeys?
*Edit*
Nvm.... i've got it, seems like sendkeys work for that. Now.. How can i only activate the hotkeys when the game is focused, so that the hotkeys only work in the game and not anywhere else like notepad? Oh.. and how do i make user defined hotkeys?
Copyright Information
Copyright © Codenstuff.com 2020 - 2023