Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. RegisterHotKey help

RegisterHotKey help

Scheduled Pinned Locked Moved C#
debugginghelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MeekLogic
    wrote on last edited by
    #1

    I want to modify this RegisterHotKey func to allow me to set it using HashKey instead of a shortcut key but I'm not exactly sure how to do this. this is the code for registering the hotkey in the object

    	protected bool RegisterHotkey(Shortcut key)
    	{	//register hotkey
    		int mod=0;
    		Keys k2=Keys.None;
    		if (((int)key & (int)Keys.Alt)==(int)Keys.Alt) {mod+=(int)Win32.Modifiers.MOD\_ALT;k2=Keys.Alt;}
    		if (((int)key & (int)Keys.Shift)==(int)Keys.Shift) {mod+=(int)Win32.Modifiers.MOD\_SHIFT;k2=Keys.Shift;}
    		if (((int)key & (int)Keys.Control)==(int)Keys.Control) {mod+=(int)Win32.Modifiers.MOD\_CONTROL;k2=Keys.Control;}
    		
    		System.Diagnostics.Debug.Write(mod.ToString()+" ");
    		System.Diagnostics.Debug.WriteLine((((int)key)-((int)k2)).ToString());
    
            return Win32.User32.RegisterHotKey(m\_Window.Handle, this.GetType().GetHashCode(), (int)mod, ((int)key) - ((int)k2));
    	}
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups