custom controls with win32api
hello....
i want to know, if there is a way for me to create a costum control on a dialog only using win32api, without using MFC.
i have a dialog, and on it, there is a part i have to interact with (its supposed to be a table of pictures, and the user is supposed to click on one of them, and it then have to changes, etc, etc...)
i know that the best tool for me to do exactly what i want with MFC would be a costum control...
but i havn't found a single reffernce to how to do costum controls with win32api and without MFC in any book or site.
Custom controls using Win32
Here are some ideas on how to create custom controls using Win32 only.
1. Since all controls are windows, you can create a new window using CreateWindowEx(...), with given attributes, color, style and size. You'll have to register a new class for that window and create a Window Procedure. Within window procedures you can catch such messages as WM_LBUTTONDOWN, WM_LBUTTONDBLCLK, to handle messages from your control. In fact, you can use wizard to create a Win32 Applcation. It will create a window, code to register a new class for it and window procedure. This is the most "right" way to create a custom control.
2. You can display a image (bitmap) on your Dialog and then "catch" messages, (like WM_LBUTTONDOWN, WM_MOUSEMOVE, and so on) on your WndDialog procedure (see the 4-th parameter of CreateDialog()), and then check mouse coordinates to detect where event occured. For example, if event occured on an immage, which is supposed to be a button and that event is WM_LBUTTONDOWN, you may want to replace the image to create the "button pressed" effect.
Hope this will help.
Regards,
Dinu.
Re: custom controls with win32api
To add to dinus's explanation, you may need to register the window class as CS_GLOBALCLASS.
Quote:
Originally posted by cyberia_2ooo
hello....
i want to know, if there is a way for me to create a costum control on a dialog only using win32api, without using MFC.
Yes. Custom controls existed before there was an MFC. MFC is for the most part, a wrapper around the Windows API.
Quote:
but i havn't found a single reffernce to how to do costum controls with win32api and without MFC in any book or site.
A book that was available was "Windows 95: A Developers Guide" by Jeffrey Richter. It contained an entire chapter on creating custom controls. I'm sure whatever applies to Windows 95 should for the most part, apply to any 32-bit Windows OS when it comes to creating custom dialog controls.
Regards,
Paul McKenzie