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. small doubt

small doubt

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
    Tripura K
    wrote on last edited by
    #1

    Hi all i have void MyDialog::OnButton56() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 56, 1); pView->SendMessage(WM_CHAR,56,1); pView->SendMessage(WM_KEYUP, 56, 1); } void MyDialog::OnButton57() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 57, 1); pView->SendMessage(WM_CHAR,57,1); pView->SendMessage(WM_KEYUP, 57, 1); } void MyDialog::OnButton48() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 48, 1); pView->SendMessage(WM_CHAR,48,1); pView->SendMessage(WM_KEYUP, 48, 1); } where my dialog box is created in the frame and i am getting the pointer of view from CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); but i a creating it in each and every fuction which i don't want to do so i was trying to create in the Dialogs constructor so that too it to the CWnd pointer which is parent for all what do i needto write in the constructor ofthe dialog MyDialog::MyDialog(CWnd* pParent,CWnd* pView) : CDialog(MyDialog::IDD, pParent) { //pView =(CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); } Request to all to continue this

    J 1 Reply Last reply
    0
    • T Tripura K

      Hi all i have void MyDialog::OnButton56() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 56, 1); pView->SendMessage(WM_CHAR,56,1); pView->SendMessage(WM_KEYUP, 56, 1); } void MyDialog::OnButton57() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 57, 1); pView->SendMessage(WM_CHAR,57,1); pView->SendMessage(WM_KEYUP, 57, 1); } void MyDialog::OnButton48() { CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); pView->SendMessage(WM_KEYDOWN, 48, 1); pView->SendMessage(WM_CHAR,48,1); pView->SendMessage(WM_KEYUP, 48, 1); } where my dialog box is created in the frame and i am getting the pointer of view from CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); but i a creating it in each and every fuction which i don't want to do so i was trying to create in the Dialogs constructor so that too it to the CWnd pointer which is parent for all what do i needto write in the constructor ofthe dialog MyDialog::MyDialog(CWnd* pParent,CWnd* pView) : CDialog(MyDialog::IDD, pParent) { //pView =(CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); } Request to all to continue this

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      Tripura.K wrote: CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView(); :eek:What is this? It is a guess based on the knowlege that only a certain view type will be a parent to this dialog. It also suggest.........(never mind)

      // makes no since
      MyDialog::MyDialog(CWnd* pParent,CWnd* pView)
      : CDialog(MyDialog::IDD, pParent)
      {
      //pView =(CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
      }

      // This assumes it is a modal dialog and the view does not change,
      MyDialog::MyDialog(CWnd* pParent,CWnd* pView)
      : CDialog(MyDialog::IDD, pParent)
      {
      m_pView = pView;
      }

      Simplify... all the function do the same thing.

      void MyDialog::MyButton(TCHAR ch)
      {
      // ... write code here one time
      }

      void MyDialog::OnButton56()
      {
      MyButton(56);
      }

      void MyDialog::OnButton57()
      {
      MyButton(57);
      }

      INTP

      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