interacting with windows calculator



Hi all,

I am trying to interact with the windows calculator.
I want to open the calculator for the user so the user can work with it.
When the user is done (or during) working with calculator I need the
(displayed)value of the calcultor back in my textbox.

I have no problem starting calculator or even put values in calculator.
I just cant get the value out of the Edit class of the calculator.

Any tips or idea's for me?


Here is my code (so far)

//Opening the calculator
Process p =Process.Start("calc.exe");
//Calculator Handle
hwndCalc = p.MainWindowHandle.ToInt32();
//Get the Handle of the Edit class (textbox of the calculator)
IntPtr pntr = FindWindowEx(p.MainWindowHandle, IntPtr.Zero, "Edit", null);
//Setting a value to the calculator
SendMessage(pntr, WM_SETTEXT, 0, "1234567");

//Buffer voor the text to be read out
StringBuilder Buff = new StringBuilder(256);
//Buffer stays empty...why???
GetWindowText(pntr.ToInt32(), Buff, Buff.Capacity);
//Dont know what to fill in for nIDDlgItem...:(
//Spy++ gives me everytime a different handle. The const 414 isnt correct
either (Buff stays empty)
//When filling in the Edit class handle then also Buff stays empty.
GetDlgItemTextA(hwndCalc, ????, Buff, Buff.Capacity);


Thank you in advance


.



Relevant Pages

  • Re: interacting with windows calculator
    ... Because I dont want to use extra code or some other calculator while there is a good one in windows. ... I just cant get the value out of the Edit class of the calculator. ... The const 414 isnt correct either (Buff stays empty) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: interacting with windows calculator
    ... Because I dont want to use extra code or some other calculator while there is a good one in windows. ... I just cant get the value out of the Edit class of the calculator. ... The const 414 isnt correct either (Buff stays empty) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: interacting with windows calculator
    ... I want to open the calculator for the user so the user can work with it. ... I just cant get the value out of the Edit class of the calculator. ... The const 414 isnt correct either (Buff stays empty) ... //When filling in the Edit class handle then also Buff stays empty. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: interacting with windows calculator
    ... Because I dont want to use extra code or some other calculator while there ... I am trying to interact with the windows calculator. ... I just cant get the value out of the Edit class of the calculator. ... StringBuilder Buff = new StringBuilder; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HST simplified...please
    ... mulbish wrote: ... Is your brain half full or half empty. ... The question about how to use the calculator clearly indicated that you ...
    (misc.fitness.weights)

Loading