devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

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.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

CString – IPAddress(DWORD) Conversion for CIPAddressCtrl

The following method returns a (DWORD)IPAddress from a(CString)IPAddress. It is quite useful when using the CIPAddressControl. DWORD CMyClass::GetDWORDIPAddress(CString strIPAddress){ strIPAddress.MakeReverse();// Start from behind char DOT = ‘.’; DWORD dwReturnValue =

How to Force a C++ Class to Be a Singleton

The following example demonstrates how to have only one instance of a class at a time. class MySingleTon{public: static MySingleTon * GetObject() { static MySingleTon obj; return &obj; } …

Making a Read-only Collection

The Collections class provides static APIs to generate read-only orunmodifiable collections, lists, sets, or maps from specified entities. For instance, if you are sure that the ArrayList you’ve made should

Using the instanceof Keyword in Java

When you are typecasting and using instanceof keyword in Java, there are several things you should keep in mind. Consider the following example program: class Point { int x, y;

How to Choose the Right Data Structure

Following are some tips for matching the most commonly used data structures with particular needs.1. When to use a Hashtable?A hashtable, or similar data structures, are good candidates if the

Using MACRO Definitions

By using MACRO definitions, you can easily write lines of code that are only included in Debug versions and not in Release versions. For instance, if you create a function

The Difference Between Pointers and Arrays

Some programmers believe that int a[] and int * a are equivalent.Also some C++ books to say that pointers and arrays are almost same. This belief usually leads to hard

Converting Strings Into Integers

To convert character strings into its integer component: #include int ConvertString(char * str){ int result = 0; for (int index = 0; index

Finding the lcm

The need to find the Icm is pretty common in C++ programming. This is just a basic code for finding the lcm of two integers: int lcm(int large, int small){

Enumerate Values For Easy Maintenance

Quite often, we find ourselves using variables to hold one of a set of possible values. For instance, let’s say you have a number of views on a grid. You’ll

Prevent Do Loops From Becoming Permanent

This tip is extremely useful in the IDE for debugging. Before the Do loop you want to make safe, you set the var ‘loopnum’ as 0. Then, place these two

Debugging ActiveX EXE Components

Debugging ActiveX EXE components is different from debugging ActiveX DLL components, and a bit more difficult. Here is how to do it: 1. Run your ActiveX EXE component in the

Register/Unregister a DLL or OCX

Sometimes we may need to register/unregister a DLL or OCX programatically. This piece of code can do that. Private Declare Function RegisterDLLOCX Lib _

An Efficient Method of Creating Lists For Month Names

The following code is an efficient, flexible, system-setting-independent procedure. MonthNames is either a listbox or a combobox. If StartMonth is greater than EndMonth, the list of month names will be

Stripping Double Characters From a String

Here is a sipel function for stripping double characters from a string: Public Function StripDoubleChar(ByVal Text As String, Char As String) As StringDim Pos As LongDim Start As IntegerDim sTemp

Tooltab ActiveX Control for VB6

This control allows you to place several toolbars on very little space, bycreating several tabs and showing one toolbar for each tab. The user canswitch beetwen the tabs and the

ShowSaveFileDialog – Show a Save File common dialog

Private Declare Function GetSaveFileName Lib “comdlg32.dll” Alias _ “GetSaveFileNameA” (pOpenfilename As OpenFilename) As LongPrivate Type OpenFilename lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As

IsExecFile – Check whether a file is an executable file

‘check whether the specified file is an executable,’ by checking the last 4 characters.’Example: MsgBox “File is exe: ” & IsExecFile(“C:windows otepad.exe”)Function IsExecFile(ByVal sFileName As String) As Boolean Dim sExt

ShowOpenFileDialog – Show a Open File common dialog

Private Declare Function GetOpenFileName Lib “comdlg32.dll” Alias _ “GetOpenFileNameA” (pOpenfilename As OpenFilename) As LongPrivate Type OpenFilename lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As