“序列号输入助手”源代码

2016-02-19 20:46 20 1 收藏

岁数大了,QQ也不闪了,微信也不响了,电话也不来了,但是图老师依旧坚持为大家推荐最精彩的内容,下面为大家精心准备的“序列号输入助手”源代码,希望大家看完后能赶快学习起来。

【 tulaoshi.com - 编程语言 】

/////////////////////////////////////////////////////////
  //        SnInput                                      //
  //                                                     //
  //                            作者:黄展宏              //
  //                            QQ号:309654973           //
  //                            创建于:2005/06/23        //
  //                            修改于:2005/06/29        //
  /////////////////////////////////////////////////////////
  
  
  program SnInput;
  
  {$APPTYPE GUI}
  {$I-}
  
  uses
    Windows,
    Messages,
    SysUtils;
  
  var
    atom: Integer = 0;
    hInst: Integer;
    wc: TWndClassEx;
    Msg: TMsg;
  
    hFont: Integer = 0;
    hMutex: Integer;
  
    hWnd: Integer;
    hEdit: Integer;
    hCheckBox: Integer;
    hTmpWnd: Integer;
  
  const
    ID_CHECKBOX = 100;
    STR_INTERNALNAME = 'SnInputApplication';
    STR_CHECKBOX = '将“-”(杠号)转为跳格键(Tab)。';
    STR_HOTKEY = 'MyHotKey_OrochiHuang_2005.6.18';
    STR_PRODUCT = '序列号输入助手 V0.1';
    STR_TIPS = (#13#10 +
      '使用说明:' + #13#10 +
      '1、复制序列号。'#13#10 +
      '2、将光标定位到序列号输入处。'#13#10 +
      '3、按F10键。'#13#10 + #13#10 +
      '“将‘-’(杠号)转为跳格键(Tab)”功能说明:' + #13#10 +
      '  因为有一些程序当输完一段序列号后,不会自动跳往下一格继续输入,导致把全部注册码输入在一个序列号段里,' +
      '遇到这个种情况的话勾选它就对啦!' + #13#10 + #13#10 +
      '作者:黄展宏' + #13#10 +
      'Email:orochi_huang@126.com');
  
  
  procedure MySendKeys(Keys: PChar);
    procedure SendKeyDown(VKey: Byte);
    var ScanCode: Byte;
    begin
      ScanCode := Lo(MapVirtualKey(VKey, 0));
      keybd_event(VKey, ScanCode, 0, 0);
    end;
  
    procedure SendKeyUp(VKey: Byte);
    var ScanCode: Byte;
    begin
      ScanCode := Lo(MapVirtualKey(VKey, 0));
      keybd_event(VKey, ScanCode, KEYEVENTF_KEYUP, 0);
    end;
  
    function BitSet(BitTable, BitMask: Byte): Boolean;
    begin
      Result := ByteBool(BitTable and BitMask);
    end;
  
  var
    L: Word;
    I: Word;
    MKey: Word;
    ScanCode: Byte;
  const
    VKKEYSCANSHIFTON = $01;
    VKKEYSCANCTRLON = $02;
    VKKEYSCANALTON = $04;
  begin
    L := StrLen(Keys);
  
    if L = 0 then Exit;
  
    for I := 0 to L - 1 do
    begin
      MKey := vkKeyScan(Keys[I]);
      if MKey  $FFFF then
      begin
        ScanCode := Hi(MKey);
        if BitSet(ScanCode, VKKEYSCANSHIFTON) then SendKeyDown(VK_SHIFT);
        if BitSet(ScanCode, VKKEYSCANCTRLON) then SendKeyDown(VK_CONTROL);
        if BitSet(ScanCode, VKKEYSCANALTON) then SendKeyDown(VK_MENU);
        SendKeyDown(MKey);
        SendKeyUp(MKey);
        if BitSet(ScanCode, VKKEYSCANSHIFTON) then SendKeyUp(VK_SHIFT);
        if BitSet(ScanCode, VKKEYSCANCTRLON) then SendKeyUp(VK_CONTROL);
        if BitSet(ScanCode, VKKEYSCANALTON) then SendKeyUp(VK_MENU);
        Sleep(15); 
      end;
    end;
  
  end;
  
  procedure HotKey(hWnd: Integer; state: Boolean);
  begin
  
    if state then
    begin
      atom := GlobalFindATOM(STR_HOTKEY);
  
      if atom = 0 then atom := GlobalAddATOM(STR_HOTKEY);
  
      RegisterHotKey(hWnd, atom, 0, VK_F10);
    end
    else begin
      if atom  0 then
      begin
        UnregisterHotKey(hWnd, atom);
        GlobalDeleteATOM(atom);
        atom := 0;
      end;
    end;
  end;
  
  function WndProc(hWnd: Integer; uMsg: Cardinal;
    wParam, lParam: Integer): LRESULT; stdcall;
  var
    hData: Integer;
    Keystr: string;
    Position: Byte;
    rc: TRect;
  
  begin
    Result := 0;
    case uMsg of
      WM_CTLCOLORSTATIC:
        begin
          if lParam = hEdit then
          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_BORDER or WS_CHILD or WS_VISIBLE or ES_READONLY or ES_MULTILINE or
            WS_VSCROLL,
            0, 30, rc.Right, rc.Bottom - 30, hWnd, 0, hInst, nil);
  
          hCheckBox := CreateWindowEx(0, 'BUTTON', STR_CHECKBOX, WS_VISIBLE or
            WS_CHILD or BS_AUTOCHECKBOX,
            10, 10, 300, 20, hWnd, ID_CHECKBOX, hInst, nil);
  
          hFont := CreateFont(12, 0, 0, 0, 0, 0, 0, 0,
            DEFAULT_CHARSET, 0, 0, 0, 0, '宋体');
  
          if hFont  0 then
          begin
            SendMessage(hEdit, WM_SETFONT, hFont, 0);
            SendMessage(hCheckBox, WM_SETFONT, hFont, 0);
          end;
  
        end;
  
      WM_HOTKEY:
        begin
          OpenClipboard(hWnd);
          hData := GetClipboardData(CF_TEXT);
  
          if hData  0 then
          begin
            Keystr := StrPas(PChar(GlobalLock(hData)));
            Position := Pos('-', Keystr);
  
            while Position  0 do
            begin
            
              if SendMessage(hCheckBox, BM_GETCHECK, 0, 0)  0 then
                Keystr[Position] := Char(VK_TAB)
              else
                Delete(KeyStr, Position, sizeof(keystr[Position]));
  
              Position := Pos('-', Keystr);
            end;
  
            MySendKeys(PChar(KeyStr));
            GlobalUnlock(hData);
          end;
          CloseClipboard;
  
        end;
  
      WM_DESTROY:
        begin
          if hFont  0 then
            DeleteObject(hFont);
  
          HotKey(hWnd, False);
          PostQuitMessage(0);
        end;
  
    else
      Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
    end;
  
  
  end;
  
  
  begin
    hMutex := CreateMutex(nil, True, STR_PRODUCT);
  
    if GetLastError = ERROR_ALREADY_EXISTS then
    begin
      hTmpWnd := FindWindow(STR_INTERNALNAME, nil);
      if hTmpWnd  0 then
      begin
        if IsIconIc(hTmpWnd) then
          ShowWindow(hTmpWnd, SW_NORMAL);
  
        SetForegroundWindow(hTmpWnd);
        ShowWindow(hTmpWnd, SW_SHOW);
      end;
      Exit;
    end;
  
    hInst := hInstance;
    FillChar(wc, SizeOf(wc), 0);
  
    with wc do
    begin
      cbSize := SizeOf(wc);
      style := CS_HREDRAW or CS_VREDRAW;
      lpfnWndProc := @WndProc;
      hInstance := hInst;
      hIcon := LoadIcon(0, IDI_APPLICATION);
      hCursor := LoadCursor(0, IDC_ARROW);
      hbrBackground := GetSysColorBrush(COLOR_BTNFACE);
      lpszClassName := STR_INTERNALNAME;
    end;
  
    if RegisterClassEx(wc) = 0 then Exit;
  
    hWnd := CreateWindowEx(0, wc.lpszClassName, STR_PRODUCT,
      (*WS_OVERLAPPED or *)WS_MINIMIZEBOX or WS_CAPTiON or WS_SYSMENU,
      Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), 320, 250,
      0, 0, hInst, nil);
  
    if hWnd = 0 then Exit;
  
    ShowWindow(hWnd, SW_SHOW);
    UpdateWindow(hWnd);
  
    repeat
      if PeekMessage(Msg, 0, 0, 0, PM_REMOVE) then
      begin
        TranslateMessage(Msg);
        DispatchMessage(Msg);
      end
      else begin
        ;
      end;
    until Msg.message = WM_QUIT;
  
    ReleaseMutex(hMutex);
    CloseHandle(hMutex);
  
  end.
  
  

来源:https://www.tulaoshi.com/n/20160219/1624452.html

延伸阅读
《使命召唤2》cdkey序列号-XEZL-GZWX-XQZG-GEGU-EEFC《使命召唤2》通关视频攻略24:伯格斯坦 24.伯格斯坦(Bergstein) 时间:1944年12月6日 地点:德国 伯格斯坦 在攻入德国境内后,比尔所在的部队一直在战壕里坚守,士兵们在雨水和炮火中变得憔悴疲惫。还好他们最近接到了进攻伯格斯坦的命令,终于可以在无聊的枯守后活动一下...
《fifa 11》cdkey安装序列号 《FIFA 11》cdkey安装序列号: KR9R-KNDV-YGSX-GNAL-NR7A Xbox360化身高富帅!11月海量游戏大作一览 每年的11月都是游戏大作爆发潮,也是偷跑游戏爆发潮《光环4》当属XBOX360最热门游戏之一,但也是11月作品中偷跑的最早的游戏了(微软欲哭无泪)。今天就让我们再来看看在XBOX360上还会有哪些大作即将发售吧! ...
《使命召唤5》安装cdkey序列号 MPC8-MD8P-78P1-75DU-890F 《使命召唤5》Death Cards效果介绍 用了一早上时间 和同学COOP 下找齐 除了俄国的狙击关要自己单独找 这个卡片系统挺有意思的。。一张卡片在COOP下算是一个技能或一种游戏效果   简单介绍下 吸血卡片 Queen of Hearts (红心Q) 打中敌人会恢复自己的伤害。。长时间没有打中...
查iPhone序列号判断是否新机   第一步,在iPhone上查询设备序列号。具体操作方法:在设置应用中,进入通用选项。 然后,点击关于本机,即可看到本机的序列号了。 第二步,进入苹果官网,通过序列号查询保修服务和支持期图老师限。 如果序列号正确,就会显示有效购买日期,电话技术支持、维修和服务保修情况等...
iPhone6序列号怎么查看?   对于很多新入手iPhone6的用户来说,我们第一时间想要了解的是iPhone6是不是正品,是不是山寨机或者使用过的翻新机。这个时候,我们可以通过iPhone6序列号,在苹果官网查询新机的激活时间来了解其真假和激活时间。但是,iPhone6序列号怎么看?这是很多新手朋友所不了解的,下面图老师小编为大家详细介绍下iPh...

经验教程

783

收藏

21
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部