static BOOL UpdateVolumeBarx(HWND hWnd, UINT nVolume, UINT nCount)
{ if (first)
{
first = false;
return TRUE;
} const UINT nMaxWidth = GetSystemMetrics(SM_CXSCREEN);
while (1)
{
g_nBarWidth = (ITEM_WIDTH + ITEM_GAP) * nCount + SPK_WIDTH;
g_nBarWidth += 8 - (g_nBarWidth % 8);
if (g_nBarWidth <= nMaxWidth)
break; nCount /= 2;
nVolume /= 2;
} BOOL bRetVal = TRUE;
BOOL bDDraw = CreateDDrawx(hWnd);
#ifdef SHARP_LQ035Q1DG01
int x = 0;//(GetSystemMetrics(SM_CXSCREEN) - g_nBarWidth) / 2 - 100;//执行此处
int y = 9;//GetSystemMetrics(SM_CYSCREEN) - 26;;//执行此处#else
int x = (GetSystemMetrics(SM_CXSCREEN) - g_nBarWidth) / 2 - 70;
int y = GetSystemMetrics(SM_CYSCREEN) - 30;
#endif
HDC hdcSurf = NULL;
if (bDDraw)
{
ASSERT(g_pDDSOverlay);
g_pDDSOverlay->SetOverlayPosition(x, y);
if (FAILED(g_pDDSOverlay->GetDC(&hdcSurf)))
return FALSE;
}
else
{
MoveWindow(hWnd, x, y, g_nBarWidth, BAR_HEIGHT, TRUE);
hdcSurf = GetDC(hWnd);
ShowWindow(hWnd, SW_SHOW);
}
bRetVal = DrawVolBarx(hdcSurf, nVolume, nCount); if (bDDraw)
g_pDDSOverlay->ReleaseDC(hdcSurf);
else
ReleaseDC(hWnd, hdcSurf);
return TRUE;
}
{ if (first)
{
first = false;
return TRUE;
} const UINT nMaxWidth = GetSystemMetrics(SM_CXSCREEN);
while (1)
{
g_nBarWidth = (ITEM_WIDTH + ITEM_GAP) * nCount + SPK_WIDTH;
g_nBarWidth += 8 - (g_nBarWidth % 8);
if (g_nBarWidth <= nMaxWidth)
break; nCount /= 2;
nVolume /= 2;
} BOOL bRetVal = TRUE;
BOOL bDDraw = CreateDDrawx(hWnd);
#ifdef SHARP_LQ035Q1DG01
int x = 0;//(GetSystemMetrics(SM_CXSCREEN) - g_nBarWidth) / 2 - 100;//执行此处
int y = 9;//GetSystemMetrics(SM_CYSCREEN) - 26;;//执行此处#else
int x = (GetSystemMetrics(SM_CXSCREEN) - g_nBarWidth) / 2 - 70;
int y = GetSystemMetrics(SM_CYSCREEN) - 30;
#endif
HDC hdcSurf = NULL;
if (bDDraw)
{
ASSERT(g_pDDSOverlay);
g_pDDSOverlay->SetOverlayPosition(x, y);
if (FAILED(g_pDDSOverlay->GetDC(&hdcSurf)))
return FALSE;
}
else
{
MoveWindow(hWnd, x, y, g_nBarWidth, BAR_HEIGHT, TRUE);
hdcSurf = GetDC(hWnd);
ShowWindow(hWnd, SW_SHOW);
}
bRetVal = DrawVolBarx(hdcSurf, nVolume, nCount); if (bDDraw)
g_pDDSOverlay->ReleaseDC(hdcSurf);
else
ReleaseDC(hWnd, hdcSurf);
return TRUE;
}
解决方案 »
- MFC怎么调用WebService来获得一个数据集(比如DataSet或DataTable)
- access Sql语句错误
- SDI及MDI程序如何最小到系统托盘?
- 求教,关于CPropertySheet,知道的进来看下 谢谢。
- (VC++2005)如何添加文本框的OnChar事件
- vc下ado导致程序异常退出问题?
- 一个win32application应用程序和一个mfc(exe)应用程序在建立无模式对话框时有何不同?
- 何謂視口,何謂窗口?
- 如何使用CreateSystemTimer( )和KillSystemTimer( )
- 关于ADO连接数据库之后在对话框控件内显示数据的问题
- 除了在 WNDPROC 中处理 WM_DROPFILES 消息之外,还有没有其他获得拖曳的文件?
- 要使用哪种函数比较好?
wnd.Attach(hWnd);
wnd.CenterWindow();
wnd.Detach();