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
T

Trevy

@Trevy
About
Posts
7
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to create a Line graph
    T Trevy

    I have to create a line graph on a tabbed dialog. I am a beginner. I have searched the Internet, but I am not sure how to start. Can someone direct me in the right direction? Thanks

    Trevy

    C / C++ / MFC

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

    C / C++ / MFC

  • Accessing menu options from an embedded dialog
    T Trevy

    Still having problems. I know this should be simple, however, this is the second day I have been working on this problem and I still cannot seem to solve the problem. Thank you for your help or I would not have gotten this far. Thanks to Judy also. void CMotionAnalyzerDlg::OnTemperatureCelsius() { //m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0); SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS); } In the function OnTemperatureCelsius() of the main dialog, if I use the statement SendMessage(m_dPointer[0]->m_hWnd, WM_MENU_CELSIUS); I get error C2664: CWnd::SendMessageA: cannot convert parameter 1 from HWND to UINT. m_dPointer[0] refers to the embedded dialog (moteDataDlg). I tried an alternate statement that I saw when searching for an answer. If I use the statement m_dPointer[0]->SendMessage(WM_MENU_CELSIUS,0,0), my application compiles but do not run. Also, I am using the WindowProc correctly in my embedded dialog (moteDataDlg), I use LRESULT for the return value, initially, I used void. In the header file I declared: protected: LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); LRESULT MoteDataDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message==WM_MENU_CELSIUS) { celsiusFlag = !celsiusFlag; AfxBeginThread(MyThreadProc, this); } return 0; }

    Trevy

    C / C++ / MFC

  • Accessing menu options from an embedded dialog
    T Trevy

    Thanks Lucy for your help. I am a beginner using MFC and I am still having problems with the concept of using messages. Can you tell me what I am doing wrong. I am getting the error C3861: 'WM_MENU_CELSIUS' identifier not found, even with argument-dependent lookup In my header file: // Create and assign pointers to each embedded window _3DSEmbeddedDialog *m_dPointer[2]; In my .cpp file for main dialog: BEGIN_MESSAGE_MAP(CMotionAnalyzerDlg, CDialog) ...... ON_COMMAND(ID_TEMPERATURE_CELSIUS, OnTemperatureCelsius) WM_MENU_CELSIUS() END_MESSAGE_MAP() //2 embedded dialogs. Celsius temperature should display in the //moteDataDlg dialog box m_dPointer[0] = &moteDataDlg; m_dPointer[1] = &databaseDlg; void CMotionAnalyzerDlg::OnTemperatureCelsius() { SendMessage(m_dPointer[0], WM_MENU_CELSIUS); } In my .cpp file for embedded dialog moteDataDlg: void MoteDataDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { if (message==WM_MENU_CELSIUS) { celsiusFlag = !celsiusFlag; AfxBeginThread(MyThreadProc, this); } } Thanks for taking the time to help me.

    Trevy

    C / C++ / MFC

  • Accessing menu options from an embedded dialog
    T Trevy

    I am still having problems creating an application using menus. I created a dialog based application that has an embedded dialog in the main dialog. The embedded dialog contains two tabs, one tab displays a dialog showing temperature readings (among other things), the other tab displays database values. I placed a menu on the main dialog. When I select celsius from the menu of the main dialog I want the celsius value to display on one of the embedded dialogs. I have tried different strategies, but none seem to work. I tried to use the ON_COMMAND function, but I am not getting any results. My code works if I put buttons on the embedded dialog, however, I want to use the menu resource instead of buttons. Specifically, I select celsius from the menu of the main dialog, I want the raw units currently displayed in the embedded dialog to be changed to celsius values. Any suggestions will be appreciated. Thanks

    Trevy

    C / C++ / MFC

  • Associate menu with dialog boxes on a tab control
    T Trevy

    I created an application that contains a dialog box and a menu. This dialog box contains a tab control with two tabs. Each tab contains a dialog box. How can I associate the menu with the dialog boxes on the tab control? Thanks

    Trevy

    C / C++ / MFC question

  • set color in list control
    T Trevy

    I am a beginner in using a list control. Could someone direct me in how to set the color of the cells (I hope this is the correct terminology) containing the column names in the list control, as well, setting the color of the first cell in each row. The color will be blue. Thanks

    Trevy

    C / C++ / MFC tutorial learning
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups