Thread: How do I update an edit box?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    the magic penguim
    Join Date
    Jul 2005
    Posts
    91
    Well so why this dosen't work? It compiles and starts but the dialog dosen't show up...

    Code:
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include "clock.h"
    
    SYSTEMTIME time;
    char strtime[20];
    
    BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
    {
        switch(Message)
        {
            case WM_INITDIALOG:
                while(1)
                {
                    GetLocalTime(&time);
                    sprintf(strtime, "%d:%d:%d", time.wHour, time.wMinute, time.wSecond);
    		SetDlgItemText(hwnd, IDC_TIME, strtime);
                }
    	break;
            case WM_COMMAND:
            break;
            case WM_CLOSE:
                 EndDialog(hwnd, 0);
            break;
    	default:
    	    return FALSE;
        }
        return TRUE;
    }
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    	LPSTR lpCmdLine, int nCmdShow)
    {
    	return DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, DlgProc);
    }
    Last edited by lala123; 07-06-2005 at 08:34 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. edit box
    By beene in forum Windows Programming
    Replies: 3
    Last Post: 11-11-2006, 04:40 AM
  2. WS_HSCROLL in ES_READONLY edit box error
    By Homunculus in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2006, 08:46 AM
  3. setting fixed floats in edit box
    By WaterNut in forum Windows Programming
    Replies: 4
    Last Post: 08-13-2004, 09:13 AM
  4. Update text box i a thread?
    By yoxler in forum Windows Programming
    Replies: 7
    Last Post: 01-05-2004, 01:13 PM
  5. Limiting Characters in Edit Box :: MFC
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 06-02-2002, 10:21 AM