GitDlgItemInt & SetDlgItemInt

This is a discussion on GitDlgItemInt & SetDlgItemInt within the Windows Programming forums, part of the Platform Specific Boards category; I'm not using a dialog but you said that it would work to communicate between a button and an edit ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    81

    GitDlgItemInt & SetDlgItemInt

    I'm not using a dialog but you said that it would work to communicate between a button and an edit box, so how would i use the getdlgitemint and the setdlgitemint if the edit box i'm using id is ID_EDBOX number id is 108, my handle is ebox, i need to multiply a numerical value from the edit box and return it to the same box, i'm using borland so anyone got an idea on it?

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    so something like

    Code:
    int      iEdit=0,uSuc=0;
    double   fFactor=0.101;
    char     sBuffer[64];
    HWND     hDialog=GetParent(edbox);
    
    case ID_BUTTON:
    if(BN_CLICKED == HIWORD(wParam))
    {
        iEdit=GetDlgItemInt(hDialog, ID_EDBOX, uSuc, 10);
        if(uSuc)
        {
               sprintf( sBuffer, "%04.2f" ,(double)(iEdit * fFactor) );
               SetDlgItemText(hDialog, ID_EDBOX, sBuffer);
        }
    }
    the error check on uSuc is not needed but included to demonstrate its use.
    Last edited by novacain; 05-29-2002 at 10:00 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SetDlgItemInt()
    By jay kay in forum Windows Programming
    Replies: 1
    Last Post: 03-10-2005, 01:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21