Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.
Certain files need to be emptied every time an application opens them before it writes new data to them, for example, a per-session log file. One way to achieve this
The keywords struct and class are almost interchangeable in C++. You can declare a struct that has member functions, constructors, destructor, base classes and so on as if it were
Some programmers consistently define an empty constructor and destructor in their classes, as in: class A{//..public: A() {} ~A() {}}; This is totally useless. C++ guarantees that when a class
Following yesterday’s tip, here’s another deprecated habit that programmers should avoid. Consider the following class hierarchy: class base{public: base();};class derived: public base{public: derived() : base() {/*some code*/} // superfluous}; The
Listboxes provide suitable functionality to act as a quick queue. Create a listbox named ListMyQueue. Use this code to add to your Queue: Public Sub Enqueue(StringToAdd As String)If Len(String_to_Add) >
User-defined types are useful when you need to store structured data that has no specific behavior. If you have associated behavior, you should encapsulate the data in its own class.
Sometimes you might want an MDI form without any captions or buttons, such as in a game or acting as a background parent object. You can create a captionless MDI
Enumerated constants are great, but they have a quirk that
When you need to determine the last occurrence of a character within a larger string, you typically use a Mid$ or Instr in a loop. VB6
Creating a new project in VB6 (and earlier versions) has always been a pain when you have a large library of modules to add in. You can do it a
Win32 file images can contain a file version resource that stores product and version information about the file. The version num-ber is actually four 16-bit values typically displayed using dot
n the last several years, I have built and expanded my career based on my knowledge of Microsoft SQL Server. I’ve used the product as both a database developer and
ogging in and querying an Oracle database can be a daunting task for anyone used to SQL Server. Instead of the familiar Query Analyzer tool (see Figure 1), which provides
atabase programs, with few exceptions, need to utilize both the computer’s memory and permanent storage space such as the hard drive to operate. The drives provide both long-term storage and
oth Oracle9i and SQL Server 2000 support the use of the database as more than a simple data store for your information. They enable you to use the database to
This add-in adds a tool-window to your VB IDE. Initially, mousecam will be off. Start it with the on/off button. The initial snapshot interval is 100 ms. You can change
‘ Converts a time value to a numeric value in seconds’ Example:’ MsgBox TimeToSeconds(TimeSerial(3, 5, 20)) –> 11120Function TimeToSeconds(ByVal newTime As Date) As Long TimeToSeconds = Hour(newTime) * 3600 +
Enum DateTimeFormat dtGeneralDate dtLongDate dtMediumDate dtShortDate dtLongTime dtMediumTime dtShortTime dtCustomEnd Enum’ Enhanced VB FormatDateTime functionFunction FormatDateTimeEx(newDate, Optional ByVal dtFormat As DateTimeFormat = _ dtGeneralDate, Optional FirstDayOfWeek As VbDayOfWeek = vbSunday,
‘ Converts a numeric value in seconds to a string’ Example:’ MsgBox SecondsToString(3920) –> 1h.5m.20sFunction SecondsToString(ByVal Seconds As Long) As String SecondsToString = (Seconds 3600) & “h.” & ((Seconds 60)
‘ Converts a time value to a numeric value in minutes’ Example:’ MsgBox TimeToMinutes(TimeSerial(3, 5, 0)) –> 185Function TimeToMinutes(ByVal newTime As Date) As Long TimeToMinutes = Hour(newTime) * 60 +
‘ Converts a numeric value in seconds to a time value’ Example:’ MsgBox SecondsToTime(11120) –> 3.5.20 AMFunction SecondsToTime(ByVal Seconds As Long) As Date SecondsToTime = CDate(Seconds / 86400) End Function
Private Declare Function GetSystemPowerStatus Lib “kernel32” _ (lpSystemPowerStatus As SYSTEM_POWER_STATUS) As LongPrivate Type SYSTEM_POWER_STATUS ACLineStatus As Byte BatteryFlag As Byte BatteryLifePercent As Byte Reserved1 As Byte BatteryLifeTime As Long BatteryFullLifeTime
The RegExp object in the Microsoft VBScript Regular Expression type library supports regular expression patterns containing the | (or) operator, which lets you search for multiple substrings at the same
Most of you might have worked withInternet Transfer Control which is very handy control when it comes to InternetProgramming but there is another control which even more robust and helpsprogrammers
‘ Set the IE start page’ Note: requires the SetRegistryValue, CheckRegistryKey and CreateRegistryKey ‘ routines, you can find them in the CodeBank’ Example:’ SetIEStartPage “http://www.vb2themax.com”Public Sub SetIEStartPage(ByVal sPage As String)
‘ Applies URL encoding rules to the specified Text and returns the result’ (similar to Server.URLEncode)Public Function URLEncodeEx(ByVal Text As String) As String Dim abytTokens() As Byte Dim lngTotal As
‘ Decodes URL encoding applied to the specified Text and returns the resultPublic Function URLDecodeEx(ByVal Text As String) As String Dim abytTokens() As Byte Dim lngTotal As Long Dim lngCount
‘ Applies HTML encoding rules to the specified Text and returns the result” Optionally specify if we’re encoding a HREF link and the character’ to use for encoding – the
‘ Get the IE start page’ Note: requires the GetRegistryValue routine, you can find it in the CodeBank’ Example:’ MsgBox GetIEStartPagePublic Function GetIEStartPage() As String Const HKEY_CURRENT_USER = &H80000001 GetIEStartPage
‘ Decodes HTML encoding applied to the specified Text and returns the result’ Optionally specify if we encoded a HREF link and the character’ used for encoding – the default










