Home > Software engineering >  MFC documentation procedures, in the view of create a timer which is how to distinguish between his
MFC documentation procedures, in the view of create a timer which is how to distinguish between his

Time:09-22

I use the settimer create timer

Create a timer is belong to the view in the view, create a new view will create a timer at the same time, the timer can you as a member of the view

For example:
To create a multiple document procedure, xxxview inheritance in CRichEditView, I think timing output in multiple view "hello world the view1" or "hello world view2",,,
How do I know what is in the onTimer function view
How do I in the onTimer function call xxxview: : printfCString (print function), direct use, or to get the pointer to the view

Multiple view will produce multiple ON_WM_TIMER message

If you can't I how to achieve timing in the view?

CodePudding user response:

# define AFX_IDW_PANE_FIRST 0 xe900//first pane (256 Max)
# define AFX_IDW_PANE_LAST 0 xe9ff

PView=(CMyView *) CreateView (& amp; PCreateContext AFX_IDW_PANE_FIRST);

AFX_IDW_PANE_FIRST is The ID number of a view , GetWindowLong (HWND, GWL_ID) can get The ID

CodePudding user response:

reference 1st floor schlafenhamster response:
# define AFX_IDW_PANE_FIRST 0 xe900//first pane (256 Max)
# define AFX_IDW_PANE_LAST 0 xe9ff

PView=(CMyView *) CreateView (& amp; PCreateContext AFX_IDW_PANE_FIRST);

AFX_IDW_PANE_FIRST is The ID number of a view , GetWindowLong (HWND, GWL_ID) can get The ID

I am so written, open the document, create a new view
In the app definition CMultiDocTemplate * pDocPage;
PApp xxxDoc * pDoc=(xxxDoc *) - & gt; PDocPage - & gt; OpenDocumentFile (NULL);
My_view=(xxxView *) pDoc - & gt; GetView (RUNTIME_CLASS (xxxView));
Not the CreateView

CodePudding user response:

Start the timer when the SetTimer at window is WM_TIMER message at the window, so in the View of normal start timer belongs to View itself
Data should be used in the normal View from the Doc to

CodePudding user response:

Int ViewID=GetWindowLong (my_view - & gt; M_hWnd, GWL_ID);
Can distinguish between
  • Related