| How to arrange
a free Win32 Microsoft C++ |
There are a lot of free Microsoft
products which permit you to arrange a free Win32 C++ compiler. I will
show you my own ways:
|
| Visual Toolkit 2003
|
| Visual C++ 2005 Express
|
Visual C++ 2008 Express
- Download and install the Visual C++ 2008 Express:
http://www.microsoft.com/express/download/
- Modify the windows globlal environment variables PATH, INCLUDE
and LIB adding some folders as follow:
PATH: ...;C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN;C:\Program
Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files\Microsoft
SDKs\Windows\v6.0A\bin
INCLUDE: ...;C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE;C:\Program
Files\Microsoft SDKs\Windows\v6.0A\Include;
LIB: ...;C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;C:\Program
Files\Microsoft SDKs\Windows\v6.0A\Lib
- THAT'S ALL!
|
| How to start with Hello.cpp
|
User's Guide
|
| How to change the window's
cursor |
|
| How to change a cell grid
background color and how to assign an icon to it |
| Using the PaintInfo event from the grid
itself |
|
| Using the PaintInfo event from columns
|
|
| How to convert a DIB file
to a JPG file |
First of all mark the xdib check box and the INTEL JPEG library check box into the #define manager dialog
To execute the following peice of code, you must have the Intel Jpeg Library(click here to download the INTEL JPEG library)
xdib dib;
...
dib=xpath(::module.Path()+"pic.bmp");
dib.Save2JPG(::module.Path()+"pic.jpg");
|
| How to put a GIF or JPG or
WMF background image into a form |
First of all mark the xolepicture check box and the xfiles check box into the #define manager dialog
If you want, you may choose the image bits mode from the form attributes dialog
Than put the following lines of code into the WM_CREATE event of your form:
|
| How to quickly define foundation
classes usage |
Note: you can still define component usage by the compiler option /D in the Options->Preferences dialog.
From main memu do Options->Preferences->Defines, the following dialog will pop up
now mark all the foundation components you want to use and confirm to exit.
Note: this will act as a rebuild all for the next compilation request.
|
| How to obtain tokens from
strings |
First of all mark the xtokens check box into the #define manager dialog
Quickly extract values from string(which often are delimited in various mode)
xstring tok = "DEF=1;3;44;8";
tok.delimitToken("=;");
tok.startTokenize();
int num;
while((num = tok.currentToken()) !=0 ){
//the integer variable 'num' will be on turn: 1 3 44 8
tok.nextToken();
}
xtring tok = "(mary)";
tok.delimitToken("()");
tok.startTokenize();
xstring name = tok.currentToken(); // the string name will contain mary
.
the next example is an excerpt form RAD.On++ source code
//LOAD FOXPRO KEYWORDS FOR SCINTILLA SYNTAX COLORING
xarray<xstring>ckeywords;
xstring tok = xpath(xstring(RAD.Onfolder) + "fpkeys.txt");
tok.delimitToken(",\r\n");
tok.startTokenize();
while(tok.currentToken().isNotNull()){
ckeyword[ckeyword.Grow()] = tok.currentToken();
tok.nextToken();
}
|
| How to set-up the registry
from applications |
First of all mark the xregistry check box into the #define manager dialog
Here is how to set-up the windows registry on the fly for a SQL SERVER client connection from your application:
bool sqlregsetup(void){ bool terminate = __continue; xregistry reg; TRY reg.Open(HKEY_LOCAL_MACHINE,"SOFTWARE\\MYPROGRAM"); ip=reg.Query("DB Address"); IF(ip.isNull()) ::os.FatalMessage("Invalid ip address."); RAISE(__stop); ENDIF reg.Close(); reg.Open(HKEY_LOCAL_MACHINE,"SOFTWARE\\ODBC\\ODBCINST.INI\\SQL Server"); xstring driver=reg.Query("Driver"); reg.Close(); reg.Create(HKEY_LOCAL_MACHINE,"SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources"); reg.Store("MYDB","SQL Server"); reg.Close(); reg.Create(HKEY_LOCAL_MACHINE,"SOFTWARE\\ODBC\\ODBC.INI\\MYPROGRAM"); reg.Store("Driver",driver); reg.Store("Database","MYDB"); reg.Store("Server","MYSERVER"); reg.Store("Language","Italiano"); reg.Close(); reg.Open(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\MSSQLServer\\Client\\ConnectTo"); reg.Store("MYSERVER","DBMSSOCN,"+ip); CATCH_ALL terminate = __stop; ENDCATCH return terminate; }
|
| How to implement the BlowFish
Encryption |
First of all mark the xblowfish check box into the #define manager dialog
void blow(void){ xblowfish bf; xstring out,in=form.TEXT2BLOW.Text().SpaceTrim(); int len=in.Length(); if(len==0){ form.TEXT2BLOW.Focus(); return; } if(len<8){ in.AppendNulls(8-len); len=8; } bf.Init((PBYTE)"blowseed",8); out.Spaces(bf.OutputLength(len)); bf.Encode(in,out,len); }
|
| How to put an icon on the
SysTray and how to link a popup menu to it. |
First of all mark the icon on systray check box and the xpopupmenu check box into the #define manager dialog
then bind an icon to your main form(be sure the icon contains 16x16 image size)
- right click on your main form and choose bind icon... from the popup menu; choose the icon file and set 32x32 size in the dialog make the form hidden - right click on your main form and choose attributes from popup menu; choose the load only show mode - finally put the follow code into the WM_Create event of your main form:
Ok. You have your icon on the SysTray.
Now you can trap the mouse click on the icon by the zWM_NotifyIcon event of your main form:
this snippet code will show the main window on foreground.
If you want to show a popup menu on mouse right click use the following way:
|