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. SendMessage() to a tabbed dialog

SendMessage() to a tabbed dialog

Scheduled Pinned Locked Moved C / C++ / MFC
2 Posts 2 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.
  • T Offline
    T Offline
    Trevy
    wrote on last edited by
    #1

    I created a tabbed dialog (with 2 tabs) without property sheets. I created a menu on the main dialog that I want to associate with one of the tabs of the tabbed dialog. I want to convert temperature on the embedded dialog to a celsius value when selecting the option from the menu. I have an error when using the SendMessage function. The commented statements are different ways I have attempted to send a message but they are incorrect. A pointer references each embedded dialog. Following this function are excerpts from my code (main dialog file, embedded dialog file). Does anyone have any suggestions? void CMotionAnalyzerDlg::OnTemperatureCelsius() { /* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/ //m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0); /* errorC2664: caanot convert parameter 1 from _3DSEmbeddedDialog* to UINT */ //SendMessage(m_dPointer[0], WM_MENU_CELSIUS); /* errorC2664: caanot convert parameter 1 from HWND to UINT */ //SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS); } --------------------------------------------------------------------------------------- //MAIN DIALOG HEADER FILE class CMotionAnalyzerDlg : public CDialog { public: ... MoteDataDlg moteDataDlg; //mote data dialog object (embedded) DatabaseDlg databaseDlg; //database dialog object (embedded) void ShowEmbeddedDialog(int number); //shows the proper embedded dialog CTabCtrl dialogTabCtrl; //Create instance of the child window class; tab control for embedded dialogs ... protected: // Generated message map functions ... afx_msg void OnTemperatureCelsius(); DECLARE_MESSAGE_MAP() private: CRect embeddedDialogRect; //structure to hold the position of child windows _3DSEmbeddedDialog *m_dPointer[2]; //Create and assign pointers to each window ... }; ----------------------------------------------------------------------------------------- //MAIN DIALOG .CPP FILE BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog) ... ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius) END_MESSAGE_MAP() BOOL CMotionAnalyzerDlg::OnInitDialog() { ... //Create all embedded dialogs for the main window class moteDataDlg.Create(IDD_MOTE_DATA_DIALOG, this); databaseDlg.Create(IDD_DATABASE_DIALOG, this); ... } //Shows the proper embedded dialog void CMotionAnalyzerDlg::ShowEmbeddedDialog(int number) { int window

    P 1 Reply Last reply
    0
    • T Trevy

      I created a tabbed dialog (with 2 tabs) without property sheets. I created a menu on the main dialog that I want to associate with one of the tabs of the tabbed dialog. I want to convert temperature on the embedded dialog to a celsius value when selecting the option from the menu. I have an error when using the SendMessage function. The commented statements are different ways I have attempted to send a message but they are incorrect. A pointer references each embedded dialog. Following this function are excerpts from my code (main dialog file, embedded dialog file). Does anyone have any suggestions? void CMotionAnalyzerDlg::OnTemperatureCelsius() { /* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/ //m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0); /* errorC2664: caanot convert parameter 1 from _3DSEmbeddedDialog* to UINT */ //SendMessage(m_dPointer[0], WM_MENU_CELSIUS); /* errorC2664: caanot convert parameter 1 from HWND to UINT */ //SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS); } --------------------------------------------------------------------------------------- //MAIN DIALOG HEADER FILE class CMotionAnalyzerDlg : public CDialog { public: ... MoteDataDlg moteDataDlg; //mote data dialog object (embedded) DatabaseDlg databaseDlg; //database dialog object (embedded) void ShowEmbeddedDialog(int number); //shows the proper embedded dialog CTabCtrl dialogTabCtrl; //Create instance of the child window class; tab control for embedded dialogs ... protected: // Generated message map functions ... afx_msg void OnTemperatureCelsius(); DECLARE_MESSAGE_MAP() private: CRect embeddedDialogRect; //structure to hold the position of child windows _3DSEmbeddedDialog *m_dPointer[2]; //Create and assign pointers to each window ... }; ----------------------------------------------------------------------------------------- //MAIN DIALOG .CPP FILE BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog) ... ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius) END_MESSAGE_MAP() BOOL CMotionAnalyzerDlg::OnInitDialog() { ... //Create all embedded dialogs for the main window class moteDataDlg.Create(IDD_MOTE_DATA_DIALOG, this); databaseDlg.Create(IDD_DATABASE_DIALOG, this); ... } //Shows the proper embedded dialog void CMotionAnalyzerDlg::ShowEmbeddedDialog(int number) { int window

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      Trevy wrote:

      /* linking error ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));*/ //m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0);

      This means that tabbed window you are talking about, is not considered as window, thats why ASSERT.

      Trevy wrote:

      /* errorC2664: caanot convert parameter 1 from HWND to UINT */ //SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS);

      You need to modify this to,

      ::SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS,0,0);

      But, again it should be valid window.. p.s. Its better to divide problem in small sub problem. Nobody like to read such huge code, like me( posted without using <pre> tags).

      Prasad Notifier using ATL | Operator new[],delete[][^]

      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