MFC file operations, mfc files
File Operations: differences between binary files and text files. The binary file moves the data in the memory mode to the file, while the text file moves the asc code of the data to the file.First, make a menu for reading and writing files and respond to1. C method:Fwrite:Size: Item size in bytes number of bytes written each timeCount: Maximum number of items to be written, w
I have been learning self-painted controls (MFC) since the beginning of this semester. The goal is to make a player interface, mainly to lay a good foundation, because my infrastructure is really bad .... let's talk about my own experiences and methods of self-painted controls. It's a bit of a joke, something wrong or incomplete, or something better. Please don't hesitate to give me some advice.My machine environment is: Windows 7 flagship Service Pac
C ++ MFC file opening process, mfc file opening process
To open a file, follow these steps:
The "Open File" dialog box is displayed. Click "get selected file" and display the file in the view.
We often need to customize the procedure in the program as follows:
1. Customize the pop-up file dialog box. For example, you need to modify the type or extension of the opened file.2. Custom file display behavior3. C
Before creating an MFC (DLL) project, we need to download MATCOM.ProgramInstall, open vc6.0, open tool-custom-additional items, and select visual MATCOM add-in. After the installation is successful, it will be displayed on the vc6.0 toolbar.
Start our project:
(1) Open vc6.0 and create an MFC (DLL) project. Then click the M ++ button on the toolbar to add the edited. M file.
(2) Click the FileView vie
MFC Small Program:First, in MFC simple use of the WebBrowser ActiveX plugin method:See blog: http://blog.csdn.net/supermanking/article/details/5866213Second, create a view in the dialog box (I'm creating a scrolling view here):See blog: http://blog.csdn.net/clever101/article/details/4873994http://blog.csdn.net/clever101/article/details/3779089Third, create the control dynamically. and add a message response
1. MFC DLL
(1) Create a project, create an Arbitrary dialog box test program;
(2) Create an # include "ExpertFunc.h"
#pragma once#include "MakeDLL.h" There's a problem with this method.CWnd * InitData (CWnd * pwnd/* Parent window pointer, passed in by the caller, typically the main dialog box */){Afx_manage_state (AfxGetStaticModuleState ());Makedll * Pdlg = new Makedll;if (Pdlg->create (Makedll::idd, Cwnd::fromhandle (Pwnd->getsafehwnd ()))){Pdlg->se
How to modify the icon of the MFC publishing program and the mfc publishing icon
(1) The first method is to directly replace the ico icon under res in the project path and re-compile it. Generally, the system must be restarted to take effect;
(2) Method 2: add an ICO resource under the ico in the vs project resource preview window, named IDR_ICON1, and modify the constructor statement m_hIcon = AfxGetAp
MFC no blinking hidden window, mfc flashing window
You need to hide the window program today, but if you are in OnInitDialog (), write:
ShowWindow (SW_HIDE );
It is invalid because it is an initialization window function. That is to say, this function is called when the window is not displayed. Therefore, there is no window handle, so it cannot be hidden.
I found a solution on the internet today to solv
MFC: simple use of CImage in MFC; use of mfccimage
First, set # include
I. image loading
If you want to display an existing image on the interface, you need to load the image to the CImage object. CImage provides four loading functions:
HRESULT Load (LPCTSTR pszFileName) throw ();
HRESULT Load (IStream * pStream) throw ();
Void LoadFromResource (HINSTANCE hInstance, LPCTSTR pszResourceName) throw ();
Void
MFC technology accumulation-based on the MFC dialog box Class 3.
3.3.2Create Image painter to load bitmap
1. First, import a bitmap in the Resource View. The bitmap size is 96 × 96 pixels;
2. In the main dialog box, add a static text resource with the IDC_BITMAPAREA ID and a button resource with the IDB_LOADBITMAP ID;
3. Edit the message Association function of the button (IDB_LOADBITMAP), 3.6:
Note that t
; Infoheader= (bmi->Bmiheader); Palette= bmi->bmicolors; //calculating the size of a graph data byteBytessize = (Infoheader->biwidth * infoheader->biheight * (infoheader->bibitcount/8)); //Open Bitmap data memory blockImageData =NewUnsignedChar[Bytessize]; //reading bitmap data blocksFread (Imagedata,bytessize,1, ImageFile); //gets the specified windowcwnd* Mywnd =GetDlgItem (Idc_bitmaparea); //creates the DC associated with the specified windowcclientdc DC (Mywnd); RECT RC; //ge
Mfc usb flash disk detection and mfc Detection
WM_DEVICECHANGE message
Read MSDN and learn:
The framework calls this member function to notify an application or device driver of a change to the hardware configuration of a device or the computer.
That is, the Framework calls this function to notify the application or device driver that the hardware configuration or computer configuration has been ch
color - + //Pdc->setbkmode (TRANSPARENT);//Set Background Transparency - + } A at //TODO: If the default is not the desired brush, another brush is returned - - returnHBR; - -}In addition to setting the color and background of a static control, the OnCtlColor function applies to several types:Ctlcolor_btn Button controlsCtlcolor_dlg dialog boxCtlcolor_edit edit BoxCtlcolor_listbox List controlCtlcolor_msgbox Message ControlCtlcolor_scrollbar scroll bar controlCtlcolor_s
The use of MFC. BSC to read the source code can provide a lot of convenience, the following describes the usage
1. Open a project as needed. If you do not open the project, the source browser option is not available in the tool menu.
2. Open the previous articleArticleIn the mentioned MFC. BSC (or a self-generated file), you can select the type BSc in the open dialog box, so that you can quickly find it
Copyright Notice
Respect Original Works. Reprinted, please maintain the integrity of the article, and in the form of a hyperlink to indicate the original author "tingsking18" and the main site address, so that other friends can ask and correct.
Mixed MFC and QT programming-use QT components in the MFC Program
1.
Create a simpleMFC DialogProgram.
2.
InBool ctestapp: initinstance ()Add to functionQmfc
and displayed,Set as Wizard modeCPropertySheet::SetWizardMode3.2.2 Set the wizard button for each page, in Cpropertypage::onsetactive ()virtual function in the Set Wizard button.Cpropertypage::getparent-gets the parent window of the pageCpropertysheet::setwizardbuttons-Setup Wizard button3.2.3 Processing CPage11 binding member variables to controls2 Add Wm_initdialog Message handler function, add City option to function3 in the virtual function Onwizardnext function of CPage1, the null judgment
The CFileFind class has been mentioned in the previous blog and is used to delete any folder.
One problem during file replication is that I have been entangled for a long time. The member functions of the CFileFind class, GetFilePath () and GetFileName (), are actually two very well understood functions, one is the file path and the other is the file name. However, I made a mistake in understanding that the file path does not contain the file name, such as the file C:/Test/1.txt, so what is its
now the tutorial can go to the chicken Peck Rice programming class to learn, the reading experience is better, more suitable for online learning. Chicken Peck Rice This set of VS2010/MFC programming introductory tutorial is complete, although some of the content has not yet been covered, but to help you vs2010/mfc to get started learning is enough. Based on the knowledge of this tutorial, learning vs2010/
Chicken Peck Rice This set of VS2010/MFC programming introductory tutorial is complete, although some of the content has not yet been covered, but to help you vs2010/mfc to get started learning is enough. Based on the knowledge of this tutorial, learning vs2010/mfc more in-depth content is not difficult. As the last lesson of this tutorial, the chicken Peck rice
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.