Home > Software engineering >  MFC another child window operation is the problem of the window
MFC another child window operation is the problem of the window

Time:09-20

Has three window a hide me now, and now how to make the right of the window on the left side of the operation List?

CodePudding user response:

If it is a parent window a child window I... is not operational child window and the child window
I don't know how to in the other one is the right of the CPP has left the List of instance
Add a header file was useless,,,,

CodePudding user response:

The right of the CPP in
the List on the left acquired
The left window to write a function CListCtrl * GetList ();

On the right side of the window can be CWnd * pWnd=FindWindow (right window title, # 32770)

CListCtrl * pList=pWnd - & gt; GetList ();

CodePudding user response:

Oh don't Findwindow??????? I see so-and-so tutorial is give on the right and the left window header file contains in the right of the CPP operation on the left side of the List
But I've included an error error 3 error C2146: syntax errors: lack of ";" () in front of the identifier "cj" d: \ \ my documents \ visual studio users directory 2013 \ projects \ document management, document management, logindlg h 32 1 document management

CodePudding user response:

Wants is not "on the left side of the window header file", is on the left window instance,

If the dialog box (Create) is created can be saved to, App file, available from the App

CodePudding user response:

The main program:
The main program to create dialog window left
Dialog to the left, a member variable to hold the list m_list
Dialog left a member function GetList () (retrun m_list)


The main program to create dialog window right
Dialog right member variable=dialog left. GetList ()

CodePudding user response:

Since both are child Windows, then there must be A parent window, A child window to add A pointer to A child window, B B window to add A pointer to A child window, the parent window is created after the child window to two pointer assignment, and then the child window can be accessed through A pointer class object and function



CodePudding user response:

Parent window before I wrote A child window function call function, then the child window B access pointer to the parent window, and then to call child window of A function, the use is not easy to meet each seed window between calls

CodePudding user response:

Child window to operate under the parent window (including the child window below the parent window) went to the parent window would be better to send a custom message,
Message WPARAP operation type, LPARAM parameters,

Or a Model (for example, the derived class CDocument) direct operation Model, then the Model is responsible for updating the View (CDocument: : UpdateAllViews, etc.),

CodePudding user response:

SendMessage (P1, WM_CHAR, 1, 0);
Then onChar function in processing, easy to understand, processing is still in the window itself, other Windows just send a trigger message,

CodePudding user response:

Through the parent window operation child window
In the parent window redefine A pointer to A window *;
Pointer to the parent window defined in B window * p_main; Also can pointer to the parent window is defined as a global variable
Call p_main - & gt; A - & gt; XXXX ();

CodePudding user response:

It doesn't matter with the window (though you can use Windows window message operation), you can be in class contains another kind of object pointer, a member function can be directly call each other,

CodePudding user response:

1. If the two Windows are of the same program, on the right side of the window can be (PsotMessage or SendMessage) by means of sending messages through the left side of the window; On the left side of the window to receive the message, the message receiving function to the List control, if they are sent to the parent window child Windows, child window and has passed the GetParent () function to get the window of the parent window a pointer,
2. If two window is a separate program, through interprocess communication methods for data through:
(1) the sharing memory way
(2) the way of system messages sent
(3) Socket network communication way
If I need to pass data is commonly Shared memory system message: data is written to the right side of the window to the Shared memory, and then send the left side of the window system messages; On the left side of the window to receive system messages, receive messages in the system function reads the Shared data in memory and are displayed in the list,

CodePudding user response:

Windows message, or directly use to access the window object pointer

CodePudding user response:

Initialization time, to save List pointer window on the left to the right window, and then, on the right side of the operation of the pointer to a List of the window
  • Related