申し訳ありませんが、愚か者のようなものを逃した場合は、このプロジェクトを送信する必要があり、質問があります
作成されたハンドルにグローバルホットキーを登録しました(編集!!)
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
RegisterHotKey(this.Handle, 1, 0x0000,0x70);
RegisterHotKey(this.Handle, 2, 0x0000,0x71);
RegisterHotKey(this.Handle, 3, 0x0000,0x72);
RegisterHotKey(this.Handle, 4, 0x0000,0x73);
RegisterHotKey(this.Handle, 5, 0x0000,0x74);
RegisterHotKey(this.Handle, 6, 0x0000,0x75);
RegisterHotKey(this.Handle, 7, 0x0000,0x76);
RegisterHotKey(this.Handle, 8, 0x0000,0x77);
RegisterHotKey(this.Handle, 9, 0x0000,0x78);
RegisterHotKey(this.Handle, 10, 0x0000,0x79);
RegisterHotKey(this.Handle, 11, 0x0000,0x7A);
RegisterHotKey(this.Handle, 12, 0x0000,0x7B);
RegisterHotKey(this.Handle, 13, 0x0002,0x45);
}
私のボタン1はフォームを隠し、トレイアイコンを見えるようにします
void Button1Click(object sender, EventArgs e)
{
trayicon.Visible=true;
ShowInTaskbar=false;
this.Hide();
trayicon.ShowBalloonTip(2000,"Corrector is now minimized","Right click at check symbol to Exit or show and change hotkey",ToolTipIcon.Info);
}
トレイアイコンをダブルクリックした後にフォームを表示する機能もあります
private void trayicon_DoubleClick(object Sender, EventArgs e)
{
this.Show();
Visible=true;
ShowInTaskbar=true;
}
問題は、グローバル ホットキー 13 を設定してプログラムを終了することです。
1.プログラムを開き、Ctrl + E(ホットキー)を押しました >>> プログラムを終了します
2.プログラムを開き、ボタン1を押してからCtrl + E>>>プログラムを終了しません
3.プログラムを開き、ボタン1を押してアイコンをダブルクリックすると、フォームが表示され、Ctrl + E>>>>プログラムが終了します
4.プログラムを開き、ボタン1を押してアイコンをダブルクリックすると、フォームが表示され、ボタン1をもう一度押すとフォームが消え、Ctrl + E>>>プログラムを終了します。
それが私が混乱している理由です.2と4は同じ結果になるはずですが、4では機能しますが、2では機能しません
誰か助けてください
ありがとう
プーム
編集:!!
私のWndproc
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0312)
{
int id = m.WParam.ToInt32();
if(id==14)
{
Application.Exit();
}
if(id==13)
{
Application.Exit();
}
if(check2==0)
{
this.TopMost=true;
MessageBox.Show("กรุณาเลือกปุ่มที่จะใช้เเก้ก่อน,Select hotkey first","ข้อผิดพลาด",MessageBoxButtons.OK,MessageBoxIcon.Error);
this.TopMost=false;
}
if(id==check2)
{
translate();//You can replace this statement with your desired response to the Hotkey.
}
}
base.WndProc(ref m);
}