本文整理汇总了C++中IsWindowEnabled函数的典型用法代码示例。如果您正苦于以下问题:C++ IsWindowEnabled函数的具体用法?C++ IsWindowEnabled怎么用?C++ IsWindowEnabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsWindowEnabled函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wpbtnKarta
LRESULT CALLBACK wpbtnKarta(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_CREATE: {
SetWindowLongPtr(hwnd, 0, (LONG)false);
break;
}
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
//Tlo
FillRect(hdc, &ps.rcPaint, Okno->brSzary);
//Ikona
HDC hdcIkona = CreateCompatibleDC(hdc);
HGDIOBJ hdcStary;
LONG_PTR a = GetWindowLongPtr(hwnd, 0);
if (GetWindowLongPtr(hwnd, 0) == (LONG)TRUE) { //Minus
hdcStary = SelectObject(hdcIkona, Okno->imgMinus);
}
else { //Plus
hdcStary = SelectObject(hdcIkona, Okno->imgPlus);
}
BitBlt(hdc, 7, 7, 9, 9, hdcIkona, 0, 0, SRCCOPY);
SelectObject(hdcIkona, hdcStary);
DeleteDC(hdcIkona);
//Tekst
RECT p2;
ZeroMemory(&p2, sizeof(p2));
p2.left = 22;
p2.right = 190;
p2.top = 5;
p2.bottom = 20;
HFONT domyslna;
domyslna = (HFONT)SelectObject(hdc, Okno->fntCzcionka);
SetBkColor(hdc, (COLORREF)0xE3E3E3);
char *t1 = new char[30];
GetWindowText(hwnd, t1, 30);
if (IsWindowEnabled(hwnd)) {
SetTextColor(hdc, 0);
} else {
SetTextColor(hdc, (COLORREF)0x999999);
}
DrawText(hdc, t1, -1, &p2, NULL);
delete[] t1;
SelectObject(hdc, domyslna);
EndPaint(hwnd, &ps);
return 0;
}
case WM_LBUTTONDOWN: {
SendMessage(GetParent(hwnd), WM_COMMAND, (WPARAM)MAKELONG((WORD)GetWindowLong(hwnd, GWL_ID), BN_CLICKED), (LPARAM)hwnd);
break;
}
case WM_ENABLE: {
InvalidateRect(hwnd, NULL, true);
break;
}
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
开发者ID:Marcino713,项目名称:PhysicalSimulator2,代码行数:78,代码来源:wndproc.cpp
示例2: PaintThemeButton
/**
* name: PaintThemeButton
* desc: Draws the themed button
* param: ctl - BTNCTRL structure for the button
* hdcMem - device context to draw to
* rcClient - rectangle of the whole button
* return: nothing
**/
static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient)
{
RECT rcText = { 0, 0, 0, 0 };
WCHAR wszText[MAX_PATH] = { 0 };
WORD ccText;
// Draw the flat button
if ((ctl->dwStyle & MBS_FLAT) && ctl->hThemeToolbar) {
int state = IsWindowEnabled(ctl->hwnd)
? (ctl->stateId == PBS_NORMAL && ctl->defbutton
? PBS_DEFAULTED
: ctl->stateId)
: PBS_DISABLED;
if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeToolbar, TP_BUTTON, TBStateConvert2Flat(state))) {
if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient)))
DrawThemeParentBackground(GetParent(ctl->hwnd), hdcMem, rcClient);
}
DrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), rcClient, rcClient);
}
else {
// draw themed button background
if (ctl->hThemeButton) {
int state = IsWindowEnabled(ctl->hwnd)
? (ctl->stateId == PBS_NORMAL && ctl->defbutton
? PBS_DEFAULTED
: ctl->stateId)
: PBS_DISABLED;
if (IsThemeBackgroundPartiallyTransparent(ctl->hThemeButton, BP_PUSHBUTTON, state)) {
if (SUCCEEDED(DrawThemeParentBackground(ctl->hwnd, hdcMem, rcClient)))
DrawThemeParentBackground(GetParent(ctl->hwnd), hdcMem, rcClient);
}
DrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, rcClient, rcClient);
}
}
// calculate text rect
{
RECT sizeText;
HFONT hOldFont;
ccText = GetWindowTextW(ctl->hwnd, wszText, sizeof(wszText) / sizeof(WCHAR));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
GetThemeTextExtent(
ctl->hThemeButton,
hdcMem,
BP_PUSHBUTTON,
IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED,
wszText,
ccText,
DST_PREFIXTEXT,
NULL,
&sizeText);
if (ctl->cHot) {
RECT rcHot;
GetThemeTextExtent(ctl->hThemeButton,
hdcMem,
BP_PUSHBUTTON,
IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED,
L"&",
1,
DST_PREFIXTEXT,
NULL,
&rcHot);
sizeText.right -= (rcHot.right - rcHot.left);
}
SelectObject(hdcMem, hOldFont);
rcText.left = (ctl->hIcon) ? 0 : (rcClient->right - rcClient->left - (sizeText.right - sizeText.left)) / 2;
rcText.top = (rcClient->bottom - rcClient->top - (sizeText.bottom - sizeText.top)) / 2;
rcText.right = rcText.left + (sizeText.right - sizeText.left);
rcText.bottom = rcText.top + (sizeText.bottom - sizeText.top);
if (ctl->stateId == PBS_PRESSED) {
OffsetRect(&rcText, 1, 1);
}
}
}
PaintIcon(ctl, hdcMem, &ccText, rcClient, &rcText);
// draw text
if (ccText > 0 && ctl->hThemeButton) {
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
DrawThemeText(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, IsWindowEnabled(ctl->hwnd) ? ctl->stateId : PBS_DISABLED, wszText, ccText, DST_PREFIXTEXT, 0, &rcText);
SelectObject(hdcMem, hOldFont);
}
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:98,代码来源:ctrl_button.cpp
示例3: UIEmulateBtnClick
static int UIEmulateBtnClick(HWND hwndDlg, UINT idcButton)
{
if (IsWindowEnabled(GetDlgItem(hwndDlg, idcButton)))
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(idcButton, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, idcButton));
return 0;
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:6,代码来源:enterstring.cpp
示例4: ExecuteEntry
//.........这里部分代码省略.........
}
return ret;
}
if (ret == -3 || ret == -6)
{
log_printf2("File: INSTALLER CORRUPTED (gcdfdb:%d)\n",ret);
goto installer_corrupted;
}
else
{
DeleteFile(buf);
log_printf("File: error writing. deleted.\n");
return -2;
}
}
log_printf("File: INSTALLER CORRUPTED\n");
}
break;
case 2: // execute program
{
PROCESS_INFORMATION ProcInfo={0,};
STARTUPINFO StartUp={sizeof(STARTUPINFO),};
int disabled = 0;
if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf2,sizeof(buf2)))
{
log_printf2("Exec: command=\"%s\"\n",buf2);
if (process_string(buf,buf2,state_install_directory)) _tcscpy(buf,buf2);
{
INT32 args[] = { (INT32)buf };
GETRESOURCE2(tmpbuf, JAVAWS_STATUS_EXECUTE, args);
update_status_text(tmpbuf);
}
if (IsWindowEnabled(GetDlgItem(g_hwnd,IDOK))!=0) {
/* if Next button is already disabled, don't disable */
/* and re-enable it. (bug 4624948) */
EnableWindow(GetDlgItem(g_hwnd,IDOK), 0);
disabled = 1;
}
if (CreateProcess( NULL, buf, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, state_output_directory, &StartUp, &ProcInfo) )
{
log_printf2("Exec: success (\"%s\")\n",buf);
if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread );
if (NULL != ProcInfo.hProcess)
{
if (thisentry->offsets[1]==1)
{
WaitForSingleObject(ProcInfo.hProcess,INFINITE);
ShowWindow(g_hwnd,SW_HIDE);
ShowWindow(g_hwnd,SW_SHOW);
InvalidateRect(g_hwnd,NULL,TRUE);
UpdateWindow(g_hwnd);
while (1)
{
MSG msg;
if (!PeekMessage(&msg,g_hwnd,WM_PAINT,WM_PAINT,PM_REMOVE)) break;
DispatchMessage(&msg);
}
}
{
DWORD exitcode;
if (!GetExitCodeProcess(ProcInfo.hProcess, (LPDWORD)&exitcode)) {
log_printf("Exec: failed getting exit code\n");
state_return_value = STATE_RETURN_INVALID;
} else {
state_return_value = exitcode;
开发者ID:FredChap,项目名称:myforthprocessor,代码行数:67,代码来源:exec.c
示例5: IsOverURL
bool CIVStatusBar::IsOverURL(CPoint pt, CString & rstr )
{
if ( ! IsWindowEnabled() || !GetTopLevelParent()->IsWindowEnabled() )
return false;
CStatusBarCtrl & sb = GetStatusBarCtrl();
int iPart = -1;
CRect rc;
for (int i=0; i < sb.GetParts(0, NULL); i++ )
{
sb.GetRect (i, rc);
if (rc.PtInRect(pt) && ( GetPaneStyle(i) & SBT_OWNERDRAW ) )
{
iPart = i;
break;
}
}
if (iPart == -1)
return false;
if ( ! (GetPaneStyle(iPart) & SBPS_NOBORDERS) )
rc.InflateRect(-GetSystemMetrics(SM_CYBORDER), -GetSystemMetrics(SM_CXBORDER));
if (!rc.PtInRect(pt))
return false;
CString strText = GetPaneText(iPart);
CDC * pDC = GetDC();
CFont * pFont = GetFont();
CFont fntURL;
GetLinkFont(fntURL);
CFont * pOldFont = pDC->SelectObject (pFont);
int x = CalcX (pDC, rc, strText);
bool bFound = false;
for (int i = 0; i < strText.GetLength();)
{
CSize szPos = FindURL (strText, i );
if (szPos.cx != -1)
{
CString strStart = strText.Mid (i, szPos.cx-i);
CRect rcURL;
x += pDC->GetTextExtent (strStart).cx;
rcURL.left = x;
pFont = pDC->SelectObject (&fntURL);
CString strURL = strText.Mid(szPos.cx, szPos.cy);
CSize szURL = pDC->GetTextExtent (strURL);
x += szURL.cx;
rcURL.right = x;
rcURL.top = rc.top;
rcURL.bottom = rc.top + szURL.cy;
pDC->SelectObject (pFont);
if (rcURL.PtInRect(pt))
{
rstr = strURL;
bFound = true;
break;
}
i = szPos.cx + szPos.cy;
}
else
break;
}
pDC->SelectObject (pOldFont);
return bFound;
}
开发者ID:AlexS2172,项目名称:IVRMstandard,代码行数:82,代码来源:IVControls.cpp
示例6: SendMessage
void CMlsBitmapButton::DrawButton(CDC* pDC)
{
// Upack the state of the button.
DWORD dwState = SendMessage(BM_GETSTATE, 0, 0);
DWORD dwCode = SendMessage(WM_GETDLGCODE, 0, 0);
BOOL fSelected = (dwState & 4) != 0;
BOOL fFocused = (dwState & 8) != 0;
BOOL fDisabled = !IsWindowEnabled();
BOOL fDefault = (dwCode & DLGC_DEFPUSHBUTTON) != 0;
// Create a bitmap which will be used to draw the button image.
// When the bitmap is complete, it will be drawn onto the button.
CRect crButton;
GetClientRect(crButton);
CBitmap bmButton;
bmButton.CreateCompatibleBitmap(pDC, crButton.Width(), crButton.Height());
CDC dcButton;
dcButton.CreateCompatibleDC(pDC);
CPalette* pOldPalette = NULL;
CPalette* pOldButtonPalette = NULL;
if (m_pPalette != NULL)
{
pDC->SelectPalette(m_pPalette, FALSE);
pDC->RealizePalette();
pOldButtonPalette = dcButton.SelectPalette(m_pPalette, FALSE);
}
dcButton.SelectObject(&bmButton);
// Initialize the button bitmap to the button face color.
Util::FillRectangleWithColor(dcButton, crButton, m_clFace);
// Compute the area available for content.
CRect crContent(crButton);
crContent.InflateRect(-MinimumMargin, -MinimumMargin);
CRect crTextContent(crContent);
// Compute the bitmap dimensions and its nominal position. Adjust crTextContent to the
// area which is available next to the bitmap.
CRect crBitmap;
crBitmap.SetRectEmpty();
if (!crContent.IsRectEmpty())
{
if (m_fHaveBitmap)
{
crBitmap.SetRect(0, 0, m_nBitmapWidth, m_nBitmapHeight);
// Set first bitmap position base on major alignment type.
switch (m_Alignment)
{
case Left:
{
crBitmap.OffsetRect(crContent.left, crContent.top+(crContent.Height()-crBitmap.Height())/2);
crTextContent.left += crBitmap.Width()+Separator;
break;
}
case Right:
{
crBitmap.OffsetRect(crContent.right-crBitmap.Width(), crContent.top+(crContent.Height()-crBitmap.Height())/2);
crTextContent.right -= crBitmap.Width()+Separator;
break;
}
case Top:
{
crBitmap.OffsetRect(crContent.left+(crContent.Width()-crBitmap.Width())/2, crContent.top);
crTextContent.top += crBitmap.Height()+Separator;
break;
}
case Bottom:
{
crBitmap.OffsetRect(crContent.left+(crContent.Width()-crBitmap.Width())/2, crContent.bottom-crBitmap.Height());
crTextContent.bottom -= crBitmap.Height()+Separator;
break;
}
default:
{
ASSERT(FALSE);
}
}
}
else
{
crBitmap.SetRectEmpty();
}
}
// Compute the text dimensions and its nominal position.
CRect crText;
crText.SetRectEmpty();
CString csText;
if (!crTextContent.IsRectEmpty())
{
GetWindowText(csText);
if (!csText.IsEmpty())
//.........这里部分代码省略.........
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:101,代码来源:BITBTN.CPP
示例7: switch
LRESULT TStemDialog::DefStemDialogProc(HWND Win,UINT Mess,WPARAM wPar,LPARAM lPar)
{
StemDialog_RetDefVal=0;
TStemDialog *This;
switch (Mess){
case WM_SYSCOMMAND:
switch (wPar){
case SC_MONITORPOWER:
if (runstate == RUNSTATE_RUNNING) return 0;
break;
case SC_SCREENSAVE:
if (runstate == RUNSTATE_RUNNING || FullScreen) return 0;
break;
}
break;
case WM_MOVING:case WM_SIZING:
if (FullScreen){
RECT *rc=(RECT*)lPar;
if (rc->top<MENUHEIGHT){
if (Mess==WM_MOVING) rc->bottom+=MENUHEIGHT-rc->top;
rc->top=MENUHEIGHT;
StemDialog_RetDefVal=true;
return true;
}
RECT LimRC={0,MENUHEIGHT+GetSystemMetrics(SM_CYFRAME),
GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)};
ClipCursor(&LimRC);
}
break;
case WM_MOVE:
{
GET_THIS;
RECT rc;
GetWindowRect(Win,&rc);
if (FullScreen){
if (IsIconic(StemWin)==0 && IsZoomed(StemWin)==0){
This->FSLeft=rc.left;This->FSTop=rc.top;
}
}else{
if (IsIconic(Win)==0 && IsZoomed(Win)==0){
This->Left=rc.left;This->Top=rc.top;
}
}
break;
}
case WM_CAPTURECHANGED: //Finished
if (FullScreen) ClipCursor(NULL);
break;
case WM_ACTIVATE:
if (wPar==WA_INACTIVE){
GET_THIS;
This->Focus=GetFocus();
}else{
if (IsWindowEnabled(Win)==0){
PostMessage(StemWin,WM_USER,12345,(LPARAM)Win);
}
}
break;
case WM_SETFOCUS:
GET_THIS;
SetFocus(This->Focus);
break;
}
return 0;
}
开发者ID:TheRelentless,项目名称:steem-engine,代码行数:66,代码来源:stemdialogs.cpp
示例8: Select_CDROM_Window_WndProc
LRESULT CALLBACK Select_CDROM_Window_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
Select_CDROM_Window_CreateChildWindows(hWnd);
break;
case WM_CLOSE:
DestroyWindow(select_cdrom_window);
return 0;
case WM_MENUSELECT:
case WM_ENTERSIZEMOVE:
case WM_NCLBUTTONDOWN:
case WM_NCRBUTTONDOWN:
// Prevent audio stuttering when one of the following events occurs:
// - Menu is opened.
// - Window is resized.
// - Left/Right mouse button down on title bar.
Win32_ClearSoundBuffer();
break;
case WM_COMMAND:
// Button press, or Enter pressed in textbox
switch (LOWORD(wParam))
{
case IDOK: // Standard dialog button ID
case IDC_BTN_OK:
case IDC_BTN_SAVE:
if (!IsWindowEnabled(SelCD_btnOK))
break;
SelCD_Save();
DestroyWindow(hWnd);
break;
case IDC_BTN_APPLY:
if (!IsWindowEnabled(SelCD_btnApply))
break;
SelCD_Save();
break;
case IDCANCEL: // Standard dialog button ID
case IDC_BTN_CANCEL:
DestroyWindow(hWnd);
break;
}
break;
case WM_DESTROY:
if (hWnd != select_cdrom_window)
break;
select_cdrom_window = NULL;
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
开发者ID:chipsoftwaretester,项目名称:OpenEmu,代码行数:61,代码来源:select_cdrom_window_callbacks.c
示例9: NYX_ASSERT
//----------------------------------------------------------------
bool check_box::is_activate() const {
NYX_ASSERT(hwnd_ != NULL);
return IsWindowEnabled(hwnd_) != 0;
}
开发者ID:thayamizu,项目名称:Nyx,代码行数:5,代码来源:CheckBox.cpp
示例10: DlgProcDisplayAttr
//.........这里部分代码省略.........
case IDC_RADIO_UL_SEL_ANNOT:
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
case IDC_COMBO_UL_ATTR_MARK:
case IDC_COMBO_UL_ATTR_TEXT:
case IDC_COMBO_UL_ATTR_OKURI:
case IDC_COMBO_UL_ATTR_ANNOT:
case IDC_COMBO_ATTR_MARK:
case IDC_COMBO_ATTR_TEXT:
case IDC_COMBO_ATTR_OKURI:
case IDC_COMBO_ATTR_ANNOT:
switch(HIWORD(wParam))
{
case CBN_SELCHANGE:
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
default:
break;
}
break;
default:
break;
}
break;
case WM_LBUTTONDOWN:
for(int i = 0; i < _countof(displayAttrColor[no]); i++)
{
for(int j = 0; j < _countof(displayAttrColor[no][i]); j++)
{
hwnd = GetDlgItem(hDlg, displayAttrColor[no][i][j].id);
if(!IsWindowEnabled(hwnd))
{
continue;
}
GetWindowRect(hwnd, &rect);
pt.x = x = GET_X_LPARAM(lParam);
pt.y = y = GET_Y_LPARAM(lParam);
ClientToScreen(hDlg, &pt);
if(rect.left <= pt.x && pt.x <= rect.right &&
rect.top <= pt.y && pt.y <= rect.bottom)
{
cc.lStructSize = sizeof(cc);
cc.hwndOwner = hDlg;
cc.hInstance = NULL;
cc.rgbResult = *displayAttrColor[no][i][j].color;
cc.lpCustColors = colCust;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
cc.lCustData = NULL;
cc.lpfnHook = NULL;
cc.lpTemplateName = NULL;
if(ChooseColorW(&cc))
{
DrawSelectColor(hDlg, displayAttrColor[no][i][j].id, cc.rgbResult);
*displayAttrColor[no][i][j].color = cc.rgbResult;
PropSheet_Changed(GetParent(hDlg), hDlg);
return TRUE;
}
break;
}
}
}
break;
开发者ID:SGA-Takeshi-Tsukamoto,项目名称:corvusskk,代码行数:67,代码来源:DlgProcDisplayAttr.cpp
示例11: return
bool
mxWidget::isEnabled () const
{
return (IsWindowEnabled (d_this->d_hwnd) == TRUE);
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:5,代码来源:mxwidget.cpp
示例12: write_entries_to_window
static void write_entries_to_window(HWND window, char *filename){
int num_of_entries, entry, row_num = 0;
char numstr[6];
filetype type;
LVITEMA row;
FILE *fd;
struct program_block program;
HWND preview = GetDlgItem(window, IDC_PREVIEW);
HWND text = GetDlgItem(window, IDC_FILE_TYPE);
HWND c64name = GetDlgItem(window, IDC_C64_NAME);
fd = fopen(filename, "rb");
if (fd == NULL)
return;
switch (type = detect_type(fd)) {
case not_a_valid_file:
EnableWindow(preview, FALSE);
EnableWindow(c64name, FALSE);
SetWindowTextA(text, "");
SetWindowTextA(c64name, "");
fclose(fd);
return;
case t64:
{
char message[1000];
char tape_name[25];
int num_of_used_entries;
num_of_entries = get_total_entries(fd);
num_of_used_entries = get_used_entries(fd);
get_tape_name(tape_name, fd);
_snprintf(message, 1000,
"T64 file with %u total entr%s, %u used entr%s, name %s",
num_of_entries, num_of_entries == 1 ? "y" : "ies",
num_of_used_entries, num_of_used_entries == 1 ? "y" : "ies",
tape_name);
SetWindowTextA(text, message);
EnableWindow(preview, num_of_used_entries > 1);
}
EnableWindow(c64name, FALSE);
break;
case p00:
EnableWindow(preview, FALSE);
num_of_entries = 1;
SetWindowTextA(text, "P00 file");
EnableWindow(c64name, TRUE);
break;
case prg:
EnableWindow(preview, FALSE);
num_of_entries = 1;
SetWindowTextA(text, "PRG file");
EnableWindow(c64name, TRUE);
break;
}
for (entry = 1; entry <= num_of_entries; entry++) {
if (get_entry(entry, fd, &program)) {
row.mask = LVIF_TEXT;
row.iItem = row_num++;
row.iSubItem = 0;
row.pszText = numstr;
sprintf(numstr, "%u", entry);
ListView_InsertItem(preview, &row);
row.iSubItem = 1;
row.pszText = program.info.name;
ListView_SetItem(preview, &row);
row.iSubItem = 2;
row.pszText = numstr;
sprintf(numstr, "%u", program.info.start);
ListView_SetItem(preview, &row);
row.iSubItem = 3;
sprintf(numstr, "%u", program.info.end);
ListView_SetItem(preview, &row);
}
}
if (row_num == 1) {
ListView_SetItemState(preview, 0, LVIS_SELECTED, LVIS_SELECTED);
SetWindowTextA(c64name, program.info.name);
}
else {
SetWindowTextA(c64name, "");
if (IsWindowEnabled(preview))
ListView_SetItemState(preview, 0, LVIS_FOCUSED, LVIS_FOCUSED);
}
fclose(fd);
}
开发者ID:bitfixer,项目名称:bitfixer,代码行数:87,代码来源:prg2wav_gui.c
示例13: GetClientRect
void CCJFlatComboBox::DrawCombo(DRAWSTATE eStyle, COLORREF clrTopLeft, COLORREF clrBottomRight)
{
CRect rcItem;
GetClientRect(&rcItem);
CDC* pDC = GetDC();
// Cover up dark 3D shadow.
pDC->Draw3dRect(rcItem, clrTopLeft, clrBottomRight);
rcItem.DeflateRect(1,1);
if (!IsWindowEnabled()) {
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
}
else {
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
}
// Cover up dark 3D shadow on drop arrow.
rcItem.DeflateRect(1,1);
rcItem.left = rcItem.right-::GetSystemMetrics(SM_CXHTHUMB);;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
// Cover up normal 3D shadow on drop arrow.
rcItem.DeflateRect(1,1);
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNFACE),
::GetSysColor(COLOR_BTNFACE));
if (!IsWindowEnabled()) {
return;
}
switch (eStyle)
{
case FC_DRAWNORMAL:
rcItem.top -= 1;
rcItem.bottom += 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
rcItem.left -= 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNHIGHLIGHT));
break;
case FC_DRAWRAISED:
rcItem.top -= 1;
rcItem.bottom += 1;
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNHIGHLIGHT),
::GetSysColor(COLOR_BTNSHADOW));
break;
case FC_DRAWPRESSD:
rcItem.top -= 1;
rcItem.bottom += 1;
rcItem.OffsetRect(1,1);
pDC->Draw3dRect(rcItem, ::GetSysColor(COLOR_BTNSHADOW),
::GetSysColor(COLOR_BTNHIGHLIGHT));
break;
}
ReleaseDC(pDC);
}
开发者ID:52piaoyu,项目名称:gh0st,代码行数:65,代码来源:CJFlatComboBox.cpp
示例14: BackgroundDlgProc
//.........这里部分代码省略.........
DBVARIANT dbv, dbvText;
HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam;
if (hContact != NULL) {
char *szProto = GetContactProto(hContact);
if (szProto == NULL) break;
bool proto_service = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_INFOSETTINGSVC) == PF4_INFOSETTINGSVC;
SetValue(hwndDlg, IDC_WEBPAGE, hContact, szProto, "Homepage", SVS_ZEROISUNSPEC);
//past
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_PAST));
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Past%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Past%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%d", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Affiliation%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PAST), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PAST), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
ResizeColumns(GetDlgItem(hwndDlg, IDC_PAST));
//interests
ListView_DeleteAllItems(GetDlgItem(hwndDlg, IDC_INTERESTS));
lvi.mask = LVIF_TEXT;
lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dCat", i);
if ((proto_service && Proto_GetContactInfoSetting(hContact, szProto, szProto, idstr, &dbv, DBVT_TCHAR)) ||
( !proto_service && db_get_ts(hContact, szProto, idstr, &dbv)))
break;
mir_snprintf(idstr, SIZEOF(idstr), "Interest%dText", i);
if (db_get_ts(hContact, szProto, idstr, &dbvText))
{if (proto_service) Proto_FreeInfoVariant(&dbv); else db_free(&dbv); break;}
lvi.pszText = dbv.ptszVal;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_INTERESTS), &lvi);
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_INTERESTS), lvi.iItem, 1, dbvText.ptszVal);
db_free(&dbvText);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
else
db_free(&dbv);
lvi.iItem++;
}
ResizeColumns(GetDlgItem(hwndDlg, IDC_INTERESTS));
} }
break;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
SendMessage(GetParent(hwndDlg), msg, wParam, lParam);
break;
case IDC_WEBPAGE:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, SIZEOF(szPage));
CallService(MS_UTILS_OPENURL, 1, (LPARAM)szPage);
}
break;
}
break;
}
return FALSE;
}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:101,代码来源:stdinfo.cpp
示例15: RGB
void CBtnRoundImg::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC); //°´Å¥¿Ø¼þDC
COLORREF clrBK = RGB(255,255,255);
switch(m_nCtrlState)
{
case CTRL_NOFOCUS:
clrBK = m_clrBKUnfocus;
break;
case CTRL_FOCUS:
clrBK = m_clrBKFocus;
break;
case CTRL_SELECTED:
clrBK = m_clrBKSelected;
break;
default:
break;
}
if (IsWindowEnabled()==FALSE)
{
clrBK = m_clrBKDisable;
}
//draw background
CRect rect(lpDrawItemStruct->rcItem);
//dc.FillSolidRect(&rect,clrBK);
DrawRoundRect(dc, 5,rect,clrBK);
//draw image
if (m_strPngPath != _T(""))
{
Gdiplus::Image imageBtn(m_strPngPath);
if (imageBtn.GetLastStatus() != Ok)
{
ASSERT(FALSE);
}
;
HRGN hRgnOld = (HRGN)::SelectObject(lpDrawItemStruct->hDC, m_hRgnBtn);
Gdiplus::Graphics * pGrp = Graphics::FromHDC(lpDrawItemStruct->hDC);
pGrp->Clear(Color::White);
CRect rectBtn;
GetClientRect(&rectBtn);
int startX = (rectBtn.Width() - imageBtn.GetWidth())/2;
int startY = (rectBtn.Height() - imageBtn.GetHeight())/2;
startX = 0;
startY = 0;
if (lpDrawItemStruct->itemState & ODS_SELECTED) //Ñ¡ÖÐ״̬£¬Í¼Æ¬Æ«ÒÆÒ»¸öÏñËØ
{
pGrp->DrawImage(&imageBtn, startX+1, startY+1, startX+imageBtn.GetWidth(), startY+imageBtn.GetHeight());
}
else //ĬÈÏ״̬
{
pGrp->DrawImage(&imageBtn, startX, startY, startX+imageBtn.GetWidth(), startY+imageBtn.GetHeight());
}
delete pGrp;
pGrp = NULL;
::SelectObject(lpDrawItemStruct->hDC, hRgnOld);
}
CFont* pOldFont;
if (m_pFont)
{
pOldFont = dc.SelectObject(m_pFont);
}
COLORREF clrOld = dc.SetTextColor(m_clrFont);
CString strText;
GetWindowText(strText);
if (strText != _T(""))
{
int test = 1;
}
int oldMode = dc.SetBkMode(TRANSPARENT);
dc.DrawText(strText, -1, &lpDrawItemStruct->rcItem, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
dc.SetBkMode(oldMode);
dc.SetTextColor(clrOld);
if (m_pFont)
{
dc.SelectObject(pOldFont);
}
dc.Detach();
}
开发者ID:njustccy,项目名称:NjustTool,代码行数:89,代码来源:CBtnRoundImg.cpp
示例16: WepWindowsPageProc
//.........这里部分代码省略.........
{
PostMessage(selectedNode->WindowHandle, WM_CLOSE, 0, 0);
}
}
break;
case ID_WINDOW_VISIBLE:
{
PWE_WINDOW_NODE selectedNode;
if (selectedNode = WeGetSelectedWindowNode(&context->TreeContext))
{
if (IsWindowVisible(selectedNode->WindowHandle))
{
selectedNode->WindowVisible = FALSE;
ShowWindowAsync(selectedNode->WindowHandle, SW_HIDE);
}
else
{
selectedNode->WindowVisible = TRUE;
ShowWindowAsync(selectedNode->WindowHandle, SW_SHOW);
}
PhInvalidateTreeNewNode(&selectedNode->Node, TN_CACHE_COLOR);
TreeNew_InvalidateNode(context->TreeNewHandle, &selectedNode->Node);
}
}
break;
case ID_WINDOW_ENABLED:
{
PWE_WINDOW_NODE selectedNode;
if (selectedNode = WeGetSelectedWindowNode(&context->TreeContext))
{
EnableWindow(selectedNode->WindowHandle, !IsWindowEnabled(selectedNode->WindowHandle));
}
}
break;
case ID_WINDOW_ALWAYSONTOP:
{
PWE_WINDOW_NODE selectedNode;
if (selectedNode = WeGetSelectedWindowNode(&context->TreeContext))
{
LOGICAL topMost;
topMost = GetWindowLong(selectedNode->WindowHandle, GWL_EXSTYLE) & WS_EX_TOPMOST;
SetWindowPos(selectedNode->WindowHandle, topMost ? HWND_NOTOPMOST : HWND_TOPMOST,
0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
}
break;
case ID_OPACITY_10:
case ID_OPACITY_20:
case ID_OPACITY_30:
case ID_OPACITY_40:
case ID_OPACITY_50:
case ID_OPACITY_60:
case ID_OPACITY_70:
case ID_OPACITY_80:
case ID_OPACITY_90:
case ID_OPACITY_OPAQUE:
{
PWE_WINDOW_NODE selectedNode;
if (selectedNode = WeGetSelectedWindowNode(&context->TreeContext))
{
开发者ID:amitamitamitamit,项目名称:processhacker2,代码行数:67,代码来源:wnddlg.c
示例17: _run_wizard_action
void _run_wizard_action(
HWND hwnd,
_wz_sheets *sheets,
_dnode *node
)
{
BOOL set_loader = (BOOL)
SendMessage(
GetDlgItem(sheets[WPAGE_ENC_BOOT].hwnd, IDC_COMBO_BOOT_INST), CB_GETCURSEL, 0, 0
);
wchar_t *fs_name =
fs_names[SendMessage(
GetDlgItem(sheets[WPAGE_ENC_FRMT].hwnd, IDC_COMBO_FS_LIST), CB_GETCURSEL, 0, 0
)];
int kb_layout = _get_combo_val( GetDlgItem(sheets[WPAGE_ENC_PASS].hwnd, IDC_COMBO_KBLAYOUT), kb_layouts );
BOOL q_format = _get_check( sheets[WPAGE_ENC_FRMT].hwnd, IDC_CHECK_QUICK_FORMAT );
int is_small = (
IsWindowEnabled( GetDlgItem( sheets[WPAGE_ENC_CONF].hwnd, IDC_COMBO_ALGORT ) ) ? FALSE : TRUE
);
crypt_info crypt;
dc_pass *pass = NULL;
crypt.cipher_id = _get_combo_val( GetDlgItem(sheets[WPAGE_ENC_CONF].hwnd, IDC_COMBO_ALGORT), cipher_names );
crypt.wp_mode = _get_combo_val( GetDlgItem(sheets[WPAGE_ENC_CONF].hwnd, IDC_COMBO_PASSES), wipe_modes );
node->dlg.rlt = ST_ERROR;
switch ( node->dlg.act_type )
{
///////////////////////////////////////////////////////////////
case ACT_REENCRYPT :
///////////////////////////////////////////////////////////////
/////// REENCRYPT VOLUME //////////////////////////////////////
{
wchar_t mnt_point[MAX_PATH] = { 0 };
wchar_t vol[MAX_PATH];
dlgpass dlg_info = { node, NULL, NULL, mnt_point };
ShowWindow(hwnd, FALSE);
if ( _dlg_get_pass(__dlg, &dlg_info) == ST_OK )
{
node->mnt.info.status.crypt.wp_mode = crypt.wp_mode;
node->dlg.rlt = dc_start_re_encrypt( node->mnt.info.device, dlg_info.pass, &crypt );
secure_free( dlg_info.pass );
if ( mnt_point[0] != 0 )
{
_snwprintf( vol, sizeof_w(vol), L"%s\\", node->mnt.info.w32_device );
_set_trailing_slash( mnt_point );
if ( SetVolumeMountPoint(mnt_point, vol) == 0 )
{
__error_s( __dlg, L"Error when adding mount point", node->dlg.rlt );
}
}
} else {
node->dlg.rlt = ST_CANCEL;
}
}
break;
///////////////////////////////////////////////////////////////
case ACT_ENCRYPT_CD :
///////////////////////////////////////////////////////////////
/////// ENCRYPT CD ////////////////////////////////////////////
{
_init_speed_stat( &node->dlg.iso.speed );
pass = _get_pass_keyfiles( sheets[WPAGE_ENC_PASS].hwnd, IDE_PASS, IDC_USE_KEYFILES, KEYLIST_CURRENT );
if ( pass )
{
DWORD resume;
{
wchar_t s_src_path[MAX_PATH] = { 0 };
wchar_t s_dst_path[MAX_PATH] = { 0 };
GetWindowText( GetDlgItem(sheets[WPAGE_ENC_ISO].hwnd, IDE_ISO_SRC_PATH), s_src_path, sizeof_w(s_src_path) );
GetWindowText( GetDlgItem(sheets[WPAGE_ENC_ISO].hwnd, IDE_ISO_DST_PATH), s_dst_path, sizeof_w(s_dst_path) );
wcscpy( node->dlg.iso.s_iso_src, s_src_path );
wcscpy( node->dlg.iso.s_iso_dst, s_dst_path );
node->dlg.iso.cipher_id = crypt.cipher_id;
node->dlg.iso.pass = pass;
}
node->dlg.iso.h_thread =
CreateThread(
NULL, 0, _thread_enc_iso_proc, pv(node), CREATE_SUSPENDED, NULL
);
SetThreadPriority( node->dlg.iso.h_thread, THREAD_PRIORITY_LOWEST );
resume = ResumeThread( node->dlg.iso.h_thread );
if ( !node->dlg.iso.h_thread || resume == (DWORD) -1 )
//.........这里部分代码省略.........
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:101,代码来源:prc_wizard_encrypt.c
示例18: DisplayReplayProperties
static void DisplayReplayProperties(HWND hDlg, bool bClear)
{
UINT8 movie_header[INP_HEADER_SIZE];
static bool bReadOnlyStatus = true;
UINT32 total_frames;
UINT32 rerecord_count;
// save status of read only checkbox
if (IsWindowEnabled(GetDlgItem(hDlg, IDC_READONLY))) {
bReadOnlyStatus = (BST_CHECKED == SendDlgItemMessage(hDlg, IDC_READONLY, BM_GETCHECK, 0, 0));
}
// set default values
SetDlgItemTextA(hDlg, IDC_LENGTH, "");
SetDlgItemTextA(hDlg, IDC_FRAMES, "");
SetDlgItemTextA(hDlg, IDC_UNDO, "");
// SetDlgItemTextA(hDlg, IDC_METADATA, "");
// SetDlgItemTextA(hDlg, IDC_REPLAYRESET, "");
EnableWindow(GetDlgItem(hDlg, IDC_READONLY), FALSE);
SendDlgItemMessage(hDlg, IDC_READONLY, BM_SETCHECK, BST_UNCHECKED, 0);
EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
if(bClear) {
return;
}
long lCount = SendDlgItemMessage(hDlg, IDC_CHOOSE_LIST, CB_GETCOUNT, 0, 0);
long lIndex = SendDlgItemMessage(hDlg, IDC_CHOOSE_LIST, CB_GETCURSEL, 0, 0);
if (lIndex == CB_ERR) {
return;
}
if (lIndex == lCount - 1) { // Last item is "Browse..."
EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); // Browse is selectable
return;
}
long lStringLength = SendDlgItemMessage(hDlg, IDC_CHOOSE_LIST, CB_GETLBTEXTLEN, (WPARAM)lIndex, 0);
if(lStringLength + 1 > _MAX_PATH) {
return;
}
SendDlgItemMessage(hDlg, IDC_CHOOSE_LIST, CB_GETLBTEXT, (WPARAM)lIndex, (LPARAM)szChoice);
// check relative path
GetRecordingPath(szChoice);
// open the playback file
FILE* fd = _wfopen(szChoice, L"r+b");
if (!fd) {
return;
}
if (fread(movie_header, 1, sizeof(movie_header), fd) != sizeof(movie_header))
return;
if (memcmp(movie_header, "MAMETAS\0", 8) != 0)
return;
if (movie_header[0x08] != INP_HEADER_MAJVERSION)
return;
if (_waccess(szChoice, W_OK)) {
SendDlgItemMessage(hDlg, IDC_READONLY, BM_SETCHECK, BST_CHECKED, 0);
} else {
EnableWindow(GetDlgItem(hDlg, IDC_READONLY), TRUE);
SendDlgItemMessage(hDlg, IDC_READONLY, BM_SETCHECK, BST_CHECKED, 0); //read-only by default
}
/*
fread(&movieFlags, 1, 1, fd); // Read identifier
if (movieFlags&MOVIE_FLAG_FROM_POWERON) // starts from reset
bStartFromReset = 1;
else
bStartFromReset = 0;
if (!bStartFromReset) {
memset(ReadHeader, 0, 4);
fread(ReadHeader, 1, 4, fd); // Read identifier
if (memcmp(ReadHeader, szSavestateHeader, 4)) { // Not the chunk type
fclose(fd);
return;
}
*/
fread(&total_frames, 1, sizeof(total_frames), fd);
fread(&rerecord_count, 1, sizeof(rerecord_count), fd);
/*
// read metadata
fseek(fd, nChunkDataPosition + nChunkSize, SEEK_SET);
memset(ReadHeader, 0, 4);
fread(ReadHeader, 1, 4, fd); // Read identifier
if (memcmp(ReadHeader, szMetadataHeader, 4) == 0) {
nChunkSize = 0;
fread(&nChunkSize, 1, 4, fd);
int nMetaLen = nChunkSize >> 1;
if(nMetaLen >= MAX_METADATA) {
nMetaLen = MAX_METADATA-1;
}
local_metadata = (wchar_t*)malloc((nMetaLen+1)*sizeof(wchar_t));
int i;
for(i=0; i<nMetaLen; ++i) {
//.........这里部分代码省略.........
开发者ID:0xZERO3,项目名称:mame-rr,代码行数:101,代码来源:movie.c
示例19: screen
void CRRECRuler::OnPaint()
/* ============================================================
Function : CRRECRuler::OnPaint
Description : Handles the "WM_PAINT" message from Windows.
Draws the ruler to a memory "CDC" that is
blitted to the screen (double buffering)
Access : Protected
Return : void
Parameters : none
Usage : Called from MFC
============================================================*/
{
CPaintDC mainDC(this);
// Set up data
int pos = GetParent()->SendMessage( urm_GETSCROLLPOS );
CRect rect;
GetClientRect( rect );
// Create off-screen canvas
CDC dc;
CBitmap bmp;
bmp.CreateCompatibleBitmap( &mainDC, rect.Width(), rect.Height() );
dc.CreateCompatibleDC( &mainDC );
CBitmap* oldbmp = dc.SelectObject( &bmp );
dc.FillSolidRect( rect, m_crBack);
// Set up canvas
BOOL bEnabled = IsWindowEnabled();
COLORREF crBack = GetSysColor(bEnabled ? COLOR_WINDOW : COLOR_3DFACE);
COLORREF crText = GetSysColor(bEnabled ? COLOR_WINDOWTEXT : COLOR_3DSHADOW);
// Set up data for the inner ruler
|
请发表评论