Exemplo n.º 1
0
BOOL CCSHPropertySheet::OnInitDialog() 
{
  CPropertySheet::OnInitDialog();
  if(0==HelpID(IDOK)){
    // Dynamically add/remove the question mark button to the title bar of the dialog box:
    ModifyStyleEx(WS_EX_CONTEXTHELP,0,0);
  } else {
    ModifyStyleEx(0,WS_EX_CONTEXTHELP,0);
  }
  
  if(CSHFile().IsEmpty()){
    // All of the following mess happens because Microsoft decided to show a help button by 
    // default to every Property sheet constructed by Visual C++ 6.In the following lines, 
    // I hide the help button and move the other three buttons to where they should be.
    CWnd *pwndHelpButton=GetDlgItem(IDHELP);
    if(pwndHelpButton){
      static const int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
    
      for (int i = 0; i < sizeof _afxPropSheetButtons/sizeof _afxPropSheetButtons[0] - 1; i++){
        // Shunt button   
        CRect rect;
        GetDlgItem(_afxPropSheetButtons[i+1])->GetWindowRect(&rect);
        ScreenToClient(&rect);
        GetDlgItem(_afxPropSheetButtons[i])->MoveWindow(&rect);
      }
      pwndHelpButton->DestroyWindow();    
    }    
  }
  return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 2
0
CLabel& CLabel::SetSunken(BOOL bSet)
{
	if (!bSet)
		ModifyStyleEx(WS_EX_STATICEDGE,0,SWP_DRAWFRAME);
	else
		ModifyStyleEx(0,WS_EX_STATICEDGE,SWP_DRAWFRAME);
		
	return *this;	
}
Exemplo n.º 3
0
void CButtonCx::SetDrawFrame(BOOL bDrawFrame)
{
	if (bDrawFrame)
	{
		// スタティックエッジを有効
		ModifyStyleEx(0, WS_EX_STATICEDGE, SWP_DRAWFRAME);
	}
	else
	{
		// スタティックエッジを無効
		ModifyStyleEx(WS_EX_STATICEDGE, 0, SWP_DRAWFRAME);
	}
}
Exemplo n.º 4
0
BOOL CXColorStatic::SetPlainBorder(BOOL bSet)
{
	if (bSet)
		{
		// This odd line is to force the NC area to be invalidated
		ModifyStyleEx(0, WS_EX_STATICEDGE | WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE, 0);

		ModifyStyle(0, WS_BORDER, 0);
		ModifyStyleEx(WS_EX_STATICEDGE | WS_EX_CLIENTEDGE | WS_EX_WINDOWEDGE, 0, SWP_FRAMECHANGED);
		}
	else
		ModifyStyle(WS_BORDER|WS_TABSTOP, 0, SWP_FRAMECHANGED);
	RedrawWindow();
	return TRUE;
}
BOOL CGCColorStatic::SetModalFrame(const BOOL bModal)
{
	BOOL Result = FALSE;

	if (bModal)
	{
		if (m_bColorFrameFlag) SetColorFrame(FALSE);	// Color frame and modal frame mutually exclusive.

		Result = ModifyStyleEx(0,WS_EX_DLGMODALFRAME,SWP_DRAWFRAME);
	}
	else
		Result = ModifyStyleEx(WS_EX_DLGMODALFRAME,0,SWP_DRAWFRAME);
   
	return Result;
}
Exemplo n.º 6
0
// http://www.codeguru.com/Cpp/frameworks/advancedui/article.php/c3227/
BOOL CMainFrame::ShowTaskBarButton(BOOL bVisible)
{
    if (!m_bOwnerCreated) return FALSE;

    ShowWindow(SW_HIDE);

    if (bVisible)
        ModifyStyleEx(0, WS_EX_APPWINDOW);
    else
        ModifyStyleEx(WS_EX_APPWINDOW, 0);

    ShowWindow(SW_SHOW);

    return TRUE;
}
BOOL CGCColorStatic::SetSunken(const BOOL bSunken)
{
	BOOL Result = FALSE;

	if (bSunken)
	{
		if (m_bColorFrameFlag) SetColorFrame(FALSE);	// Color frame and sunken frame mutually exclusive.

		Result = ModifyStyleEx(0,WS_EX_STATICEDGE,SWP_DRAWFRAME);
	}
	else
		Result = ModifyStyleEx(WS_EX_STATICEDGE,0,SWP_DRAWFRAME);

	return Result;
}
Exemplo n.º 8
0
BOOL CSplashDlg::Create( CWnd* pParentWnd, int nShowTime, LPCTSTR lpszUser,
						LPCTSTR lpszRegCode, LPCTSTR lpszVersionString, 
						BOOL bAutoDelete, int nMin, int nMax )
{
	if( ! CXFResDialog::Create( CSplashDlg::IDD, pParentWnd) )
	{
		ASSERT( FALSE );
		return	FALSE;
	}
	ModifyStyleEx( 0, WS_EX_TOOLWINDOW );
	//ModifyStyleEx( 0, WS_EX_TRANSPARENT );

	if( nShowTime > 0 )
		SetTimer( 1, nShowTime, NULL );

	CString	strVersion	=	lpszVersionString;
	if( strVersion.GetLength() > 0 )
		m_staticVersion.SetWindowText( strVersion );

	CString	strUser;
	if( NULL != lpszUser )		strUser	=	lpszUser;
	if( strUser.IsEmpty() )		strUser	=	AfxModuleLoadString( IDS_XFAUTHORIZEDUSER_UNKNOWN );
	m_staticUser.SetWindowText( strUser );

	CString	strRegCode;
	if( NULL != lpszRegCode )	strRegCode	=	lpszRegCode;
	if( strRegCode.IsEmpty() )	strRegCode	=	AfxModuleLoadString( IDS_XFREGCODE_UNPURCHASED );
	m_staticRegCode.SetWindowText( strRegCode );

	m_bAutoDelete	=	bAutoDelete;

	SetProgressRange( nMin, nMax );

	return	TRUE;
}
BOOL CxResLibImgList::OnInit( void )
{
	//
	SetAutoDelete(TRUE);
	//图片模式
	if ( !SetImageMode() ) return FALSE;
	//背景色
//	m_crCanvasBk = Color::LightGreen;
	//图片尺寸、间距、透明色
	InitImageLayout(90, 100, 1, 1, 42, 42);
	SetFont(NULL);

	//
	COLORREF clr = RGB(m_crCanvasBk.GetR(), m_crCanvasBk.GetG(), m_crCanvasBk.GetB());
	SetBkColor(clr);

	OnLoadStateImage();
	OnLoadTextFont();

	ModifyStyle(DS_3DLOOK, WS_CLIPCHILDREN|WS_CLIPSIBLINGS);
	ModifyStyleEx(WS_EX_CLIENTEDGE, 0);

	m_ToolTip.Create (this);

	m_RMenu.LoadMenu(IDR_RESLIB_LIST_POP);
	CMenu * pPopup = m_RMenu.GetSubMenu(0);
	m_wndDummy.Create(WS_CHILD, CRect(0,0,0,0),this, IDC_RESLIBIMGLIST_DUMMY);
	return TRUE;
}
BOOL 
CGlobalCWizardSheet::OnInitDialog() 
{
	CMenu		*pSysMenu;
	HDC			hDC;
	PGPBoolean	loadedBitmap;
	PGPUInt32	numBits;

	CPropertySheet::OnInitDialog();

	// Get screen depth.
	hDC = ::GetDC(NULL);		// DC for desktop
	numBits = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
	::ReleaseDC(NULL, hDC);

	// Load the bitmap and create a palette for it.
	if (numBits <= 1)
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR1, 
			&mSidebarBitmap, &mSidebarPalette);
	}
	else if (numBits <= 4)
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR4, 
			&mSidebarBitmap, &mSidebarPalette);
	}
	else
	{
		loadedBitmap = App->GetBitmapAndPalette(IDB_SIDEBAR8, 
			&mSidebarBitmap, &mSidebarPalette);
	}

	// Need to give the dialog a close box if we want a help box as well.
	ModifyStyle(NULL, WS_SYSMENU, NULL);

	// Show the context help button.
	ModifyStyleEx(NULL, WS_EX_CONTEXTHELP, NULL);

	// Alter the system menu.
	pSysMenu = GetSystemMenu(FALSE);
	pgpAssertAddrValid(pSysMenu, CMenu);

	pSysMenu->DeleteMenu(SC_MINIMIZE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_MAXIMIZE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_RESTORE, MF_BYCOMMAND);
	pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);

	DrawMenuBar();

	// Center on screen.
	CenterWindow(GetDesktopWindow());

	// Put us in front.
	SetForegroundWindow();

	// Put on top if necessary.
	App->TweakOnTopAttribute(this);

	return TRUE;
}
Exemplo n.º 11
0
BOOL CFileTransDlg::OnInitDialog()
{
	int fuLoad = LR_DEFAULTCOLOR;

	if (fv->HideDialog) {
		// Visible = False でもフォアグラウンドに来てしまうので、そうならない
		// ように拡張スタイル WS_EX_NOACTIVATE を指定する。
		// (Windows 2000 以上で有効)
		// WS_EX_NOACTIVATE を指定すると表示されている時もタスクバーに現れない
		// ので WS_EX_APPWINDOW も指定する。
		ModifyStyleEx(0, WS_EX_NOACTIVATE | WS_EX_APPWINDOW);
	}

	SetWindowText(fv->DlgCaption);
	SetDlgItemText(IDC_TRANSFNAME, &(fv->FullName[fv->DirLen]));

	// ログファイルはフルパス表示にする(2004.8.6 yutaka)
	SetDlgItemText(IDC_EDIT_FULLPATH, &(fv->FullName[0]));

	if (is_NT4()) {
		fuLoad = LR_VGACOLOR;
	}
	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_SMALL,
	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
	                                MAKEINTRESOURCE(IDI_TTERM),
	                                IMAGE_ICON,16,16,fuLoad));
	::PostMessage(GetSafeHwnd(),WM_SETICON,ICON_BIG,
	              (LPARAM)LoadImage(AfxGetInstanceHandle(),
	                                MAKEINTRESOURCE(IDI_TTERM),
	                                IMAGE_ICON, 0, 0, fuLoad));

	return 1;
}
Exemplo n.º 12
0
int CPaodaoBtnDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码
	ASSERT(m_pSkinEngine != NULL);
	if (NULL != m_pSkinEngine)
	{
		HRESULT hr = m_pSkinEngine->LoadSkin(GetSafeHwnd(),L"PaodaoBtnDlg");
		ASSERT(hr == S_OK && __LINE__);
	}
	ModifyStyleEx( WS_EX_APPWINDOW , 0 ) ;
	ModifyStyleEx( WS_EX_TOOLWINDOW , 0 ) ;
	return 0;
}
Exemplo n.º 13
0
BOOL OptionsDialog::OnInitDialog() 
{
  CPropertySheet::OnInitDialog();

  // Enable context sensitive help
  ModifyStyleEx(0,WS_EX_CONTEXTHELP);

  // Create the font to use
  m_font.CreateFontIndirect(&m_logFont);

  // Set the font for the property pages
  ChangeDialogFont(this,&m_font);
  CPropertyPage* page = GetActivePage();
  for (int i = 0; i < GetPageCount(); i++)
  {
    SetActivePage(i);
    CPropertyPage* page = GetActivePage();
    ChangeDialogFont(page,&m_font);
  }
  SetActivePage(page);

  // Resize the property page
  CTabCtrl* tab = GetTabControl();
  tab->GetWindowRect(&m_page);
  ScreenToClient(&m_page);
  tab->AdjustRect(FALSE,&m_page);
  page->MoveWindow(&m_page);

  return TRUE;
}
Exemplo n.º 14
0
BOOL CDrawerDlg::OnInitDialog()
{
    CDlgBase::OnInitDialog();

    //SetLayeredWindowAttributes(RGB(220,238,212),100,LWA_COLORKEY);
    //设置透明
    ModifyStyleEx(0,0x00080000);
    HINSTANCE hInst = LoadLibrary(_T("User32.DLL"));
    if(hInst)
    {
        typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
        MYFUNC fun = NULL;
        //取得SetLayeredWindowAttributes()函数指针
        fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
        if(fun)fun(this->GetSafeHwnd(),RGB(255,235,205),220,2);
        FreeLibrary(hInst);
    }

    CRect tRect;
    GetWindowRect(tRect);
    tRect.right = tRect.left + 327;
    tRect.bottom =tRect.top + 680;
    SetWindowPos(&wndTopMost,tRect);
    //界面和音效初始化
    m_hBrush=CreateSolidBrush(RGB(255,235,205));

    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}
Exemplo n.º 15
0
BOOL CWishSpeakerDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	ModifyStyleEx(0,WS_EX_TOOLWINDOW);

	m_pSpeakerInputHtml = new COutInputHtmlEditImpl ;
	m_pSpeakerInputHtml->SetHtmlEditLogic( &m_SpeakerInputLogic ) ;
	m_pSpeakerInputHtml->Create( this ,IDC_HTML_WISHSPEAKER_INPUT , CRect(0,0,0,0) , WS_CHILD|WS_VISIBLE) ;
	CComVariant var = (long)m_pSpeakerInputHtml->GetSafeHwnd() ;
	m_pSkinEngine->SetSubSkinProp(GetSafeHwnd(),L"itemHtmlWishSpeaker",L"hwnd",var);

	if (m_strInitContent == L"")
	{
		CString strContent;
		strContent.Format(DEFAULT_WISH_WORDS, m_pParentDlg->GetRoomID());
		SetInitContent(strContent);
	}

	SetTimer(CHECK_INPUT_LIMIT, 500, NULL);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Exemplo n.º 16
0
BOOL CTreeItemEdit::CreateFont(LONG lfHeight, LPCTSTR lpszFaceName)
{
	//  Create a font for the combobox
	LOGFONT logFont;
	memset(&logFont, 0, sizeof(logFont));

	if (!::GetSystemMetrics(SM_DBCSENABLED))
	{
		// Since design guide says toolbars are fixed height so is the font.
		logFont.lfHeight = lfHeight;
		//logFont.lfWeight = 0;
		CString strDefaultFont = lpszFaceName;
		lstrcpy(logFont.lfFaceName, strDefaultFont);
		if (!m_font.CreateFontIndirect(&logFont))
		{
			TRACE("Could Not create font for combo\n");
			return FALSE;
		}		
	}
	else
	{
		m_font.Attach(::GetStockObject(SYSTEM_FONT));
	}
	SetFont(&m_font);
	ModifyStyleEx(0, WS_EX_CLIENTEDGE|WS_EX_STATICEDGE, SWP_FRAMECHANGED);
	return TRUE;
}
Exemplo n.º 17
0
int AccountDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (langPack.rtl) {
		ModifyStyleEx(0,WS_EX_LAYOUTRTL);
	}
	return 0;
}
Exemplo n.º 18
0
BOOL CFaceSelDlg::OnInitDialog(CWindow wndFocus, LPARAM lInitParam)
{
	CRect rcClient;
	GetClientRect(&rcClient);

	m_FaceCtrl.SetBgColor(RGB(255, 255, 255));
	m_FaceCtrl.SetLineColor(RGB(223, 230, 246));
	m_FaceCtrl.SetFocusBorderColor(RGB(0, 0, 255));
	m_FaceCtrl.SetZoomBorderColor(RGB(0, 138, 255));
	m_FaceCtrl.SetRowAndCol(8, 15);
	m_FaceCtrl.SetItemSize(28, 28);
	m_FaceCtrl.SetZoomSize(84, 84);
	m_FaceCtrl.SetFaceList(m_lpFaceList);
	m_FaceCtrl.SetCurPage(0);

	CRect rcFaceCtrl(rcClient);
	rcFaceCtrl.left += 6;
	rcFaceCtrl.right = rcFaceCtrl.left + 420;
	rcFaceCtrl.top += 6;
	rcFaceCtrl.bottom = rcFaceCtrl.top + 224;
	m_FaceCtrl.Create(m_hWnd, rcFaceCtrl, NULL, WS_CHILD | WS_VISIBLE, 
		NULL, ID_FACE_CTRL, NULL);

	m_nSelFaceId = -1;
	m_nSelFaceIndex = -1;
	m_strSelFaceFileName = _T("");

	ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);

	return TRUE;
}
Exemplo n.º 19
0
BOOL CSysHtmlNotifyDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
	ModifyStyleEx( WS_EX_APPWINDOW , WS_EX_TOOLWINDOW) ;

	int cx = GetSystemMetrics(SM_CXSCREEN);  //屏幕宽度
	int cy = GetSystemMetrics(SM_CYSCREEN);  //屏幕高度
	// pSysNotifyDlg->SetWindowPos(NULL,cx - 250,cy - 170,250,170,SWP_SHOWWINDOW);
	RECT rect;
	::SystemParametersInfo(SPI_GETWORKAREA,sizeof(RECT),&rect,0); //工作区域大小
	RECT deskRect;
	::GetWindowRect(::GetDesktopWindow(),&deskRect); //桌面窗口大小
	int startHight = deskRect.bottom - rect.bottom;  //系统状态栏高度

	CRect clientRect(0,0,0,0);
	clientRect.left = cx - SYS_HTML_NOTIFY_WIDTH;
	clientRect.top = cy - startHight - SYS_HTML_NOTIFY_HIGHT;
	clientRect.right = clientRect.left + SYS_HTML_NOTIFY_WIDTH;
	clientRect.bottom = clientRect.top + SYS_HTML_NOTIFY_HIGHT;
	MoveWindow(&clientRect);

	CComVariant var;
	m_htmlSysNotify.CreateFromStatic(IDC_HTML_SYSNOTIFY, this);
	var = (LONG)m_htmlSysNotify.GetSafeHwnd();
	m_pSkinEngine->SetSubSkinProp(GetSafeHwnd(),L"itemHtmlSysNotify",L"hwnd",var);
	InitTheHtml();

	return FALSE;//处理抢焦点问题 

	//return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Exemplo n.º 20
0
BOOL CDlgResLib::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	CRect rcClient;
	GetClientRect(&rcClient);

	//m_wndSplitter.SubclassWindow(m_wndSplitter.GetSafeHwnd());
	//m_pFrameWnd->ModifyStyle(0, WS_CLIPSIBLINGS|WS_CLIPCHILDREN);
	m_pFrameWnd->MoveWindow(&rcClient); 
	m_pFrameWnd->ShowWindow(SW_SHOW); 

	//m_wndSplitter.ModifyStyle(WS_CLIPCHILDREN, 0); //Splitter 不能有 WS_CLIPCHILDREN 属性
	m_wndSplitter.MoveWindow(0,0, rcClient.Width(), rcClient.Height()); 
	m_wndSplitter.ShowWindow(SW_SHOW);

	m_wndSplitter.SetColumnInfo(0, rcClient.Width() / 4, 1);
	m_wndSplitter.SetColumnInfo(1, rcClient.Width() * 3 / 4, 1);
	m_wndSplitter.RecalcLayout();

	ModifyStyle(DS_3DLOOK, 0);
	ModifyStyleEx(WS_EX_CLIENTEDGE, 0);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
Exemplo n.º 21
0
BOOL CDlgOpentools::InitPaint()
{
	//////////////////////////////////////////////////////////////////////////

	m_dwStyle = GetWindowLong(m_hWnd, GWL_STYLE);
	m_dwExStyle = GetWindowLong(m_hWnd, GWL_EXSTYLE);

	ModifyStyle(WS_CAPTION|WS_BORDER|WS_DLGFRAME|WS_THICKFRAME, NULL);
	ModifyStyleEx(WS_EX_WINDOWEDGE|WS_EX_OVERLAPPEDWINDOW|WS_EX_PALETTEWINDOW, NULL);

	DWORD dwExStyle=GetWindowLong(m_hWnd,GWL_EXSTYLE);
	if((dwExStyle & WS_EX_LAYERED) != WS_EX_LAYERED)
		SetWindowLong(m_hWnd, GWL_EXSTYLE, dwExStyle^WS_EX_LAYERED);

	ImageFromIDResource(IDB_PNG_ANIMATE, "PNG", m_pImage);

	m_nSrcWidth = m_pImage->GetWidth();
	m_nSrcHeight = m_pImage->GetHeight();
		
	m_nDstWidth = 70;
	m_nDstHeight = 70;
	m_nFrameCount = 12;
	m_nFrameDelay = 90;

	m_Blend.BlendOp=0; //theonlyBlendOpdefinedinWindows2000
	m_Blend.BlendFlags=0; //nothingelseisspecial...
	m_Blend.AlphaFormat=1; //...
	m_Blend.SourceConstantAlpha=255;//AC_SRC_ALPHA

	SetTimer(TIMER_ANIMATE,m_nFrameDelay,NULL);
	//////////////////////////////////////////////////////////////////////////
	return TRUE;
}
int CArgumentsTableCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	ModifyStyle(0,LVS_REPORT | LVS_EDITLABELS | LVS_NOSORTHEADER | LVS_SINGLESEL);
	ModifyStyleEx(0,WS_EX_STATICEDGE);
	SetExtendedStyle(GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
	
	CRect rcClient;
	GetClientRect(&rcClient);
	InsertColumn(0,"Type",LVCFMT_LEFT,rcClient.Width()/2);
	InsertColumn(1,"Value",LVCFMT_LEFT,rcClient.Width()/2);	

	int nRow = 0;
	if(m_pArgs!=NULL) {
		int nCount = m_pArgs->GetCount();
		POSITION nIdx = m_pArgs->GetHeadPosition();
		while(nIdx!=NULL) {
			CArgument* pArg = m_pArgs->GetNext(nIdx);
			InsertItem(nRow,pArg->GetType());
			SetItemText(nRow,1,pArg->GetName());
			nRow++;
		}
	}
	InsertItem(nRow,CString(""));
	SetItemText(nRow,1,CString(""));
	
	return 0;
}
void CListBoxDiffMarks::substituteControl(CWnd *parent, int id) {
  DEFINEMETHODNAME;
  CListBox *oldCtrl = (CListBox*)parent->GetDlgItem(id);
  if(oldCtrl == NULL) {
    showError(_T("%s:Control with id=%d does not exist"), method, id);
    return;
  }
  CRect wr;
  oldCtrl->GetWindowRect(&wr);
  parent->ScreenToClient(&wr);
  DWORD style   = oldCtrl->GetStyle();
  const DWORD exStyle = oldCtrl->GetExStyle();
  style |= LBS_OWNERDRAWFIXED | WS_BORDER;
  style &= ~(LBS_SORT);

  CFont *font = oldCtrl->GetFont();
  if(font == NULL) {
    font = parent->GetFont();
  }
  const CompactIntArray tabOrder = getTabOrder(parent);
  oldCtrl->DestroyWindow();

  if(!Create(style, wr, parent, id)) {
    showError(_T("%s:Create failed"), method);
    return;
  }
  setTabOrder(parent, tabOrder);
  ModifyStyleEx(0, exStyle);
  SetFont(font);
  m_charSize.cx = m_charSize.cy = 0;
  setEqualSelected(::GetSysColor(COLOR_HIGHLIGHTTEXT),::GetSysColor(COLOR_HIGHLIGHT   ));
  setDiffSelected( ::GetSysColor(COLOR_HIGHLIGHT    ),::GetSysColor(COLOR_HIGHLIGHTTEXT));
}
Exemplo n.º 24
0
//@doc SECEditCtrl
//@mfunc This function should be called in the OnInitDialog handler
//for the dialog in which you want to place the SECEditCtrl.
//Note that this function destroys the window and replaces it, rather than
//just subclassing it. If you are replacing an Edit Control, you may use
//class wizard to map EN_SETFOCUS and EN_KILLFOCUS, and these notifications
//will be sent.
//@rdesc BOOL 
//@parm The ID of the control to replace
//@parm The parent window of SECEditCtrl
//@parm Extended style of the window (defaults to WS_EX_CLIENTEDGE)
//@comm dwExStyle defaults to WS_EX_CLIENTEDGE.
BOOL SECEditCtrl::Initialize(UINT nID, CWnd * pParentWnd, DWORD dwExStyle)
{
	CRect rect;
	CWnd* pWnd = pParentWnd->GetDlgItem(nID);
	pWnd->GetWindowRect(&rect);
	pParentWnd->ScreenToClient(&rect);

	// If creating dynamically, model your create call after this one
	BOOL bCreated = Create(NULL, _T("SECEdit"), WS_VISIBLE | WS_CHILD | WS_TABSTOP, 
						   rect, pParentWnd, nID);

	ASSERT(bCreated);
	if(!bCreated)
		return FALSE;

	// Set the Z-Order so this new control keeps the same tab order as the
	// control it is replacing
	SetWindowPos(pWnd, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

	// Destroy the control being replaced
	pWnd->DestroyWindow();

	// Add 3D border to control
	ModifyStyleEx(NULL, dwExStyle, SWP_FRAMECHANGED);

	return bCreated;
}
Exemplo n.º 25
0
void CRelaxReminderDlg::InitShowFloatingWindow()
{
    // 初始化窗口尺寸
    InitFloatingWindowPos();
    MoveWindow(m_rectFloatingWindow);
    
    // 初始化显示设置
    GetDlgItem(IDC_STATIC_TIMETIPS)->MoveWindow(0, 0,
        m_rectFloatingWindow.Width() - 1,
        m_rectFloatingWindow.Height());
    GetDlgItem(IDC_STATIC_TIMETIPS)->SetWindowText("00:00");
    
    // 初始化悬浮窗口字体大小
    InitFloatingWindowFontSize();
    
    // 初始化全屏时隐藏悬浮窗口变量
    m_bFloatingWindowHidebyFullscr = FALSE;
    
    // 不在任务栏显示
    ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW, SWP_DRAWFRAME);
    
    // 设置窗口置顶
    SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
    
    if (m_bShowFloatingWindowAtStartup)
    {
        MakeFloatingWindowFixed();
    }
}
Exemplo n.º 26
0
//**************************************************************************************
BOOL CBCGPWindowsManagerDlg::OnInitDialog() 
{
	CBCGPDialog::OnInitDialog();
	
	if (AfxGetMainWnd () != NULL && 
		(AfxGetMainWnd ()->GetExStyle () & WS_EX_LAYOUTRTL))
	{
		ModifyStyleEx (0, WS_EX_LAYOUTRTL);
	}

	FillWindowList();

	// If no MDI actions are availible, hide all MDI-related buttons:

	if (!m_bMDIActions)
	{
		GetDlgItem(IDC_BCGBARRES_TILEHORZ)->ShowWindow (SW_HIDE);
		GetDlgItem(IDC_BCGBARRES_TILEVERT)->ShowWindow (SW_HIDE);
		GetDlgItem(IDC_BCGBARRES_CASCADE)->ShowWindow (SW_HIDE);
		GetDlgItem(IDC_BCGBARRES_MINIMIZE)->ShowWindow (SW_HIDE);
	}

	SelActive();
	UpdateButtons();

	CWnd* pBtnHelp = GetDlgItem (ID_HELP);
	if (pBtnHelp != NULL)
	{
		pBtnHelp->ShowWindow (m_bHelpButton ? SW_SHOW : SW_HIDE);
	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 27
0
CString CHistoryCombo::LoadHistory(LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix)
{
	if (!lpszSection || !lpszKeyPrefix || *lpszSection == '\0')
		return L"";

	m_sSection = lpszSection;
	m_sKeyPrefix = lpszKeyPrefix;

	int n = 0;
	CString sText;
	do
	{
		//keys are of form <lpszKeyPrefix><entrynumber>
		CString sKey;
		sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n++);
		sText = CRegString(sKey);
		if (!sText.IsEmpty())
			AddString(sText);
	} while (!sText.IsEmpty() && n < m_nMaxHistoryItems);

	SetCurSel(-1);

	ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE, 0);

	// need to resize the control for correct display
	CRect rect;
	GetWindowRect(rect);
	GetParent()->ScreenToClient(rect);
	MoveWindow(rect.left, rect.top, rect.Width(),100);

	return sText;
}
Exemplo n.º 28
0
BOOL CVenusDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	// TODO: 在此添加额外的初始化代码

	IDC_MYINFOTEXT = 63301;
	myIndex = new LocalPath();
	lastKey = "";
	lastInfoSize = 0;
	curStatus = false;

	// 设置窗口位置
	ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW);  //从任务栏中去掉
	SetWindowPos(NULL, 5, 5, 600, 300, 0);

	// 窗体透明
	SetBackgroundColor(RGB(1,11,21));
	LONG ExtendedStyle = GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE );
	SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,ExtendedStyle | WS_EX_LAYERED );
	::SetLayeredWindowAttributes(GetSafeHwnd(),RGB(1,11,21),0,LWA_COLORKEY);

	// 输入框字体大小
	editFont.CreatePointFont(240,"宋体");
	CEdit *myInput = (CEdit *)GetDlgItem(IDC_EDIT1);
	myInput->SetFont(&editFont);

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Exemplo n.º 29
0
BOOL CMainFrame::Show(HWND hwndParent, ICxScriptEditorSite* pSite, DWORD dwSymbolMask, CString& strText, BOOL& bModified, LPCTSTR lpszObject, LPCTSTR lpszEvent)
{
	USES_CONVERSION;
		
	RECT rc = {0, 0, 640, 480};

	if (CreateEx(hwndParent, &rc, WS_POPUP|WS_CAPTION|WS_SYSMENU|
			WS_THICKFRAME|WS_MAXIMIZEBOX/*, WS_EX_TOOLWINDOW*/) == NULL)
	{
		ATLTRACE(_T("CMainFrame creation failed!\n"));
		return FALSE;
	}

	m_bSave = FALSE;
	m_bPrompt = FALSE;
	
	m_hEvent = CreateEvent(0, 0, 0, 0);
	::EnableWindow(hwndParent, false);
	ModifyStyleEx(WS_EX_APPWINDOW, 0); //使窗口标题不显示在任务条上
	CenterWindow();
	ShowWindow(SW_SHOW);

	m_spScriptEditor->SetScriptEditorSite(pSite);
	m_spScriptEditor->AddGeneralSymbolPage(dwSymbolMask);
	m_spScriptEditor->put_Text(T2BSTR(strText));
	m_spScriptEditor->EditObjectEventHandler(T2BSTR(lpszObject), T2BSTR(lpszEvent), TRUE);	
	m_spScriptEditor->EmptyUndoBuffer();
	m_spScriptEditor->SetSavePoint();

	CWaitMessageLoop loop;
	loop.AddMessageFilter(this);
	loop.AddIdleHandler(this);
	loop.Run(m_hEvent);

	BOOL bModify;
	m_spScriptEditor->GetModify(&bModify);
	if (m_bPrompt && bModify)
	{
		if (MessageBox(_T("脚本改动保存吗?"), _T("询问"), MB_YESNO | MB_ICONQUESTION) == IDYES)
			m_bSave = TRUE;
	}

	if (m_bSave)
	{
		m_spScriptEditor->DeleteEmptyEventHandler();

		CComBSTR bstr;
		m_spScriptEditor->get_Text(&bstr);
		strText = bstr;
		bModified = TRUE;
	}

	::EnableWindow(hwndParent, true);			
	DestroyWindow();
	CloseHandle(m_hEvent);
	m_hEvent = 0;

	return TRUE;
}
Exemplo n.º 30
0
void CExtMiniDockFrameWnd::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
	CMiniDockFrameWnd::OnWindowPosChanging( lpwndpos );
	if( GetStyle() & __REMOVED_STYLES_NORMAL )
		ModifyStyle( __REMOVED_STYLES_NORMAL, 0, __SWP_FOR_REMOVED_STYLES );
	if( GetExStyle() & __REMOVED_STYLES_EXTENDED )
		ModifyStyleEx( __REMOVED_STYLES_EXTENDED, 0, __SWP_FOR_REMOVED_STYLES );
}