MFC starts learning

xiaoxiao2021-03-05  49

I hate VB, but I found a pile of processes with VB and made another small project. . .

I want to learn Java, but unfortunately I have been studying after the company's two months, there is no chance to say. . .

I felt that MFC didn't have a future, then, how do I learn it now? Well, one is related to the work in the future, the future work, definitely inseparable from D3D and WinsDK, and if it is programmed under Win, I don't want to learn MFC. Second, if you do a little bit of Dongdong, write more pain with SDK, it is better to use MFC. The third is to learn MFC bitter, but just give the self-adding pressure, otherwise use C # to drag two down interface, then write one or download a DLL of the image processing, it seems to finish it finished and did not do It feels not bad. . . So, simply has been suffering from it :)

Learning things is quite happy, I haven't studied all day long today, but it is really full, it seems that I haven't been this feeling, and my little happy is too long, my heart should be returned, it is not easy. When I just received it, I was really bored, but after returning to the track, I have new fun, new concerns, new clothes. . . . Irrigation, game, blog, reading articles, chatting with friends, learning technology. . .

Well, put some Some of the past, there is time, you can also look at it, learn the MFC, the best way, or look at the code, then look at the book, you will enter those details, simply look at the book, That is the feeling of watching MFC on the first day. It's okay now, probably understand those stuff, at least it will not be scared by the variable of the BT :)

In the MFC, M $ introduces the concept of document-viewing structure, the document is equivalent to the data container, and the window that views the data is displayed or the window interacts with the data. (This structure is in the MFC OLE, and the ODBC development is more expanded) so a complete application is generally consisting of four classes: CWINAPP application classes, CFrameWnd window frame classes, cDocument document classes, CView view class. (Support for VC6 without document - Application)

CWINAPP will create a CFrameWnd Framework window instance when the program is running, and the Frame window will create a document template, then have a document template to create a document instance and view instance, and associate both. Generally speaking, we only need to operate documents and visual operations, and the various behaviors of the framework have been arranged by MFC without human intervention. This is also the intention of M $ design document - the spiritual structure, let us pay attention to finish The task is discharged from the interface writing. One document is applied to the application, but a document can contain multiple views. Only one frame window is used in an application, and there may be multiple MDI sub-windows for multi-document interfaces. Each look is a sub-window, the parent window in a single document interface is a frame window, in the multi-document interface, the parent window is the MDI sub-window. A multi-document application can contain multiple document templates, one template defines a correspondence between a document and one or more views. The same document can belong to multiple templates, but only one document is allowed in a template. The same approach can also belong to multiple document templates. (I don't know if I said clearly)

Next, look at how to get a pointer to various objects in the program:

Global Functions AFXGetApp You can get the CWINAPP application class pointer AFXGetApp () -> m_pmainwnd is in the Frame window pointer in the frame window: cfraMew :: getActiveDocument Get the current activity document pointer in the frame window: cframeWnd :: getActiveView gets the current activity Picture pointer in the view : CView :: getDocument Get the corresponding document pointer in the document: cdocument :: getFirstViewPosition, cdocument :: getNextView is used to traverse all and document associations. In the document: cdocument :: getDocTemplate Get the document template pointer in multiple document interfaces: cmdiframeWnd :: MDiGetAn gets the current active MDI sub-window

Generally speaking, users enter messages (such as menus selection, mouse, keyboard, etc.) will be forwarded, if they are not processed, they will be sent to the Frame Window. So defining a message mapping is defined in the view, if an application has multiple views while the current activity does not process the message, the message will be sent to the frame window. ODBC: OPEN DATABASE CONNECTIVITYMFC ODBC: Microsoft FoundDation Class Odbcdao: Data Access Objectole DB: Object Link and Embedding Database

转载请注明原文地址:https://www.9cbs.com/read-34559.html

New Post(0)