|
-
April 14th, 1999, 12:50 AM
#1
How to add toolbar button at run time?
I have a dialog which allows user to choose APs to include. When an Ap has been picked a toolbar button that represents the Ap will be added to the end of the toolbar. when such toolbar button is clicked, it will load and start the application. Does anyone know how to add toolbar button at run time? Any suggestion would be greatly appreciate. Thanks in advance.
Best Regards,
Tiffany Chen
-
April 14th, 1999, 02:24 AM
#2
Re: How to add toolbar button at run time?
See the CToolBarCtrl.
In old MFC versions toolbars were emulated (by CToolBar class). Windows 95/NT4 have standard window class for toolbars - 'ToolbarWindow32'. It can be added to any of your windows.
See the CToolBarCtrl overview for details how to create it.
To load the bitmaps see the MFC code from CToolBar that loads from the resource table - the background color of your toolbar buttons must be remapped in order to show correct on different user color schemes.
-
April 15th, 1999, 02:44 AM
#3
Re: How to add toolbar button at run time?
Thanks for the suggestion. I have tried CToolBarCtrl::AddButtons and it works. The bitmap that I want to load to the button is an AP icon which was extracted using ExtractIcon. Any suggestion on how I can use such extracted icon handle to load the AP icon to the button? Thanks in advance.
The codes for icon extraction is as follows:
--------------
HICON hIcon = NULL;
HINSTANCE hInst;
CString strFile = "C:\\Program Files\\Internet
Explorer\\Iexplore.exe";
hIcon = ::ExtractIcon(hInst, strFile, 0);
-------------
Regards,
Tiffany
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|