|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Debabrata Mukherjee
|
Jul 9, 2007 - 6:17 AM
|
Earlier my application had buttons being created from object of class derived from CBitmapButton class ,but after I derived the class from CExtButton class the buttons are getting created but the icons are not loaded when the application starts i.e. the buttons are not showing.
for profile set up i have written this code: HINSTANCE hInstResource =AfxFindResourceHandle(MAKEINTRESOURCE(IDB_SABINS_BSW_PARTS_ACTIVE ), RT_GROUP_ICON); ASSERT( hInstResource != NULL ); HICON hIcon = (HICON)::LoadImage(hInstResource,MAKEINTRESOURCE(IDB_SABINS_BSW_PARTS_ACTIVE ), IMAGE_ICON,16,16,0); ASSERT( hIcon != NULL ); SetIcon( hIcon, FALSE ); CWinApp * pApp = ::AfxGetApp(); ASSERT( pApp != NULL );
//The command manager is a key global object in Prof-UIS. Registering the commands in it. // is neccesary .This needs to be done at CMainFrame::OnCreate () method: g_CmdManager->ProfileSetup(pApp->m_pszProfileName,GetSafeHwnd());
VERIFY(g_CmdManager->ProfileWndAdd(pApp->m_pszProfileName,GetSafeHwnd())); VERIFY(g_CmdManager->CmdSetIcon(pApp->m_pszProfileName,IDB_SABINS_BSW_PARTS_ACTIVE,hIcon,FALSE )); // VERIFY(g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName,IDB_SABINS_CONTROL_BITMAP ));
and fro creating the buttons I wrote this one::
if (!m_abtnParts.Create("Parts", BS_PUSHBUTTON | BS_OWNERDRAW, rect, this, IDC_SABINS_BSW_PARTS)) { throw new CSa_Exception(SABINS_CAT_INTERNAL_ERROR, SABINS_E_CREATE_BSW_PARTS); }
it is throwing some debug assertion error
Please guide me in this regard
|
|
Technical Support
|
Jul 9, 2007 - 9:24 AM
|
Please let us know if you are using the CExtButton::SetIcon() method to associate an icon with the button?
|
|
Debabrata Mukherjee
|
Jul 9, 2007 - 12:25 PM
|
ya we are using SetIcon method, but simply we are not getting the correct way to do it. Could you please let us know. What we are getting is simply an empty bar w/o any empty button also.
|
|
Technical Support
|
Jul 10, 2007 - 12:13 PM
|
Where are you using the button? Is it a push button on a dialog or on a toolbar? Here is the code form the Prof-UIS_Controls sample that assigns an icon to the push button. You can use this code in your project. m_btnPushButton.m_icon.AssignFromHICON(
(HICON) ::LoadImage(
::AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDI_NOTEPAD),
IMAGE_ICON,
48,
48,
0
),
false
);
|
|