1: Fatal Error C1010: Unexpected End Of File While Looking For PreCompiled Header Directive How to Solve If the error occurs, it is caused by other C code files to enter the current project, then Alt F7 enters the current project settings, select C / C tab, select Precompiled Headers from the Category Combination box, select NOT USING Precompiled Headers. Determine if the file that has occurred is originally in this project, check the file header has a #include "stdafx.h" statement, no words. If you can't still, it is also possible to be a defined class or structure, etc. 2: Fatal Error RC1015: Cannot Open include file 'AFXRES.H'. How to solve the #include "afxres.h" statement is in the .rc file, and the AFXRES.H file in the VC installation directory ./vc98 In / mfc / include directory, you will find that the path in the Directories in the Tools dialog box in the Tools menu is correct, whether it is in the installation path of the VC, not, change, if this is no problem, then To copy AFXRES.H in other machines to the corresponding directory 3: DLL allocated memory block, application release, and results report. With GlobalAlloc () instead of New, use globalfree () instead of DELETE, there is still a way to change the C / C tab of the DLL's Settings Code Generation to Debug Multithreaded DLL. In the Release version, change to Multithreaded DLL, you can use new and delete directly, no problem, compare the specification point, is generally the DLL allocated memory by DLL release. Add a function in DLL to release the memory is not better. 4: I found that the graphic of the print preview is obvious than the screen display graphic, what should I do? In the default, this is the default state, and the MM_Text mode is selected. Therefore, it causes the same pattern to be smaller during printing. Solution is to uniformly use other fixed length mapping patterns, such as MM_HIMETRIC, etc. (CDC :: setmapmode () change mapping mode) 5: cstring, char *, string, int, mutual conversion, _BSTR_T, CTIME, COLEDATETIME, etc. How to determine a string is a floating point number?
#include
{CString strcstring = "abc"; char strchar [256], * pstr; pstr = (lpctstr) strcstring; // cstring ----> char * struct (strchar, (lpstr) (lpctstr) strcstring; // cstring ----> char [] _BSTR_T strbstr = pstr; // char * ----> _ bstr_t wchar * strwchar = strbstr; // b_STR_T ---> unicodestrbstr = strwchar; pstr = strbstr; // unicode ----> Char *
STRCSTRING = "10"; int istr = atoi ((lpctstr) strcstring); // cstring, char [], char * ------> int strcstring.format ("% d", istr); // int -----> CString Sprintf (StrChar, "% D", ISTR); // int -----> char [] pstr = new char [256]; // String application space STRCPY PSTR, "ABC"); // string assignment delete [] pstr; // string release string strstring = "abc"; pstr = (char *) strstring.c_str (); // string ----> char *
STRCSTRING = "2003-10-27 6:24:37"; // cstring ---> COLEDATETIME COLEVARIANT VTIME (STRCSTRING); vTIME.CHANGETYPE (VT_DATE); COLEDATETIME TIME4 = VTIME;
COLEDATETIME TIME1 (1977, 4, 16, 2, 2, 2); // ColedataTime ---> CTIME SystemTime SystemTime; VariantTimetosystemTime (Time1, & System); CTIMETM (SYSTIME);
Time_t Time2 = Tm.gettime (); // ctime ---> Time_t ColedateTime Time3 (Time2); // Time_t ---> COLEDATETIME
/ / Decision is whether the string is some type of CString Svalue ("123.1"); Colevariant Vvalue (SVALUE); Bool Bstrisfloat = (Succeeded (VariantchanGetty, & Vvalue, 0, Vt_R8)) && svalue.find (') && svalue.find (') ! = -1); if (bstrisfloat) {AFXMessageBox ("floating point");}}
6: How to build a Unicode application?
Establish an app, open the Alt F7 Settings option, select the C / C tab, plus _unicore in the Preprocessor Definenation, in the Link tab, select Output in the Category selection box, in the Entry-Point Symbol Editing box Add WWINMAINCRTSTARTUP to determine.
Note When you debug a Unicode program, you need to select all options at the time of installation, otherwise the dynamic library and the corresponding .lib file will be missing.
7: ADO operation database table, update problems before opening the database, add the following statement to try PRECORDSET-> CURSORLOCATION = aduseclient;