Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to Create Refresh button in Dialog box.

This the the dialog procedure of my program

tell me what to do with refresh button
BOOL CALLBACK TcpDlgProc (HWND hTcpDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
		  GetTCPConn(hTcpDlg);// this is the function i am calling to get information in dialog box
		  return TRUE ;
          
     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
			   EndDialog (hTcpDlg, 0);
			   return TRUE;

          case IDREFRESH :
// What should i do to refresh the content of dialog box
               return TRUE ;
          }
 
	 case WM_DESTROY:
		  EndDialog(hTcpDlg,0);
		  return TRUE ;
          break ;
     }
     return FALSE ;
}
Posted
Updated 6-Mar-12 10:40am
v2

You may split your GetTCPConn() function into two functions:

  • An init function that initializes the controls to be called upon WM_INITDIALOG.
  • An update function that fills the controls with content to be called upon IDREFRESH.

Call the update function at the end of the init function for initial filling of the controls.
 
Share this answer
 
Comments
Maximilien 7-Mar-12 13:07pm    
good answer.
M.
amityadav4a 7-Mar-12 23:35pm    
How to refill all the content of Dialog Box
Jochen Arndt 8-Mar-12 2:45am    
That depends on the controls of your dialog. With a list control, you may add the columns in the init function and add/delete items in the update function.
I called same function again and it worked..
 
Share this answer
 
Couldn't you simply call GetTCPConn(hTcpDlg); again from IDREFRESH ?
 
Share this answer
 
Comments
amityadav4a 6-Mar-12 15:42pm    
It will add same element in the dialog box
Maximilien 6-Mar-12 17:10pm    
Well, you will have to create a function that will get the new values from where ever the values come from. if the GetTCPConn set up the initial values, then you should do something similar.
amityadav4a 6-Mar-12 18:37pm    
Yes it give initial values. How to call that function again to get initial value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900