Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC dll creation Pin
Rajesh R Subramanian6-May-09 4:23
professionalRajesh R Subramanian6-May-09 4:23 
AnswerRe: MFC dll creation Pin
CPallini6-May-09 0:34
mveCPallini6-May-09 0:34 
QuestionHow to show the form created in Windows Form Library from an MFC application Pin
SivaGK5-May-09 23:59
SivaGK5-May-09 23:59 
AnswerRe: How to show the form created in Windows Form Library from an MFC application Pin
Stuart Dootson6-May-09 1:36
professionalStuart Dootson6-May-09 1:36 
QuestionHelp about Message loop please Pin
reply2am5-May-09 23:53
reply2am5-May-09 23:53 
AnswerRe: Help about Message loop please Pin
Stuart Dootson6-May-09 1:40
professionalStuart Dootson6-May-09 1:40 
AnswerRe: Help about Message loop please Pin
serzh836-May-09 1:54
serzh836-May-09 1:54 
GeneralRe: Help about Message loop please Pin
reply2am6-May-09 4:32
reply2am6-May-09 4:32 
Thanks for the reponses
I have debugged it ...
it all goes fine as long as you dont click on the tab(LBUTTONDOWN) or VK_DOWN ( to focus on the page) to start the message loop.
Once you start it, Id doesnt stop i guess.
during the debug:
1. When I only clicked on the tabs and NOT on the tab dialogs( meaning not called TabPageMessageLoop() function) I can change the tabs, use the buttons int he tabs ( without the tab key working for the traversal on the controls)
2. Once i click on the tab page, or i click the down key( which start the messahe loop so that the Tab key can work in the controls), Now the tab key starts working, but only on the currentl page and when u select another tab, it displays Tab number 0( the first tab) always. so in a way the tab selection doesnt work any more.

attached is the whole code required to analyse.
Please help me finding out where the loop resets the m_lptc pointer that it always points to tab-0.
Regards

 typedef struct TabControl 
	  {
	     HWND hTab;
	     HWND hVisiblePage;
	     HWND* hTabPages;
	     LPSTR *tabNames;
	     LPSTR *dlgNames;
	     int tabPageCount;
	     BOOL blStretchTabs;

	     // Function pointer to Parent Dialog Proc
	     BOOL (CALLBACK *ParentProc)(HWND, UINT, WPARAM, LPARAM);

	     // Function pointer to Tab Page Size Proc
	     void (*TabPage_OnSize)(HWND hwnd, UINT state, int cx, int cy);

	     // Pointers to shared functions
	     BOOL (*Notify) (LPNMHDR);
	     BOOL (*StretchTabPage) (HWND, INT);
	     BOOL (*CenterTabPage) (HWND, INT);
 
	  }TABCTRL, *LPTABCTRL;
     // static TABCTRL m_lptc;
	 static TABCTRL TabCtrl_1;
     static LPTABCTRL m_lptc;
#define CMD_VK_ESCAPE	101
#define CMD_VK_RETURN	102
///////////////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////////////////////////////////////////////////////
HINSTANCE g_hinst;     // Handle to application instance.
HWND hWndSummit;
static SIZE gMinSize;



static HWND frmMain;


static BOOL stopTabPageMessageLoop=FALSE;


void CAuthenticationAddin::Configure()
{
   try
   {
      g_hinst = m_hInstance;
      InitCommonControls();
      DialogBox(m_hInstance, MAKEINTRESOURCE(IDD_AUTH_TAB),NULL, (DLGPROC)AuthDialogProc); 
   }
   catch (CBaseException &e)
   {
      LoggedMessageBox(e, "Configure");
   }
   catch (...)
   {
      LoggedMessageBox("Unexpected exception", "Configure");
   }

   Log("CAuthenticationAddin::Configure() - after DisplayDialog()");
}





VOID CAuthenticationAddin::TabCtrl_OnKeyDown(LPARAM lParam)
{
	TC_KEYDOWN *tk=(TC_KEYDOWN *)lParam;
	int itemCount=TabCtrl_GetItemCount(tk->hdr.hwndFrom);
	int currentSel=TabCtrl_GetCurSel(tk->hdr.hwndFrom);
	
	if(itemCount <= 1) return; // Ignore if only one TabPage
	
	//BOOL verticalTabs = GetWindowLong(m_lptc->hTab, GWL_STYLE) & TCS_VERTICAL;
	switch (tk->wVKey)
	{
	case VK_NEXT: //select the previous page
		{
			if(0==currentSel) return;
			TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel-1);
			//TabCtrl_SelectTab (tk->hdr.hwndFrom, currentSel-1);
			TabCtrl_SetCurFocus(tk->hdr.hwndFrom, currentSel-1);
		}
		break;
	case VK_LEFT: //select the previous page
		{
			if(0==currentSel) return;
			TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel-1);
			TabCtrl_SetCurFocus(tk->hdr.hwndFrom, currentSel);
		}
		break;
	case VK_PRIOR: //select the next page
		{
			TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel+1);
			TabCtrl_SetCurFocus(tk->hdr.hwndFrom,currentSel+1);
		}
		break;
	case VK_RIGHT: //select the next page
		{
			TabCtrl_SetCurSel(tk->hdr.hwndFrom, currentSel+1);
			TabCtrl_SetCurFocus(tk->hdr.hwndFrom,currentSel);
		}
		break;
	case VK_UP: //navagate within selected child tab page
		{
			SetFocus(m_lptc->hTabPages[currentSel]);
			CAuthenticationAddin::TabPageMessageLoop (m_lptc->hTabPages[currentSel]);
		}
		break;
	case VK_DOWN: //navagate within selected child tab page
		{
	           SetFocus(m_lptc->hTabPages[currentSel]);
               CAuthenticationAddin::TabPageMessageLoop (m_lptc->hTabPages[currentSel]);
		}
		break;  
	default: return;
	}
	
}

VOID CAuthenticationAddin::TabControl_GetClientRect(HWND hwnd,RECT* prc)
{
   RECT rtab_0;
   LONG lStyle = GetWindowLong(hwnd,GWL_STYLE); 

   // Calculate the tab control's display area
   GetWindowRect(hwnd, prc);
   ScreenToClient(GetParent(hwnd), (POINT*)&prc->left);
   ScreenToClient(hwnd, (POINT*)&prc->right);
   TabCtrl_GetItemRect(hwnd,0,&rtab_0); //The tab itself

   
   prc->top = prc->top + (6 + rtab_0.bottom-rtab_0.top); //x coord
   prc->left = prc->left + 4; //y coord
   prc->bottom = prc->bottom - (16 + rtab_0.bottom-rtab_0.top); // height
   prc->right = prc->right - 12; // width
   
}


BOOL CAuthenticationAddin::TabCtrl_OnSelChanged(VOID)
{
   stopTabPageMessageLoop = TRUE;
   int curSel = TabCtrl_GetCurSel(m_lptc->hTab);

   //Hide the current child dialog box, if any.
   ShowWindow(m_lptc->hVisiblePage,FALSE);

   //Show the new child dialog box.
   ShowWindow(m_lptc->hTabPages[curSel],TRUE);

   // Save the current child
   m_lptc->hVisiblePage = m_lptc->hTabPages[curSel];

   return TRUE;
}


BOOL CAuthenticationAddin::Notify (LPNMHDR pnm)
{
   // Update m_lptc pointer
   m_lptc = (LPTABCTRL) GetWindowLong(pnm->hwndFrom,GWL_USERDATA);

   switch (pnm->code)
   {
      case TCN_KEYDOWN:
         TabCtrl_OnKeyDown((LPARAM)pnm);
         // fall through to call TabCtrl_OnSelChanged() on each keydown

      case TCN_SELCHANGE:
         return TabCtrl_OnSelChanged();
   }
   return FALSE;
}


VOID CAuthenticationAddin::TabControl_Destroy(LPTABCTRL tc)
{
   for (int i=0;i<tc->tabPageCount;i++)
      DestroyWindow(tc->hTabPages[i]);

   free (tc->hTabPages);
}



BOOL CAuthenticationAddin::StretchTabPage (HWND hTab, INT iPage)
{
   RECT rect;

   // Update m_lptc pointer
   m_lptc = (LPTABCTRL) GetWindowLong(hTab,GWL_USERDATA);

   TabControl_GetClientRect(hTab, &rect); // left, top, width, height

   // Move the child and put it on top
   return SetWindowPos(m_lptc->hTabPages[iPage], HWND_TOP,
         rect.left, rect.top, rect.right, rect.bottom,
         0);

   return FALSE;//TEST
}
BOOL CAuthenticationAddin::CenterTabPage (HWND hTab, INT iPage)
{
   RECT rect, rclient;

   // Update m_lptc pointer
   m_lptc = (LPTABCTRL) GetWindowLong(hTab,GWL_USERDATA);

   TabControl_GetClientRect(hTab, &rect); // left, top, width, height

   // Get the tab page size
   GetClientRect(m_lptc->hTabPages[iPage], &rclient);
   rclient.right=rclient.right-rclient.left;// width
   rclient.bottom=rclient.bottom-rclient.top;// height
   rclient.left= rect.left;
   rclient.top= rect.top;

   // Center the tab page, or cut it off at the edge of the tab control(bad)
   if(rclient.right<rect.right)
      rclient.left += (rect.right-rclient.right)/2;

   if(rclient.bottom<rect.bottom)
      rclient.top += (rect.bottom-rclient.bottom)/2;

   // Move the child and put it on top
   return SetWindowPos(m_lptc->hTabPages[iPage], HWND_TOP,
         rclient.left, rclient.top, rclient.right, rclient.bottom,
         0);

   return FALSE;//TEST
}
VOID CAuthenticationAddin::TabPage_OnSize(HWND hwnd, UINT state, INT cx, INT cy)
{
   // Dummy function when no external on size function is
   // desired.
}

VOID CAuthenticationAddin::New_TabControl(LPTABCTRL lptc,
      HWND hTab,
      LPSTR *tabNames,
      LPSTR *dlgNames,
      BOOL (CALLBACK* ParentProc)(HWND, UINT, WPARAM, LPARAM),
      //BOOL CALLBACK (*ParentProc)(HWND, UINT, WPARAM, LPARAM)
      VOID (*OnSize)(HWND, UINT, int, int),
      BOOL fStretch)
{
   static TCITEM tie;
   m_lptc=lptc;

   //Link struct m_lptc pointer to hTab
   SetWindowLong(hTab,GWL_USERDATA,(long)m_lptc);

   m_lptc->hTab=hTab;
   m_lptc->tabNames=tabNames;
   m_lptc->dlgNames=dlgNames;
   m_lptc->blStretchTabs=fStretch;

   // Point to external functions
   m_lptc->ParentProc=ParentProc;
   /*if(NULL!=OnSize) //external size function
     m_lptc->TabPage_OnSize=OnSize;
     else //internal dummy size function
     m_lptc->TabPage_OnSize=TabPage_OnSize; */


   // Point to internal public functions
   m_lptc->Notify=&Notify;
   m_lptc->StretchTabPage=&StretchTabPage;
   m_lptc->CenterTabPage=&CenterTabPage;

   // Determine number of tab pages to insert based on DlgNames
   m_lptc->tabPageCount = 0;
   LPSTR* ptr=m_lptc->dlgNames;
   while(*ptr++) m_lptc->tabPageCount++;


   //create array based on number of pages
   m_lptc->hTabPages = (HWND*)malloc(m_lptc->tabPageCount * sizeof(HWND*));

   // Add a tab for each name in tabnames (list ends with 0)
   tie.mask = TCIF_TEXT | TCIF_IMAGE;
   tie.iImage = -1;



   for (int i = 0; i< m_lptc->tabPageCount; i++)
   {
      tie.pszText = m_lptc->tabNames[i]; 
      TabCtrl_InsertItem(m_lptc->hTab, i, &tie);

      // Add page to each tab
      if (i==0)
         m_lptc->hTabPages[i] = CreateDialog(g_hinst,
               m_lptc->dlgNames[i],
               GetParent(m_lptc->hTab),
               (DLGPROC)ConfigureSummitDialogProc);
      if (i==1)
         m_lptc->hTabPages[i] = CreateDialog(g_hinst,
               m_lptc->dlgNames[i],
               GetParent(m_lptc->hTab),
               (DLGPROC ) ConfigureRiskDialogProc);
      if (i==2)
         m_lptc->hTabPages[i] = CreateDialog(g_hinst,
               m_lptc->dlgNames[i],
               GetParent(m_lptc->hTab),
               (DLGPROC) ConfigureUtilDialogProc);
      if (i==3)
         m_lptc->hTabPages[i] = CreateDialog(g_hinst,
               m_lptc->dlgNames[i],
               GetParent(m_lptc->hTab),
               (DLGPROC) ConfigureExtDataDialogProc); 

      // Set initial tab page position
      if(m_lptc->blStretchTabs)
         m_lptc->StretchTabPage(m_lptc->hTab, i);
      else
         m_lptc->CenterTabPage(m_lptc->hTab, i);
   }
   // Show first tab
   ShowWindow(m_lptc->hTabPages[0],SW_SHOW);

   // Save the current child
   m_lptc->hVisiblePage = m_lptc->hTabPages[0];
}





HACCEL CAuthenticationAddin::CreateAccTable (VOID)
{
   static  ACCEL  aAccel[1];
   static  HACCEL  hAccel;

   aAccel[0].fVirt=FVIRTKEY;
   aAccel[0].key=VK_ESCAPE;
   aAccel[0].cmd=CMD_VK_ESCAPE;

   aAccel[1].fVirt=FVIRTKEY;
   aAccel[1].key=VK_RETURN;
   aAccel[1].cmd=CMD_VK_RETURN;

   hAccel=CreateAcceleratorTable(aAccel,1);
   return hAccel;
}


void CAuthenticationAddin::TabPageMessageLoop (HWND hwnd)
{
   MSG      msg;
   int      status;
   BOOL handled = FALSE;

   // Create Accelerator table

   HACCEL hAccTable = CAuthenticationAddin::CreateAccTable();

   while((status = GetMessage(&msg, NULL, 0, 0 )) != 0 && !stopTabPageMessageLoop)
   { 
      if (status == -1) // Exception

      {
         return;
      }
      else
      {
         // Dialogs do not have a WM_KEYDOWN message so we will seperate

         // the desired keyboard events here

         handled = TranslateAccelerator(hwnd,hAccTable,&msg);

         // Perform default dialog message processing using IsDialogM...

         if(!handled)
            handled=IsDialogMessage(hwnd,&msg);

         // Non dialog message handled in the standard way.

         if(!handled)
         {

            TranslateMessage(&msg);
            DispatchMessage(&msg);
         }
      }
   }
   if(stopTabPageMessageLoop) //Reset: do not PostQuitMessage(0)

   {
      DestroyAcceleratorTable(hAccTable);
      stopTabPageMessageLoop = FALSE;
      return;
   }

   // Default: Re-post the Quit message

   DestroyAcceleratorTable(hAccTable);
   PostQuitMessage(0);
   return;
}

VOID CAuthenticationAddin::ResetTabPageMessageLoop (HWND hwnd)
{
   //Toggle kill sw
   stopTabPageMessageLoop=TRUE;
   stopTabPageMessageLoop=FALSE;

   SetFocus(hwnd);
   CAuthenticationAddin::TabPageMessageLoop(hwnd);
}


BOOL CAuthenticationAddin::FormMain_OnNotify(HWND hwnd, INT id, LPNMHDR pnm)
{
   switch(id)
   {
      case TAB_CONTROL_1:
         return TabCtrl_1.Notify(pnm);

   }
   return FALSE;
}


void CAuthenticationAddin::FormMain_OnSize(HWND hwnd, UINT state, int cx, int cy)
{
   RECT  rc;
   GetClientRect(hwnd,&rc);

   MoveWindow(TabCtrl_1.hTab,0,0,(rc.right - rc.left)/2-4,rc.bottom - rc.top,FALSE);
   for(int i=0;i<TabCtrl_1.tabPageCount;i++)
      TabCtrl_1.StretchTabPage(TabCtrl_1.hTab,i);

   //Refresh(hwnd);
}
void CAuthenticationAddin::FormMain_OnClose(HWND hwnd)
{
   PostQuitMessage(0);// turn off message loop
   TabControl_Destroy(&TabCtrl_1);

   EndDialog(hwnd, 0);
}


void CAuthenticationAddin::InitHandles (HWND hwndParent)
{
   BOOL initialized=FALSE;
   if(!initialized)
   {
      if (frmMain != hwndParent) frmMain = hwndParent;
      initialized=TRUE;
   }
}

BOOL CAuthenticationAddin::FormMain_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   InitHandles (hwnd); 
   static LPSTR tabnames[]= {"Summit", "Risk", "Utility", "External Data", 0};
   static LPSTR dlgnames[]= {MAKEINTRESOURCE(IDD_SB_DLG),
                             MAKEINTRESOURCE(IDD_RDB_DLG),
                             MAKEINTRESOURCE(IDD_UTILITY_DLG),
                             MAKEINTRESOURCE(IDD_EXTDATA_DLG),0};

   New_TabControl( &TabCtrl_1, //address of TabControl struct
                   GetDlgItem(hwnd, TAB_CONTROL_1), // handle to tab control
                   tabnames, // text for each tab
                   dlgnames, // dialog id's of each tab page dialog
                   &AuthDialogProc, // address of main proc
                   NULL,//&TabCtrl1_TabPages_OnSize, // optional address of size function or NULL
                   TRUE); // stretch tab page to fit tab ctrl
 
   //Get the initial Width and height of the dialog
   //in order to fix the minimum size of dialog
   RECT rc;
   GetWindowRect(hwnd,&rc);
   gMinSize.cx = (rc.right - rc.left);
   gMinSize.cy = (rc.bottom - rc.top);

   return 0;
}

void CAuthenticationAddin::FormMain_OnCommand(HWND hWndDlg, int id, HWND hwndCtl, UINT codeNotify)
{
	static bool warnOnSaveState      = true;
	static DisplayEnum rateDisplay   = REAL_VAL;
	static DisplayEnum spreadDisplay = REAL_VAL;
	static bool keyFileState         = false;
	
	switch(id)
	{
	
	case IDOKSB:
		
		
	case IDCANCELSB :
		
		EndDialog(hWndDlg, IDCANCELSB);
		EndDialog(GetParent(hWndDlg),IDCANCELSB);
		
		break;

		
		//END 
		
		
	case IDOKRDB:
		
		
		
		break;
		
	case IDCANCELRDB :
		
		break;
		
	case IDC_TEST_BUTTON_RDB :
		{
			
		}
		break;
		//END:RISKCOMMANDS
		
		//UTIL COMMANDS
	case IDC_CHECK_KEYFILE :
		{
			
		}
		break;
	case IDC_RATE1 :
	case IDC_RATE2 :
	case IDC_RATE3 :
		rateDisplay = RateDisplayFromButtonID(codeNotify);
		CAuthenticationAddin::GetObject().SetRateDisplay(rateDisplay);
		break;
		
	case IDC_SPREAD1 :
	case IDC_SPREAD2 :
	case IDC_SPREAD3 :
		
		
	case IDOKUTIL:
		
		
		
		break;
	case IDCANCELUTIL :
		
		
	case IDC_TEST_BUTTON_UTIL :
		{
			
		}
		break;
		//END 
		
		//
	case IDOKED:
		
		break;
		
	case IDC_TEST_BUTTON_ED :
		{
			
		}
		break;
	case IDCANCELED :
		
		//END EXTDATACOMMANDS
		
	case IDCANCEL :
		
}

}

//Main dialog box which creates the tabs to hold other dialogs. 

BOOL CALLBACK CAuthenticationAddin::AuthDialogProc(
												   HWND hWndDlg, 
												   UINT message, 
												   WPARAM wParam, 
												   LPARAM lParam)
{
	try
	{
		switch(message) 
		{   
			HANDLE_MSG (hWndDlg, WM_COMMAND, FormMain_OnCommand);
			HANDLE_MSG (hWndDlg, WM_INITDIALOG, FormMain_OnInitDialog);
			HANDLE_MSG (hWndDlg, WM_SIZE, FormMain_OnSize);
			HANDLE_MSG (hWndDlg, WM_NOTIFY, FormMain_OnNotify);
			//HANDLE_MSG (hWndDlg, WM_CLOSE, FormMain_OnClose);
		default:
			return FALSE;
		}
	}
	catch (CBaseException &e)
	{
		CAuthenticationAddin::GetObject().LoggedMessageBox(e, "AuthDialogProc");
	}
	catch(...)
	{
		CAuthenticationAddin::GetObject().LoggedMessageBox("Unexpected exception", "AuthDialogProc");
	}
	
	return TRUE;
}


VOID CAuthenticationAddin::TabPage_OnLButtonDown(HWND hwnd, BOOL fDoubleClick, INT x, INT y, UINT keyFlags)
{
   // If Mouse click in tab page but not on control
   CAuthenticationAddin::ResetTabPageMessageLoop (hwnd);
}

VOID CAuthenticationAddin::SummitTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
	
	
	if(CMD_VK_ESCAPE==id)
	{
		stopTabPageMessageLoop=TRUE; // cause message loop to return
		SetFocus(m_lptc->hTab); // focus to tab control
		//SetFocus(GetParent(hwnd));
		return;
	}
	else if(CMD_VK_RETURN==id)
	{
		//
		// TODO: We may want to handle this
		//  ex: If we are editing a tree view on a tab,
		//  this will make the Enter key work
		//  TreeView_EndEditLabelNow(hTree,FALSE);
		//
	}
	
	if(codeNotify == EN_KILLFOCUS && id == IDC_CONFIG_SERVER_SB) 
	{
		SetServerName(GetDlgItemString(hwnd, IDC_CONFIG_SERVER_SB));
	}
	
	.
	.
	.
	
	
	
	ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}


VOID CAuthenticationAddin::RiskTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
	if(CMD_VK_ESCAPE==id)
	{
		stopTabPageMessageLoop=TRUE; // cause message loop to return
		SetFocus(m_lptc->hTab); // focus to tab control
		//SetFocus(GetParent(hwnd));
		return;
	}
	else if(CMD_VK_RETURN==id)
	{
		//
		// TODO: We may want to handle this
		//  ex: If we are editing a tree view on a tab,
		//  this will make the Enter key work
		//  TreeView_EndEditLabelNow(hTree,FALSE);
		//
	}
	.
	.
	.
	
	
	ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
	
	
}


VOID CAuthenticationAddin::UtilTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
	if(CMD_VK_ESCAPE==id)
	{
		stopTabPageMessageLoop=TRUE; // cause message loop to return
		SetFocus(m_lptc->hTab); // focus to tab control
		//SetFocus(GetParent(hwnd));
		return;
	}
	else if(CMD_VK_RETURN==id)
	{
		//
		// TODO: We may want to handle this
		//  ex: If we are editing a tree view on a tab,
		//  this will make the Enter key work
		//  TreeView_EndEditLabelNow(hTree,FALSE);
		//
	}
	.
	.
	.
	
	
	ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
}

VOID CAuthenticationAddin::ExtTabPage_OnCommand(HWND hwnd, INT id, HWND hwndCtl, UINT codeNotify)
{
	if(CMD_VK_ESCAPE==id)
	{
		stopTabPageMessageLoop=TRUE; // cause message loop to return
		SetFocus(m_lptc->hTab); // focus to tab control
		//SetFocus(GetParent(hwnd));
		return;
	}
	else if(CMD_VK_RETURN==id)
	{
		//
		// TODO: We may want to handle this
		//  ex: If we are editing a tree view on a tab,
		//  this will make the Enter key work
		//  TreeView_EndEditLabelNow(hTree,FALSE);
		//
	}
	.
	.
	
	
	ForwardWMCommand(hwnd,id,hwndCtl,codeNotify);
	
	
}


VOID CAuthenticationAddin::ForwardWMCommand(HWND hwnd, INT id,HWND hwndCtl,UINT codeNotify)
{
	//Forward all other commands to the main dialog box WM_COMMAND
	FORWARD_WM_COMMAND (hwnd,id,hwndCtl,codeNotify,m_lptc->ParentProc);
	
	// Mouse clicks on a control should engage the Message Loop
	
	// If this WM_COMMAND message is a notification to parent window
	// ie: EN_SETFOCUS being sent when an edit control is initialized
	// do not engage the Message Loop or send any messages.
	if(codeNotify!=0) return;
	
	ResetTabPageMessageLoop (hwnd);
	//Toggling WM_NEXTDLGCTL ensures that default focus moves to selected
	//Control (This must follow call to ResetTabPageMessageLoop()) 
	SendMessage(hwnd , WM_NEXTDLGCTL, (WPARAM)0, FALSE);
	SendMessage(hwnd , WM_NEXTDLGCTL, (WPARAM)1, FALSE);
}


/**
 * Dialog procedure for IDD_CONFIG_DLG in configuration mode.
 * This dialog proc sets allows the user to test the host connection,
 * retrieves data when the dialog is closed, updates the settings
 * in the addin and saves them.
 */

BOOL CALLBACK CAuthenticationAddin::ConfigureSummitDialogProc(
															  HWND hWndDlg, 
															  UINT message, 
															  WPARAM wParam, 
															  LPARAM lParam) 
{
	hWndSummit = hWndDlg;
	
	try 
	{
		static bool warnOnSaveState = true;
	
		switch(message) 
		{   
		
			HANDLE_MSG (hWndDlg, WM_COMMAND, SummitTabPage_OnCommand);
			HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
			
		case WM_INITDIALOG:
			{
				
				
				SetDlgItemString(hWndDlg, IDC_SB_USER, username);
				SetDlgItemString(hWndDlg, IDC_SB_PASS, password);
				
				.
				.
				
				
				return DefWindowProc(hWndDlg, message, wParam, lParam);
				
			}
			break;
			
		case WM_HELP :
			
			CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
			
			break;
			
			
		default:
			
			return FALSE;
			//return DefWindowProc(hWndDlg, message, wParam, lParam);
			
		}
	}
	
	
	return TRUE;
	
}

BOOL CALLBACK CAuthenticationAddin::ConfigureRiskDialogProc(
															HWND hWndDlg, 
															UINT message, 
															WPARAM wParam, 
															LPARAM lParam)
{
	std::string d ="";
	long rr=0; 
	try
	{
		static bool warnOnSaveState = true;
		
		switch(message) 
		{        
			HANDLE_MSG (hWndDlg, WM_COMMAND, RiskTabPage_OnCommand);
			HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
		case WM_INITDIALOG:
			{
				.
				.
				.
				return DefWindowProc(hWndDlg, message, wParam, lParam);
			}
			break;
			
		case WM_HELP :
			
			CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);
			
			break;
			
			
		default:
			
			return FALSE;
		}
	}
	return TRUE;
	
}



BOOL CALLBACK CAuthenticationAddin::ConfigureUtilDialogProc(
      HWND hWndDlg, 
      UINT message, 
      WPARAM wParam, 
      LPARAM lParam)
{
   try
   {
      static bool warnOnSaveState = true;
      static DisplayEnum rateDisplay = REAL_VAL;
      static DisplayEnum spreadDisplay = REAL_VAL;
      static bool keyFileState = false;

      switch(message) 
      {        
         HANDLE_MSG (hWndDlg, WM_COMMAND, UtilTabPage_OnCommand);
         HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
         case WM_INITDIALOG:
         {
            .
            .
            .
            
            return DefWindowProc(hWndDlg, message, wParam, lParam);
         }
         break;

         
         case WM_HELP :

         CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);

         break;


         default:

         return FALSE;
      }
   }
   

   return TRUE;
}


BOOL CALLBACK CAuthenticationAddin::ConfigureExtDataDialogProc(
      HWND hWndDlg, 
      UINT message, 
      WPARAM wParam, 
      LPARAM lParam)
{
   try
   {
      static bool warnOnSaveState = true;

      switch(message) 
      {        
         HANDLE_MSG (hWndDlg, WM_COMMAND, ExtTabPage_OnCommand);
         HANDLE_MSG (hWndDlg, WM_LBUTTONDOWN, TabPage_OnLButtonDown);
         case WM_INITDIALOG:
         {
           .
           .
           .
           
           return DefWindowProc(hWndDlg, message, wParam, lParam);
         }
         break;

         case WM_HELP :

         CAuthenticationAddin::GetObject().DoHelp(s_ConfigureDialogHelpContext);

         break;


         default:

         return FALSE;
      }
   }
  
   return TRUE;
}

GeneralRe: Help about Message loop please Pin
reply2am6-May-09 4:34
reply2am6-May-09 4:34 
GeneralRe: Help about Message loop please Pin
serzh836-May-09 5:33
serzh836-May-09 5:33 
QuestionRe: Help about Message loop please Pin
reply2am8-May-09 0:49
reply2am8-May-09 0:49 
AnswerRe: Help about Message loop please Pin
KarstenK8-May-09 1:10
mveKarstenK8-May-09 1:10 
Questiongetting complete file path Pin
MahaKh5-May-09 23:50
MahaKh5-May-09 23:50 
AnswerRe: getting complete file path Pin
Rajesh R Subramanian5-May-09 23:52
professionalRajesh R Subramanian5-May-09 23:52 
GeneralRe: getting complete file path Pin
MahaKh5-May-09 23:58
MahaKh5-May-09 23:58 
AnswerRe: getting complete file path Pin
«_Superman_»5-May-09 23:56
professional«_Superman_»5-May-09 23:56 
GeneralRe: getting complete file path Pin
MahaKh6-May-09 0:02
MahaKh6-May-09 0:02 
GeneralRe: getting complete file path Pin
Divyang Mithaiwala6-May-09 1:55
Divyang Mithaiwala6-May-09 1:55 
QuestionInconstitent CTreeCtrl due to Modal Dialog [modified] Pin
__GJ__5-May-09 23:46
__GJ__5-May-09 23:46 
AnswerRe: Inconstitent CTreeCtrl due to Modal Dialog Pin
Stuart Dootson6-May-09 2:30
professionalStuart Dootson6-May-09 2:30 
GeneralRe: Inconstitent CTreeCtrl due to Modal Dialog Pin
__GJ__6-May-09 4:56
__GJ__6-May-09 4:56 
GeneralRe: Inconstitent CTreeCtrl due to Modal Dialog Pin
Stuart Dootson6-May-09 6:44
professionalStuart Dootson6-May-09 6:44 
GeneralRe: Inconstitent CTreeCtrl due to Modal Dialog Pin
__GJ__6-May-09 20:44
__GJ__6-May-09 20:44 
GeneralRe: Inconstitent CTreeCtrl due to Modal Dialog Pin
__GJ__8-May-09 3:56
__GJ__8-May-09 3:56 
QuestionStatic variable in header file Pin
neupane.keshab5-May-09 23:17
neupane.keshab5-May-09 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.