Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Invoke a calculator
Message
De
28/11/2003 11:39:52
 
 
À
28/11/2003 10:54:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00854219
Message ID:
00854235
Vues:
17
>Hi All:
>
>Can anyone direct me to information on how to pop up a calculator or some dialog that will allow me to calculate a number to be entered into a text field?
>
>e.g.
>Instead of entering '62987' into a text field, I would somehow like to be able to enter 44234+12542+6211.
>
Hello Yossi;

Sometime ago I have mixed some different programs and as result we have it:

The only problem founded here is for the key "+" (add).. I don't know why the calculator doesn't accept that key..

But with the help of others maybe we can figure out what is going wrong here
cwkeysto="44234-12542-6211="
Do decl
oShell = CREATEOBJECT("WScript.Shell")
Do _show
Do while !empty(cwkeysto)
    cwkey = substr(cwkeysto,1,1)
    oShell.SendKeys(cwkey)
    cwkeysto = stuff(cwkeysto,1,1,"")
    If  empty(cwkeysto)
    Else
        If  stuff(cwkeysto,1,1,"") = "+"
            = Sleep(800)
        Else
            = Sleep(100)
        Endif
    Endif
Enddo
Procedure _show
#Define SW_SHOWNORMAL  1
Local hwnd
HWnd = FindWindow (.NULL., "Calculator")
If hwnd = 0
    = WinExec ("calc.exe", SW_SHOWNORMAL)
Else
    = SetForegroundWindow (hwnd)
Endif

Procedure  _hide
#Define WM_QUIT      18
Local hwnd
HWnd = FindWindow (.NULL., "Calculator")
If hwnd <> 0
    = PostMessage (hwnd, WM_QUIT, 0,0)
Endif


Procedure  decl
Declare INTEGER SetForegroundWindow IN "user32" INTEGER hwnd

Declare INTEGER FindWindow IN user32;
    STRING lpClassName,;
    STRING lpWindowName

Declare INTEGER WinExec IN kernel32;
    STRING lpCmdLine, INTEGER nCmdShow

Declare SHORT PostMessage IN user32;
    INTEGER   hWnd,;
    INTEGER   Msg,;
    STRING  @ wParam,;
    INTEGER   lParam

Declare Sleep IN Win32API;
    INTEGER dwMilliseconds
Declare INTEGER GetActiveWindow ;
    IN Win32API
Declare INTEGER GetWindow IN Win32API ;
    INTEGER HWND, INTEGER nType
Declare INTEGER GetWindowText IN Win32API ;
    INTEGER HWND, STRING @cText, INTEGER nType
Declare INTEGER BringWindowToTop IN Win32API ;
    INTEGER HWND
Declare integer SetActiveWindow in user32.dll ;
    integer hwnd
HTH

Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform