由于程序需要,需要一个计算器,能不能直接调用WINDOW里面的计算器?

解决方案 »

  1.   

    呵呵,可以的呀,
    你可以通过消息来取得计算器显示的值,用SPY++程序试试吧
      

  2.   

    uses shellapishellexecute(0,'open',pchar('calc.exe'),nil,nil,sw_normal);或者winexec('calc.exe',0);
      

  3.   

    var Wnd : HWnd;
        TheText: PChar;
        TextLen: Integer;
    begin
       Wnd := FindWindow('SciCalc',Nil);
       if Wnd <>0 then
       begin
           Wnd := FindWindowEx(Wnd,0,'Static',Nil);
           if Wnd <>0 then
           begin
               //找到计算器的显示框句柄
               TextLen := GetWindowTextLength(Wnd);
               GetMem(TheText,TextLen);
               GetWindowText(Wnd,TheText,TextLen+1);
               ShowMessage(TheText);
               FreeMem(TheText);
           end;
       end else
       begin
           /////////////////////
           /////////////////////
       end;
    end;
      

  4.   

    呵呵,这种问题还要问?
    直接用WINEXEC启动这个就可以啊!
      

  5.   

    winexec('calc.exe',1);
    连路径都不用加
      

  6.   

    if winexec('calc.exe',SW_SHOW) < 31 then
      showMessage('请安装WINDOWS中的计算器!');
      

  7.   

    谢谢给位了,to sundytu(晶晶),不会呀老大,会了就不会问了,呵呵,希望多多赐教