devxlogo

Use Windows API Calls to Create Windows of Different Shapes

Use Windows API Calls to Create Windows of Different Shapes

You can create windows of different shapes using windows API calls in Visual Basic. Use the API Text Viewer tool to see all the API functions available for use in VB.
The functions to used are: CreateEllipticRgn, CreateRoundRectRgn, SetWindowRgn. The code here demonstrates creating an elliptical/ rounded rectangular window. Comment/uncomment the appropriate call to the CreateRgn method to change the shape of the window.
Follow these instructions:
1) Open a new VB standard Exe project.
2) Paste the following code in a standard bas module (definitions of the API functions used in this code can be obtained from the API Text Viewer tool):

 Public Declare Function SetWindowRgn Lib

devx-admin

Share the Post: