Калькулятор

    Date: 02/02/07 (Code WTF)    Keywords: no keywords

    http://www.gamedev.ru/flame/forum/?id=60798
    http://www.gamedev.ru/flame/forum/?id=60793 - история появления здесь

    procedure TForm1.Button1Click(Sender: TObject);
    var
      hCalc, hCalcEdit: HWND;
      hCalcMenu, hCalcSubMenu: HMENU;
      hCalcSubMenuID0, hCalcSubMenuID1: DWORD;
      ClipBoard: TClipboard;
    begin
      if Not FileExists('C:\Windows\system32\calc.exe') then begin ShowMessage('Error!'); Exit; end;
      hCalc := FindWindow('SciCalc', 0);
      if hCalc = 0 then begin
      ShellExecute(0, 'Open', 'C:\Windows\system32\calc.exe', Nil, Nil, SW_SHOWNORMAL);
      repeat
        hCalc := FindWindow('SciCalc', HWND(Nil));
      until hCalc <> 0; end;
      hCalcEdit := FindWindowEx(hCalc, 0, 'Edit', '');
      ClipBoard := TClipboard.Create;
      ClipBoard.SetTextBuf(PChar(Edit1.Text));
      hCalcMenu := GetMenu(hCalc);
      hCalcSubMenu := GetSubMenu(hCalcMenu, 0);
      hCalcSubMenuID0 := GetMenuItemID(hCalcSubMenu, 0);
      hCalcSubMenuID1 := GetMenuItemID(hCalcSubMenu, 1);
      PostMessage(hCalc, WM_COMMAND, hCalcSubMenuID1, 0);
      repeat
        PostMessage(hCalc, WM_COMMAND, hCalcSubMenuID0, 0);
        RichEdit1.Clear; RichEdit1.PasteFromClipboard;
      until (StrComp(PChar(RichEdit1.Text), PChar(Edit1.Text)) <> 0) And (StrLen(PChar(RichEdit1.Text)) <> 0);
    end;
    

    Source: http://community.livejournal.com/code_wtf/66997.html

« PHP и румыны || FOX Toolkit »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home