Copyright 1999-2009 by eXontrol
Free Stuff
featured products
exg2antt excombobox exmenu

Tools

  • exHelper helps you to find easy and quickly the answers and the source code for your questions regarding the usage of our UI components.
  • eXImages loads and compress pictures, icons or files to BASE64 strings.
  • EBN generates EBN files, that are used to skin or to change the visual appearance of UI components.
    • Gallery provides a list of already built EBN templates to skin your UI controls.
  • eXCRD generates and builds custom layouts for cells/nodes, items/rows or columns/fields.
  • eBinder connects a DataSet object, to table-view components such as eXGrid, eXG2antt, eXTree, eXList, eXComboBox, and so on. 

Free Components

  • exPrint is an advanced printing system specifically to bring your User Interface to the printed page.
  • exTransparent applies transparency to your forms.
  • exZoom magnifies your screen.
  • exHTTP, Exontrol's exHTTP is a HTTP client component that provides easy interface to the HTTP (Hypertext Transfer Protocol) protocol.
  • exInbox is a simple-to-use POP3 client library that allows mail readers to connect to many POP servers and manage email.
  • exChange is a simple-to-use FXP client library that performs currency conversions.

Visual Basic

C++

Visual Basic

The properties Screen.TwipsPerPixelX and Screen.TwipsPerPixelY are missing in MS Access, is there any way to replace them?

The article ACC2000, How to convert Twips to Pixels, explains what you have to do. Anyway, here's the Twips2Pixels function that converts X and Y twips coordinates to pixels coordinates.

What should I do if my control is flickering ?

If you feel that a window is flickering while you are updating a control, you can use the showWindow function described bellow. The function hides the window, but do not reflect the changes ( in the container window ) until you show again the window. The function uses the SetWindowPos API function. There is a LockWindow API function, but it locks only a single window at a time.

How to make your form semitransparent?

Using a layered window can significantly improve performance and visual effects for a window that has a complex shape, animates its shape, or wishes to use alpha blending effects:

How can I get the list of processes?

The following sample runs un Windows NT, 2000 or XP. The sample prints each process and its modules:

How can I display a files/folder view explorer to my form?

The following sample displays the "My Computer" view:

C++

I am looking for a tool that counts the number of lines in my project? 

If you don't find anywhere a tool to do that, you can use this tool. It includes the source code too. It's MFC based, but it's easy and free. All that you need to do is to run the "lines.exe" file and to drag files/folders to the right-side list box control. If you drag a folder the control enumerates all files recursively. Change the extension masks to count only the files that you are interested into. Click here to download the lines project.

How do I get the file version entry in the resource?

The following function loads the RT_VERSION data and looks for the file version:: 

Fills a rectangle using a transparent color.

The following function fills a rectangle using a transparent color : 

How do I create a shortcut file by code?

The following sample uses the IShellLink interface to create a shortcut file: 

How do I move my dialog without clicking in the caption area?

The following samples show how to let user moves the dialog by clicking anywhere in the dialog: 

How to change the dialog's background?

You can handle the WM_ERASEBKGND or WM_CTLCOLORDLG message:

How to convert a VARIANT to a string?

The VariantChangeType API function  converts a VARIANT from one type to another. The following sample uses CComVariant class to convert a VARIANT to a string: 

How to find the name for interfaces that a COM object implements?

To find out the interfaces that a COM object implements, you have to query the object for all registered interfaces. The windows registry holds all known interfaces in the HKCR\Interfaces registry key. The QI::MsgBox( yourCOMObject ) displays a list of interfaces implemented by the passed object  :

I have a picture file, and all that I need is an object that handles that picture. What can I do?

A picture object implements this interface along with IPicture to provide access to the picture's properties through Automation. The following function loads a picture for a file:

How can I load a picture from resource?

A picture object implements this interface along with IPicture to provide access to the picture's properties through Automation. The following function loads a picture for a application's resource:

 I have a IPictureDisp pointer, and want to draw the picture to a device context.

The DrawPicture method takes a IPictureDisp pointer, and paints the picture to give device context :

I have a bitmap and I want to draw it using a transparent color.

The following two functions helps you to draw a bitmap using a transparent color.

I don't want to use AtlAxCreateWindow, AtlAxCreateWindow2 in order to host my control ,because these are implemented in ATL.DLL file.

Here's the definition for CAxWnd window that implements a lite but powerful container that hosts a control using IClassFactory or IClassFactory2 interfaces.

 

Why the Invalidate method doesn't refresh my window, right after calling?

The invalidated areas accumulate in the update region until the region is processed when the next WM_PAINT message occurs or until the region is validated by using the ValidateRect function. The following function forces WM_PAINT message to be processed:

 

I have a pointer and I want to know if it points to a valid memory area. What should I do ?

You can use the following function to check your pointer:

How CoCreateInstance works?

The CoCreateInstance creates a single uninitialized object of the class associated with a specified CLSID. The following sample takes the control's identifier and creates an object instance. The sample doesn't use CoCreateInstance method. 

How can I retrieve the clipboard data?

The Clipboard2Variant method copies the content of the clipboard to a Variant. 

Is there any equivalent function for VB Round function in C++?

The Round function performs round to even, which is different from round to larger. The return value is the number closest to the value of expression, with the appropriate number of decimal places. If expression is exactly halfway between two possible rounded values, the function returns the possible rounded value whose rightmost digit is an even number. (In a round to larger function, a number that is halfway between two possible rounded values is always rounded to the larger number.). Round to even is a statistically more accurate rounding algorithm than round to larger. A possible implementation for Round function can be found here:

How can I have the Integer Division Operator "\" in my C++ program?

The "\" VB operator divides two numbers and returns an integer result. Before division is performed, numeric expressions are rounded to Byte, Integer, or Long subtype expressions. A possible implementation for "\" Integer Division Operator could be:

long( Round(d) / Round( n ) )

How do I load icons using more than 16 colors to my image list?

The LoadImage API function loads an icon, cursor, animated cursor, or bitmap. The LoadIcon API function loads the specified icon resource from the executable (.exe) file associated with an application instance. Both functions load icons with less than 16 colors. In order to load your icon file using more colors you have to use the LoadPicture function. The following code adds your icon to an image list using all colors in the icon:

How do I declare a pointer to a function in a C++ class (term does not evaluate to a function)?

 Prototype the function with a complete argument list and then specify actual parameters when declaring the pointer, as follows:
  • type (*ptr)(parameter_list);

If the function you want to call is member of a class ( non static member ), you have to specify the prototype like:

  • type (class::*ptr)(parameter_list);

The following sample declares two classes A and B, and a pointer to a function that's not static:

class A
{

protected:
	void a1()
	{
		// do something
	}

	void a2()
	{
		// do something
	}
};

class B : public A
{
public:

	typedef void (A::*callback_a)();

	virtual void callA( callback_a a = A::a1 )
	{
		(this->*a)();
	}
};

If you would try to call in the function callA something like a(), or (*a)(), the compiler gives "error C2064: term does not evaluate to a function", that's why you have to call explicit the this pointer like: (this->*a)().

Saving EMF format to a picture file

The following function gets the EMF format from the clipboard and saves it to a picture file. You need a graphic viewer to view EMF files.

How do I find the intersection of two rectangles?

The Windows system provides an API called IntersectRect. The IntersectRect function calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle. If the source rectangles do not intersect, an empty rectangle (in which all coordinates are set to zero) is placed into the destination rectangle. The single problem with this API seems to be when one of the source rectangles is empty. An empty rectangle is when the width or height of the rectangle is 0. For instance, if you have a rectangle like (0,0,10,10) , and you want the intersection with (5,5,5,5) rectangle, the IntersectRect API gives (0,0,0,0), instead (5,5,5,5) that's actually not what we are looking for so the following function just gives you the correct intersection: