dcsimg
November 26, 2020
Hot Topics:

Making Your Own Custom Control

  • By Sam Huggill
  • Send Email »
  • More Articles »

Ever wondered how to put all of your 500-line code into your own control? Well now there's a way.

Using the Visual Basic 5 Control Creation Edition or Visual Basic 5 (although the CCE is free), you can create your own controls. This has been very beneficial to companies such as Data-Dynamics and Sheridan. They have made a lot of money with their own controls (see my previous article on custom controls).

Well, in the next two weeks I will show you a simple demonstration of how to make two different types of controls.

The first will make your program stay 'on top'. Make a new ActiveX control and add a .bas module (Project, Add Module). This first piece of code sets some constants and uses an API call on the 'user32' library. Add this code to the module:

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Declare Function SetWindowPos Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, y, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long




Page 1 of 3



This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date