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. C, Win32 API: l need a help

C, Win32 API: l need a help

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelpquestionloungeworkspace
3 Posts 3 Posters 0 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.
  • U Offline
    U Offline
    User 12105981
    wrote on last edited by
    #1

    Hi, Good day everyone. l have some difficulties in the following which l need some help. Am a learner in win32 programming. > l created an application with a button "LogOut", which l want, when the user clicks the LogOut button, the application starts afresh. Just like in a standard program(eg. MSWORD) where when "New" is clicked, a new workspace pops out. So l need help in making my program to start afresh when LogOut button is clicked. MY TRIAL: l had done the following, and it worked but it only run the codes in WM_CREATE and l still had sent messages to other cases like WM_PAINT, WM_NOTIFY etc, still only the code in WM_CREATE runs.

    case IDC_LOGOUTBTN:
    SendMessage(hWnd,WM_CREATE, 0,(LPARAM)lpcs)//where lpcs is a pointer to CreateStruct structure.
    break;

    >> At some point in my program, l generate random numbers using srand((unsigned)time(&t)) and rand() functions when NEXT button is clicked. But l want to know if there is anyway to get the previous random number(s) when PREVIOUS button is clicked? Thanks.

    D V 2 Replies Last reply
    0
    • U User 12105981

      Hi, Good day everyone. l have some difficulties in the following which l need some help. Am a learner in win32 programming. > l created an application with a button "LogOut", which l want, when the user clicks the LogOut button, the application starts afresh. Just like in a standard program(eg. MSWORD) where when "New" is clicked, a new workspace pops out. So l need help in making my program to start afresh when LogOut button is clicked. MY TRIAL: l had done the following, and it worked but it only run the codes in WM_CREATE and l still had sent messages to other cases like WM_PAINT, WM_NOTIFY etc, still only the code in WM_CREATE runs.

      case IDC_LOGOUTBTN:
      SendMessage(hWnd,WM_CREATE, 0,(LPARAM)lpcs)//where lpcs is a pointer to CreateStruct structure.
      break;

      >> At some point in my program, l generate random numbers using srand((unsigned)time(&t)) and rand() functions when NEXT button is clicked. But l want to know if there is anyway to get the previous random number(s) when PREVIOUS button is clicked? Thanks.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Member 12139442 wrote:

      Just like in a standard program(eg. MSWORD) where when "New" is clicked, a new workspace pops out.

      Word simply creates a new document. It does not start over.

      Member 12139442 wrote:

      So l need help in making my program to start afresh when LogOut button is clicked.

      I would consider ShellExecute() or CreateProcess() for this.

      Member 12139442 wrote:

      But l want to know if there is anyway to get the previous random number(s) when PREVIOUS button is clicked?

      Store them in a container (e.g., array).

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      1 Reply Last reply
      0
      • U User 12105981

        Hi, Good day everyone. l have some difficulties in the following which l need some help. Am a learner in win32 programming. > l created an application with a button "LogOut", which l want, when the user clicks the LogOut button, the application starts afresh. Just like in a standard program(eg. MSWORD) where when "New" is clicked, a new workspace pops out. So l need help in making my program to start afresh when LogOut button is clicked. MY TRIAL: l had done the following, and it worked but it only run the codes in WM_CREATE and l still had sent messages to other cases like WM_PAINT, WM_NOTIFY etc, still only the code in WM_CREATE runs.

        case IDC_LOGOUTBTN:
        SendMessage(hWnd,WM_CREATE, 0,(LPARAM)lpcs)//where lpcs is a pointer to CreateStruct structure.
        break;

        >> At some point in my program, l generate random numbers using srand((unsigned)time(&t)) and rand() functions when NEXT button is clicked. But l want to know if there is anyway to get the previous random number(s) when PREVIOUS button is clicked? Thanks.

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        You may want to look at this discussion: Multiple top-level frame windows via Win32 API[^]. Also this article (althogh it is MFC): Multiple Top Level Windows[^] could be useful. You can also google for Multiple Top-Level Windows Interface win32. Perhaps, you'll find something more useful and helpful.

        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