/// <summary> /// 읽어온 메크로를 인스턴스화. /// </summary> public void LoadMacro() { mList = new List <CMacro>(); int total; int count1; string head; string tail; string file; CMacro cm; string[] section = Resources.Section.Split(','); // COUNT,REGISTKEY,TITLE,INPUTKEY string[] key = Resources.Key.Split(','); // TOTALCOUNT,KEY,COUNT,REGIST,TITLE,INPUT file = Application.StartupPath + Resources.File; Console.WriteLine(file); total = WinLib.GetPrivateProfileInteger(section[0], key[0], file); for (int index1 = 1; index1 <= total; index1++) { cm = new CMacro(WinLib.GetPrivateProfileString(section[2], key[4] + index1, file)); cm.regist = SetMacroKey(WinLib.GetPrivateProfileString(section[1], key[3] + index1, file)); count1 = WinLib.GetPrivateProfileInteger(section[0], key[1] + index1 + key[2], file); for (int index2 = 1; index2 <= count1; index2++) { cm.keyList.Add(SetMacroKey(WinLib.GetPrivateProfileString(section[3], key[1] + index1 + key[5] + index2, file))); } AddMacro(cm); } }
public void StartMacro(CMacro cm) { RegistAllUnregister(); int[] mArr = new int[] { 16, 17, 18 }; foreach (RegistKey key in cm.keyList) { //키 다운 for (int i = 1; i <= 3; i++) { if ((key.modify & 1 << i) == 1) { WinLib.keybd_event((byte)mArr[i - 1], 0, 0, 0); } } WinLib.keybd_event((byte)key.key, 0, 0x00, 0); //키 업 WinLib.keybd_event((byte)key.key, 0, 0x02, 0); for (int i = 1; i <= 3; i++) { if ((key.modify & 1 << i) == 1) { WinLib.keybd_event((byte)mArr[i - 1], 0, 1, 0); } } } RegistAllregister(); }
private void AddMacroList(CMacro cm) { mList.Add(cm); }
/// <summary> /// 메크로 추가하는 메소드. /// </summary> /// <param name="cm"></param> public void AddMacro(CMacro cm) { AddViewer(cm.title); AddMacroList(cm); }
public string GetTitle(CMacro cm) { return(keyUtil.GetTitle(cm)); }
public void Input(CMacro m) { macros.Add(m); }
public string GetTitle(CMacro cm) { return(cm.regist.key.ToString() + ((cm.regist.modify & 1) == 1 ? " + Shift" : "") + ((cm.regist.modify & 2) == 1 ? " + Cntl" : "") + ((cm.regist.modify & 4) == 1 ? " + Alt" : "")); }