프로젝트

일반

사용자정보

개정판 70b0b5d7

ID70b0b5d762db1d75df44a653b1320994083da993
상위 2b8c256c
하위 592fccd4

gaqhf 이(가) 약 5년 전에 추가함

dev issue #000 : add hotkey

Change-Id: Ia7cd9401b5453fe9c549c149b5f7c8dc4fa73bdd

차이점 보기:

DTI_PID/SPPIDConverter/ConverterDocking.cs
57 57
                if (!addEvent)
58 58
                {
59 59
                    application.EventObject.BeforeApplicationExit += ApplicationEvents_ApplicationExit;
60
                    RegisterHotKey(this.Handle, 0, (int)KeyModifier.Shift, Keys.A.GetHashCode());
60 61
                    addEvent = true;
61 62
                }
62 63
            }
......
223 224
        }
224 225

  
225 226
        #region TEST
227
        [System.Runtime.InteropServices.DllImport("user32.dll")]
228
        private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);
229

  
230
        [System.Runtime.InteropServices.DllImport("user32.dll")]
231
        private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
232

  
233
        enum KeyModifier
234
        {
235
            None = 0,
236
            Alt = 1,
237
            Control = 2,
238
            Shift = 4,
239
            WinKey = 8
240
        }
241

  
242
        protected override void WndProc(ref Message m)
243
        {
244
            base.WndProc(ref m);
245
            if (m.Msg == 0x0312)
246
            {
247
                Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
248
                KeyModifier modifier = (KeyModifier)((int)m.LParam & 0xFFFF);
249
                int id = m.WParam.ToInt32();
250
                application.RunCommand(CommandConstants.igcmdGridSnap);
251
            }
252

  
253
        }
254

  
226 255
        private void ApplicationEvents_ApplicationExit(out bool cancel)
227 256
        {
228
            application.Documents.Close();
229
            //SheetWindow sheetWindow = application.ActiveWindow;
257
            UnregisterHotKey(this.Handle, 0);
230 258
            cancel = false;
231 259
        }
232 260

  
233 261
        private void simpleButton1_Click(object sender, EventArgs e)
234 262
        {
235
            application.RunCommand(CommandConstants.igcmdGridSnap);
263
            
236 264
            return;
237 265

  
238 266
            Placement placement = new Placement();

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)