如何开发自己的界面库
比如MagicSkin的,只要加载其动态库和两三句话,那些控件就自动全变为新的界面了
而自己开发的自绘控件,要用的话还要挨个加一堆成员变量关联一下,好烦
想把自己开发的控件也作成dll的,但是如何让其一加载就自动替换原有的button等等控件呢
还有一个:如何开发自己的SDK,像BCG ControlBar在新建工程时,出现自己的wizard,之后自动生成C++代码的demo,方便他人进行二次开发
还请高手指点
问题点数:100、回复次数:2Top
1 楼goodboyws(深夜不眠者(VCMVP))回复于 2005-08-23 00:05:17 得分 60
**如何让其一加载就自动替换原有的button等等控件***
BOOL CMySkintDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
ApplyControlSkin(); }
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CContentDlgBase::ApplyControlSkin()
{
HWND hWnd = ::GetWindow(m_hWnd, GW_CHILD);
while (hWnd)
{
TCHAR szClassName[MAX_PATH];
memset(szClassName,0, sizeof(szClassName));
GetClassName(hWnd, szClassName, MAX_PATH);
if (_tcscmp(szClassName, "Static") == 0
&& hWnd != m_SkinVerticleScrollbar.m_hWnd)
{
//绑定没有被绑定的Static控件
CWnd* pWnd =CWnd::FromHandlePermanent(hWnd);
if (pWnd == NULL)
{
CTransparentStatic* pStatic = new CTransparentStatic;
pStatic->m_colTextColor = m_colTextColor;
pStatic->SubclassWindow(hWnd);
m_arrPtrStatic.Add(pStatic);
}
}
else if (_tcscmp(szClassName, "Button") == 0)
{
//绑定没有被绑定的按钮控件
CWnd* pWnd =CWnd::FromHandlePermanent(hWnd);
if (pWnd == NULL)
{
CHoverButton* pButton = new CHoverButton;
pButton->SubclassWindow(hWnd); CString strText;
pButton->GetWindowText(strText);
if (strText.GetLength() <= 4)
pButton->LoadBitmap(m_strBtnBmp2, m_colTransparent);
else if (strText.GetLength() <= 6)
pButton->LoadBitmap(m_strBtnBmp3, m_colTransparent);
else
pButton->LoadBitmap(m_strBtnBmp4, m_colTransparent);
m_arrPtrButton.Add(pButton);
}
}
hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
}
}
这是我做的界面库的自动替换button和Static的代码
**如何开发自己的SDK,像BCG ControlBar在新建工程时,出现自己的wizard**
VC++支持自定义向导
选择Project —— Custom AppWizard 可以根据已有工程的代码创建新的工程Top
2 楼humourHM(小鬼)回复于 2005-08-23 12:04:25 得分 40
http://www.vckbase.com/document/viewdoc/?id=1235Top




