Hello there guys,
I have found examples, and different codes... But unfortunately, I wasn't able to find anything simple enough for me to play arround with...
This is what I am trying to do..
Regardless of which window I am focused on, I want to press Control + X+V OR Control + G, (2 or 3 combinations)
and I want a MessageBox.Show to execute ... Or something..
THEN, I want Control + Alt + P to stop what Control + G had started (like a timer or anything else)
How can I do that ?
I don't want to ultilize a class or anything... I just want a straight simple code so that i can try to understand it.
thanks guys...
The reason why I am doing this, is because once the Desired hotkey is pressed, there will be a timmer, then depending on what time it is, a different sound will play ...
Thanks guys
Loading
thiago costaPosted Nov 29, 2011, 9:58 PM
I press Shift + J, messagebox will show !!!! AHHAAHA
I hope this helps some one...
Thanks guys
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace Starcraft_2_Builder
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd,
int id, int fsModifiers, int vlc);
[DllImport("user32.dll")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
public Form1()
{
InitializeComponent();
// Alt = 1, Ctrl = 2, Shift = 4, Win = 8
Form1.RegisterHotKey(this.Handle, this.GetType().GetHashCode(), 4, (int)'J');
}
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0312)
MessageBox.Show("");
// this.Activate();
base.WndProc(ref m);
}
}
}
Thanks for reading.