Owen
Owen
CC#
Created by Cience on 7/9/2023 in #help
✅ Detect holding mouse from in and outside the form
40 replies
CC#
Created by Cience on 7/9/2023 in #help
✅ Detect holding mouse from in and outside the form
40 replies
CC#
Created by Cience on 7/9/2023 in #help
✅ Detect holding mouse from in and outside the form
I recommend H.Hooks for global hooks. I haven't personally used it for mouse hooks, but it could also be worth a look at.
40 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Thank you others also, appreciate the help greatly.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Thank you very much!
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Sounds like essentially what I have written above - but done correctly haha. I will look into it now.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
This does look good - thank you muchly. I'm pretty happy using low level hooks here as it seems to work, just needs solid implementation. I'm going to save the above code snippet though, and if I encounter any issues - i'll be switching over.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Sounds correct, I will make this change now.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
I'm not yet familiar with
IDisposable
IDisposable
- so I wasn't able to fully put your above recommendation to practice. Maybe I will do some research if you think an alternative method involving this would be better.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
What are your thoughts on this implementation?
using GTAToolkit.Extensions;
using H.Hooks;

namespace GTAToolkit.Hotkeys
{
public class CreateHotkeyEvent
{
public static LowLevelKeyboardHook keyboardHook = new LowLevelKeyboardHook();
public static void Do()
{
keyboardHook.Down += (_, args) =>
{
if (args.Keys.Are(Key.Shift, Key.D0))
{
// Shows/hides window via ')' hotkey
ConsoleExtensions.ShowHideWindow();
}
};
keyboardHook.Start();
}
}
}
using GTAToolkit.Extensions;
using H.Hooks;

namespace GTAToolkit.Hotkeys
{
public class CreateHotkeyEvent
{
public static LowLevelKeyboardHook keyboardHook = new LowLevelKeyboardHook();
public static void Do()
{
keyboardHook.Down += (_, args) =>
{
if (args.Keys.Are(Key.Shift, Key.D0))
{
// Shows/hides window via ')' hotkey
ConsoleExtensions.ShowHideWindow();
}
};
keyboardHook.Start();
}
}
}
I then have another method to detect console closing which will Dispose the public keyboardHook.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
It doesn’t touch or interact with the game in any way. It is simply a tool to simplify file generation, and other things required in FiveM development
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Program is completely external. It does nothing with the live game. Simply creates its own files that can be later used within fivem
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Totally agree - was just my way to test. I will look into a clean implementation now
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
Thanks for your suggestion. Here's my implementation, however nothing is written to the console when the keys are pressed.
using H.Hooks;

namespace GTAToolkit.Hotkeys
{
public class CreateHotkeyEvent
{
public static void Do()
{
/*Hook.GlobalEvents().KeyPress += (sender, e) =>
{
if (e.KeyChar == ')')
{
Console.WriteLine("stop");
ConsoleExtensions.ChangeRunningState();
}
else if(e.KeyChar == '(')
{
Console.WriteLine("hide");
ConsoleExtensions.ShowHideWindow();
}
};*/

using var keyboardHook = new LowLevelKeyboardHook();
keyboardHook.Down += (_, args) =>
{
if (args.Keys.Are(Key.Control, Key.LeftShift))
{
Console.WriteLine("key detected");
}
};

keyboardHook.Start();

}
}
}
using H.Hooks;

namespace GTAToolkit.Hotkeys
{
public class CreateHotkeyEvent
{
public static void Do()
{
/*Hook.GlobalEvents().KeyPress += (sender, e) =>
{
if (e.KeyChar == ')')
{
Console.WriteLine("stop");
ConsoleExtensions.ChangeRunningState();
}
else if(e.KeyChar == '(')
{
Console.WriteLine("hide");
ConsoleExtensions.ShowHideWindow();
}
};*/

using var keyboardHook = new LowLevelKeyboardHook();
keyboardHook.Down += (_, args) =>
{
if (args.Keys.Are(Key.Control, Key.LeftShift))
{
Console.WriteLine("key detected");
}
};

keyboardHook.Start();

}
}
}
48 replies
CC#
Created by Owen on 4/20/2023 in #help
❔ Issue with GlobalMouseKeyHook / Global Hotkeys.
A FiveM development tool. Will have a bunch of different development things I need on the fly which can be accessed without un-focusing the game.
48 replies