Write the program in C + +, must use the precompiled header file, is that
stdafx.h.But I always thought that if you included stdafx.h in a. cpp file, you used the precompiled header file, but that's not true.
in VC + +, the precompiled header file refers to the header file placed in the stdafx.h to be effective.
are as follows:
File:stdafx.h
Copy Code code as follows:
Stdafx.h:include file for standard system include files,
or pro
In the VC program How to end the system is running other processes (the process must have a window interface), in fact, very simple, as the following steps can be:
1. Obtain the handle of the process (obtained by using the FindWindow function);
2. Get process ID number (obtained by GetWindowThreadProcessId function);
3. Open the process, the first parameter in the OpenProcess function is set to Process_terminate, you can get the handle that handles th
VC We often use the shortcut keys, there are a variety of shortcut keys, including Menu,button. There is also a distinction between local and global, where local functions are effective when the current program has the focus (activated), and global, which is effective at all times, and test local priority over global, That is, if the shortcut key for the active window overlaps the shortcut key of the inactive window, the current active window priority
To start another application in the application, there are 3 functions to use, and I'll talk about them (I'll open the Zeecalls.exe application in the D:\Program files\zeecalls\ directory for example):
1, WinExec
This function is the simplest, with only two parameters, and the prototype is as follows:
UINT WinExec (LPCSTR lpCmdLine,//Address of commandUINT ucmdshow//window style for new application);
Use the following methods:
WinExec (_t ("D:\\Program files\\zeecalls\\zeecalls.exe"), sw_showmax
VC + + connection Fanuc machine tool real-time data acquisition using FOCAS4.0 version of the development library
FoCas protocol, tested successfully on HSSB's fanuc15i.
int main (int argc, char *argv[]) {if (ARGC {fprintf (stderr, "Usage:%s + optional \ n", argv[0]);Exit (1);} unsigned short hfanuc;Short Fanret, Funcret; Do we have a handle + did function succeed?Odbst Fanbuf; CNC StatusOdbact Spspeed; Spindle speed (selected spindle)ODBACT2 Spspee
It's been a long time. Finally, I have finished the problem of the conversion of the date format, and share my little experience here, hehe
The database I use is SQL Server2005, and there is a type of smalldatetime data in the database table to store the departure time (for example: 2010-1-1 10:00:00)
Request in VC + + to extract the time and compare with the current system time, Judge size
void Csaledlg::onbtnsurebuy (){Todo:add your control notific
:: Is the "scope decomposition operator" in C + +. For example, declaring a Class A, Class A declares a member function VOIDF (), but does not give the definition of F in the declaration of the class, then the definition of f in the class is written as Voida::f (), which means that the F () function is a member function of Class A.:: There is generally a use, is directly used in the global function before, the expression is a global function. When a member function of a class has the same name a
VC + + Get OS Version (excerpt from MSDN)
#include #include
BOOL displaysystemversion (){Osversioninfoex OSVI;BOOL Bosversioninfoex;
Try calling GetVersionEx using the OSVERSIONINFOEX structure.//If that fails, try using the OSVERSIONINFO structure.
ZeroMemory (OSVI, sizeof (OSVERSIONINFOEX));osvi.dwosversioninfosize = sizeof (OSVERSIONINFOEX);
if (!) ( Bosversioninfoex = GetVersionEx ((OSVERSIONINFO *) OSVI)){If Osversioninfoex doesn ' t work, try o
For some cases of running VC program, there will be no user through the title bar on the Close button to close the window, you will find that this time the program's Turn off button turned gray is not available, from the taskbar can not close the window, the menu is also gray, very good to prohibit the window off function, if you want to close, You can press the shortcut key "Alt+f4" on your keyboard or end a task through Task Manager. Here is a descr
For many programmers, SQLite is no stranger. SQLite is a major open source database for embedded, can be integrated in its own desktop program, can also replace access as a background database. SQLite supports most SQL92 standards, such as indexing, throttling, triggering, and viewing support, support for NULL, INTEGER, Real, TEXT, and BLOB data types, and supports transactions. Here are some simple uses of SQLite.
Establish database
c:\sqlite-3_6_11> Sqlite3.exe dbname.db
When you
This paper describes an example of VC to realize Gobang game, the algorithm uses Minimax pruning game algorithm, interested readers can modify and improve the imperfect part of the program.
This design mainly includes: data structure, valuation function, victory and defeat judgment, search algorithm
The program running interface is as follows:
The following steps are implemented:
1. Data structure
Record each move, you can establish a li
This paper briefly introduces the two ways to achieve the height of the task bar VC, the specific code as shown below, the reader can choose according to their own needs or improve the modification.Method One:
Trect RT;
SystemParametersInfo (Spi_getworkarea, 0, rt, 0);
The taskbar is below the height
int y =:: GetSystemMetrics (Sm_cyscreen)-rt. Height ();
Above
y = rt.top;
Left
y = rt.left;
Right
y =:: GetSystemMetrics (Sm_cxscreen)-rt. Width ();
I believe anyone who has studied VC knows the use of the MessageBox () function:
int MessageBox (
hwnd hwnd, //Handle to owner window
LPCTSTR lptext, //text in message box
LPCTSTR LP Caption,//message box title
UINT utype //message box style
);
Although you can specify some styles in the parameter utype, there is not much you can define in your program for the appearance of the MessageBox. The reason is that when the Messa
This paper mainly introduces the VC programmable control parts Class Htcontrol Chtgdimanager GDI resource Management Class Usage, MFC provides the CBitmap class LoadBitmap interface can only obtain the bitmap from the exe inside, but in many cases need to obtain from the EXE outside, The Chtgdimanager class provides an interface for obtaining bitmaps from outside the EXE, using the following methods:
M_hbmpbtnclosenormal = M_htgdimanager.getbi
coordinates | | Output parameters: none | | return value: none | | Description: When the parent form background uses a static bitmap and the form itself is transparent (including form use | |
Bitmap has transparency or the form does not have a background bitmap), you need to call this interface | /void Setparentbgbitmap (HBITMAP
Hparentbgbitmap, int x = 0, int y = 0); /****************************************************************************
| function function: Set parent form backgrou
On the multiplication table, here is not much nonsense, we all understand, the following next use VC + + implementation of the idea code:
Multiplication table. cpp
Copy Code code as follows:
#include int main ()
{int i,j;
for (i=1;i{for (j=1;jprintf ("%d¡á%d =%2d", j,i,i*j);
Putchar (' \ n ');
}
GetChar (); GetChar ();
return 0;
}
Multiplication Formula Table 2.cpp
Copy Code code as follows:
#i
("congratulations!");
}
Else
{
printf ("Sorry, you failed!");
}
Getch ();
return 0;
}
/*
Special keys are two bytes, the first byte is a special key (the normal key is a byte), the second byte is the key of the ASCII code,
When the "normal key" is pressed, its low 8 digits hold the ASCII code of the character.
For special keys, the lower 8 digits are 0. Special keys include arrow keys, function keys, and so on. High 8-bit byte to store the scan code of the key
#define Key_left K Le
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.