Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Real time display

Real time display

Scheduled Pinned Locked Moved C / C++ / MFC
testingbeta-testingquestion
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Francis Chau
    wrote on last edited by
    #1

    Hi, The codes below used to create a window to display something. Could some of you tell me that how can I display the real time clock (H:M:S) inside this window... Thanks! hwnd = CreateWindow( szWinName, /* name of window class */ "Capture Testing", /* title */ WS_OVERLAPPEDWINDOW, /* window style - normal */ CW_USEDEFAULT, /* X coordinate - let Windows decide */ CW_USEDEFAULT, /* Y coordinate - let Windows decide */ 480, /* width - let Windows decide */ 320, /* height - let Windows decide */ HWND_DESKTOP, /* no parent window */ NULL, /* no menu */ hThisInst, /* handle of this instance of the program */ NULL /* no additional arguments */ ); g_inst=hThisInst; /* Display the window. */ ShowWindow(hwnd, nWinMode); UpdateWindow(hwnd); hWndG=hwnd; SetTimer(hWndG,1,100,NULL);

    C A 2 Replies Last reply
    0
    • F Francis Chau

      Hi, The codes below used to create a window to display something. Could some of you tell me that how can I display the real time clock (H:M:S) inside this window... Thanks! hwnd = CreateWindow( szWinName, /* name of window class */ "Capture Testing", /* title */ WS_OVERLAPPEDWINDOW, /* window style - normal */ CW_USEDEFAULT, /* X coordinate - let Windows decide */ CW_USEDEFAULT, /* Y coordinate - let Windows decide */ 480, /* width - let Windows decide */ 320, /* height - let Windows decide */ HWND_DESKTOP, /* no parent window */ NULL, /* no menu */ hThisInst, /* handle of this instance of the program */ NULL /* no additional arguments */ ); g_inst=hThisInst; /* Display the window. */ ShowWindow(hwnd, nWinMode); UpdateWindow(hwnd); hWndG=hwnd; SetTimer(hWndG,1,100,NULL);

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You need to create a control that shows the time, and then set a timer in that control that keeps calling Invalidate, so that a paint message is recieved. Do you need to use Win32 ? If you can use MFC, it will make life a lot easier for you. Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • F Francis Chau

        Hi, The codes below used to create a window to display something. Could some of you tell me that how can I display the real time clock (H:M:S) inside this window... Thanks! hwnd = CreateWindow( szWinName, /* name of window class */ "Capture Testing", /* title */ WS_OVERLAPPEDWINDOW, /* window style - normal */ CW_USEDEFAULT, /* X coordinate - let Windows decide */ CW_USEDEFAULT, /* Y coordinate - let Windows decide */ 480, /* width - let Windows decide */ 320, /* height - let Windows decide */ HWND_DESKTOP, /* no parent window */ NULL, /* no menu */ hThisInst, /* handle of this instance of the program */ NULL /* no additional arguments */ ); g_inst=hThisInst; /* Display the window. */ ShowWindow(hwnd, nWinMode); UpdateWindow(hwnd); hWndG=hwnd; SetTimer(hWndG,1,100,NULL);

        A Offline
        A Offline
        achainard
        wrote on last edited by
        #3

        An other solution: Add a hook to WM_PAINT message and use TextOut to display your message... You can use this method to display bitmap for Digit like in electronic clock or draw line like in mechanic clock. A++ ...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups