procedureMySendKeys(Keys:PChar); procedureSendKeyDown(VKey:Byte); varScanCode:Byte; begin ScanCode:=Lo(MapVirtualKey(VKey,0)); keybd_event(VKey,ScanCode,0,0); end;
procedureSendKeyUp(VKey:Byte); varScanCode:Byte; begin ScanCode:=Lo(MapVirtualKey(VKey,0)); keybd_event(VKey,ScanCode,KEYEVENTF_KEYUP,0); end;
functionBitSet(BitTable,BitMask:Byte):Boolean; begin Result:=ByteBool(BitTableandBitMask); end;
var L:Word; I:Word; MKey:Word; ScanCode:Byte; const VKKEYSCANSHIFTON=$01; VKKEYSCANCTRLON=$02; VKKEYSCANALTON=$04; begin L:=StrLen(Keys);
ifL=0thenExit;
forI:=0toL-1do begin MKey:=vkKeyScan(Keys[I]); ifMKey<>$FFFFthen begin ScanCode:=Hi(MKey); ifBitSet(ScanCode,VKKEYSCANSHIFTON)thenSendKeyDown(VK_SHIFT); ifBitSet(ScanCode,VKKEYSCANCTRLON)thenSendKeyDown(VK_CONTROL); ifBitSet(ScanCode,VKKEYSCANALTON)thenSendKeyDown(VK_MENU); SendKeyDown(MKey); SendKeyUp(MKey); ifBitSet(ScanCode,VKKEYSCANSHIFTON)thenSendKeyUp(VK_SHIFT); ifBitSet(ScanCode,VKKEYSCANCTRLON)thenSendKeyUp(VK_CONTROL); ifBitSet(ScanCode,VKKEYSCANALTON)thenSendKeyUp(VK_MENU); Sleep(15); end; end;
end;
procedureHotKey(hWnd:Integer;state:Boolean); begin
ifstatethen begin atom:=GlobalFindATOM(STR_HOTKEY);
ifatom=0thenatom:=GlobalAddATOM(STR_HOTKEY);
RegisterHotKey(hWnd,atom,0,VK_F10); end elsebegin ifatom<>0then begin UnregisterHotKey(hWnd,atom); GlobalDeleteATOM(atom); atom:=0; end; end; end;
functionWndProc(hWnd:Integer;uMsg:Cardinal; wParam,lParam:Integer):LRESULT;stdcall; var hData:Integer; Keystr:string; Position:Byte; rc:TRect;
begin Result:=0; caseuMsgof WM_CTLCOLORSTATIC: begin iflParam=hEditthen begin SetBkColor(wParam,$FFFFFF); Result:=GetStockObject(WHITE_BRUSH); end; end;
WM_CREATE: begin HotKey(hWnd,True); GetClientRect(hWnd,rc); hEdit:=CreateWindowEx(WS_EX_CLIENTEDGE,'EDIT',STR_TIPS, WS_BORDERorWS_CHILDorWS_VISIBLEorES_READONLYorES_MULTILINEor WS_VSCROLL, 0,30,rc.Right,rc.Bottom-30,hWnd,0,hInst,nil);
ifGetLastError=ERROR_ALREADY_EXISTSthen begin hTmpWnd:=FindWindow(STR_INTERNALNAME,nil); ifhTmpWnd<>0then begin ifIsIconIc(hTmpWnd)then ShowWindow(hTmpWnd,SW_NORMAL);