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