Click here to Skip to main content
16,011,805 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adding Bytes {Not Strings} to File Pin
Tim Smith26-Sep-04 6:59
Tim Smith26-Sep-04 6:59 
GeneralRe: Adding Bytes {Not Strings} to File Pin
InflatableGarfield26-Sep-04 7:45
InflatableGarfield26-Sep-04 7:45 
GeneralTransparent Bitmap Pin
Leyu26-Sep-04 0:19
Leyu26-Sep-04 0:19 
GeneralRe: Transparent Bitmap Pin
InflatableGarfield26-Sep-04 1:18
InflatableGarfield26-Sep-04 1:18 
GeneralRe: Transparent Bitmap Pin
Christian Graus26-Sep-04 12:21
protectorChristian Graus26-Sep-04 12:21 
GeneralRe: Transparent Bitmap Pin
Christian Graus26-Sep-04 12:22
protectorChristian Graus26-Sep-04 12:22 
GeneralRe: Transparent Bitmap Pin
Andrzej Markowski26-Sep-04 18:39
Andrzej Markowski26-Sep-04 18:39 
GeneralOwnerDrawn button control VC++6 Pin
Andy H25-Sep-04 22:54
Andy H25-Sep-04 22:54 
I have created an ActiveX button control on C++ 6 that uses the UxTheme.dll. All works fine except for when I hover the mouse over the button it doesn't repaint in the hover theme. My code for ::OnOcmDrawItem( ... ) is as below:

LRESULT CCmdButtonCtrl::OnOcmDrawItem(WPARAM wParam, LPARAM lParam)<br />
{<br />
UINT nIDCtl = (UINT) wParam;<br />
LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT) lParam;<br />
HDC dc = lpDrawItemStruct->hDC;<br />
CDC* pDC = CDC::FromHandle(dc);<br />
<br />
// Button state:<br />
BOOL bIsSelected = (lpDrawItemStruct->itemState & ODS_SELECTED);<br />
BOOL bIsFocussed = (lpDrawItemStruct->itemState & ODS_FOCUS);<br />
BOOL bIsDisabled = (lpDrawItemStruct->itemState & ODS_DISABLED);<br />
<br />
CRect rect;<br />
rect.CopyRect(&lpDrawItemStruct->rcItem);<br />
<br />
#ifdef _VISUALSTYLE_XP_H_<br />
if( g_xpStyle.IsAppThemed() )<br />
{<br />
HTHEME hTheme = g_xpStyle.OpenThemeData(GetSafeHwnd(), L"BUTTON");<br />
int state = 1;<br />
<br />
if(bIsSelected)<br />
state = 2;<br />
if(m_bLMouseButtonDown)<br />
state = 3;<br />
<br />
CRect rcContent = rect;<br />
InflateRect(&rcContent, -3, -3);<br />
<br />
HRESULT hr = g_xpStyle.DrawThemeBackground(hTheme, dc, 1, state , &rect, NULL);<br />
hr = g_xpStyle.GetThemeBackgroundContentRect(hTheme, dc, 1, state, &rect, &rcContent);<br />
<br />
// Draw caption text:<br />
if(!m_szCaption.IsEmpty())<br />
{<br />
LPWSTR lpszCaption = new WCHAR[m_szCaption.GetLength()];<br />
LPSTR lpStr = m_szCaption.GetBuffer(m_szCaption.GetLength());<br />
int nLen = MultiByteToWideChar(CP_ACP, 0, lpStr, -1, NULL, NULL);<br />
MultiByteToWideChar(CP_ACP, 0, lpStr, -1, lpszCaption, nLen);<br />
<br />
CFont* pOldFont = SelectStockFont(pDC);<br />
hr = g_xpStyle.DrawThemeText(hTheme, dc, 1, state, lpszCaption, wcslen(lpszCaption), <br />
DT_CENTER | DT_VCENTER | DT_SINGLELINE,<br />
0, &rect);<br />
pDC->SelectObject(pOldFont);<br />
hr = g_xpStyle.CloseThemeData(hTheme);<br />
}<br />
}<br />
else<br />
{<br />
#endif<br />
// Draw without XP themeing:<br />
 ... // code cut out<br />
#ifdef _VISUALSTYLE_XP_H_<br />
}<br />
#endif<br />
<br />
return 0;<br />
}


Could someone PLEASE PLEASE tell me what I need to do to get the hover working, do I need to supress the default ::OnDraw( ... ) method if hover is on?
GeneralRe: OwnerDrawn button control VC++6 Pin
Andrzej Markowski26-Sep-04 5:28
Andrzej Markowski26-Sep-04 5:28 
GeneralRe: OwnerDrawn button control VC++6 Pin
Andy H26-Sep-04 9:20
Andy H26-Sep-04 9:20 
GeneralRe: OwnerDrawn button control VC++6 Pin
Andy H26-Sep-04 22:27
Andy H26-Sep-04 22:27 
GeneralRandom number generation on 4bytes Pin
Paolo Ponzano25-Sep-04 21:36
Paolo Ponzano25-Sep-04 21:36 
GeneralRe: Random number generation on 4bytes Pin
Ravi Bhavnani25-Sep-04 21:42
professionalRavi Bhavnani25-Sep-04 21:42 
Generalsimple vc++ help Pin
Anonymous25-Sep-04 19:39
Anonymous25-Sep-04 19:39 
GeneralRe: simple vc++ help Pin
BAIJUMAX25-Sep-04 20:58
professionalBAIJUMAX25-Sep-04 20:58 
GeneralRe: simple vc++ help Pin
BAIJUMAX25-Sep-04 20:59
professionalBAIJUMAX25-Sep-04 20:59 
QuestionHow to generate Midi Sound? Pin
Aris Adrianto S25-Sep-04 18:25
Aris Adrianto S25-Sep-04 18:25 
AnswerRe: How to generate Midi Sound? Pin
Ravi Bhavnani25-Sep-04 21:38
professionalRavi Bhavnani25-Sep-04 21:38 
GeneralPrinting bitmap Pin
Yulianto.25-Sep-04 18:18
Yulianto.25-Sep-04 18:18 
GeneralRe: Printing bitmap Pin
Andrzej Markowski3-Oct-04 14:33
Andrzej Markowski3-Oct-04 14:33 
GeneralAbout Using Class in a Dll, plz help.. Pin
25-Sep-04 16:24
suss25-Sep-04 16:24 
GeneralRe: About Using Class in a Dll, plz help.. Pin
Antti Keskinen26-Sep-04 1:59
Antti Keskinen26-Sep-04 1:59 
GeneralHelp !!! gateway ... Pin
mazi195525-Sep-04 12:14
mazi195525-Sep-04 12:14 
GeneralDialog Pin
swarup25-Sep-04 9:11
swarup25-Sep-04 9:11 
GeneralRe: Dialog Pin
Yulianto.25-Sep-04 18:21
Yulianto.25-Sep-04 18:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.