[BCB] interception shutdown message
How to intercept the situation in the shutdown to end the application
Class TForm1: Public TForm {__ Published: // Ide-Managed ComponentsPrivate: // User Declarationspublic: // User Declarations
Begin_MESSAGE_MAPMESSAGE_HANDLER (WM_QueryEndSession, TMESSAGE, WINDOWCLOSE) End_Message_Map (TFORM)}
Void __fastcall tform1 :: windowclose (tMessage & Message) {// do your code heremessage.result = WM_QUERYENDSESSION;}
Published by Visor
01:14 AM |
Resonance (2)
[BCB] How to join the icon in Listbox or ComboBOX
Add icon in Listbox or ComboBox
Need to have TimageList and TListbox or Tcombobox two components
Can draw a small picture before each option
LB1-> style = lbownerdrawvariable; lb1-> itemHeight = 17; void __fastcall tform1 :: lb1drawitem (TWINCONTROL * Control, int index, trec "{ticon * t;
T = new ticon; imagelist1-> geticon (0, t); lb1-> canvas-> FillRect (Rect); lb1-> canvas-> draw (Rect.Left 15, Rect.top, T); lb1-> Canvas-> Textout (Rect.Left T-> Width / 2 16, Rect.top 2, LB1-> Items-> strings [index]); delete t;
}
Published by Visor
01:08 AM |
Respond (0)
CHECKAPPHANDLE
Check if there is the same program in the memory.
/ ************************************************** ************************ / / * Check if there is the same program is running * // ************ *********************************************************** *********** / Application-> Title = "MyName"; handle previnsthandle; handle mutex = OpenMuteX (Synchronize, false, Application-> Title.c_str ()); if (Mutex! = Null) {String AppTitle = Application-> Title; SetWindowText (Application-> Handle, NULL); PrevInstHandle = FindWindow ( "TApplication", AppTitle.c_str ()); if (! PrevInstHandle = 0) {if (IsIconic (PrevInstHandle)) ShowWindow (PrevInstHandle, SW_RESTORE); elseBringWindowToTop (PrevInstHandle); SetForegroundWindow (PrevInstHandle);} Application-> ShowMainForm = false; Application-> Terminate ();} elseCreateMutex (NULL, false, Application-> Title.c_str ()); a visor Published on
01:02 AM |
Resonance (2)
[BCB] POPUP
Move the target window to the top
Void popup (void * formhandle) {if (isiconic (formhandle / * application-> handle * /)) // checks whether to minimize {showwindow (formhandle / * application-> handle * /, sw_restore); // jump} Else {// Put it to the top SYSTEMPARETERSINFO (SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDCHANGE); // Get focus setForegroundWindow (FormHandle);}}
Published by Visor
12:59 AM |
Respond (0)
[Bcb] easyXML
Simple XML Parse for BCB and Delphi Support Chinese
http://windtop.yzu.edu.tw/~visor/bcb/pkg/xmlparser.zip
// for example:
// - load the input xml file ..// xmlscanner1-> loadFromfile ("c: //myfile.xml"); xmlscanner1-> loadFromBuffer (xml.c_str ());
// - init the scanning.xmlscanner1-> xmlparser-> startscan ();
// - loop thru The File for Each Item.ansswing Tag, CDATA;
While (xmlscanner1-> xmlparser-> scan ()) {switch (xmlscanner1-> xmlparser-> curparttype) {copy pttarttag: // - got start tag.tag = xmlscanner1-> xmlparser-> Curname; Break; Case PTContent: // - got content.cdata = xmlscanner1-> xmlparser-> curcontent; break;
Case Ptendtag: Break;
// - add other carated here as required ..
DEFAULT: BREAK;}
Published by Visor
12:49 AM |
Resonance (1)
March 08, 2003
[Bcb] TBASE64
Http://140.138.2.234/~visor/bcb/class/class.zip
TBASE64ENCODETBASE64DECode
You can encode the file, memory block or text into Base64 String
It is also possible to reverse encoding into files, memory blocks or texts