【转】 VC MFC 钩子 实现 自绘 窗体 标题栏 非客户区

效果:

681d628bde933a32c8fc7ad4.jpeg

程序:

#if !defined(_LJF_LJFHOOK_H)
#define _LJF_LJFHOOK_H

#if _MSC_VER > 1000
#pragma once
#endif
#include <afxtempl.h>
#define sLjfDialogOldProcTag _T("CDialog_oldProc")
#define SYSBTN_NON -1
#define SYSBTN_MIN 0
#define SYSBTN_NOM 1
#define SYSBTN_MAX 2
#define SYSBTN_CLS 3

#define SYSBTNSTATE_NOM 0
#define SYSBTNSTATE_OVER 1
#define SYSBTNSTATE_DOWN 2
#define SYSBTNSTATE_BLUR 3
#define SYSBTNSTATE_DIS 4

class CLjfDialogPrivateInfo
{
public:
CLjfDialogPrivateInfo();
HICON hIcon;
int iOrgCapHeight;
int iOrgBorderWidth;
CString strCaption;
BOOL bNcActive;
BOOL bNcLBtnDown;
BOOL bHasMaxBtn;
BOOL bHasMinBtn;
BOOL bHasCloseBtn;
RECT rWnd;
RECT rwndbtnClose;
RECT rwndbtnMax;
RECT rwndbtnMin;

RECT rwndC11;
RECT rwndC12;
RECT rwndC13;

RECT rwndC21;
RECT rwndC22;
RECT rwndC23;

RECT rwndC31;
RECT rwndC32;
RECT rwndC33;

RECT rwndC41;
RECT rwndC42;
RECT rwndC43;
RECT rwndCaption;
};
class CLjfDialogInfo
{
public:
CLjfDialogInfo();
~CLjfDialogInfo();
void PreparBitmapTranRgn(CBitmap* pBitmap);
void SetLjfWindowRgn(HWND hWnd,CLjfDialogPrivateInfo *_p);
bool GetInfoFromIniFile(CString sFileName);
void SetWindRect(HWND hWnd,CBitmap* pBitmapWnd,CLjfDialogPrivateInfo *_p);
CRgn rgnBmpTran;
int capLeftspace;
int capTopspace;
int capFontHeight;
int icoLeftspace;
int icoWidth;
int icoTopspace;

int btnHeight;
int btnWidth ;
int btnInspace ;
int btnRightspace ;
int btnTopspace ;

int bdyWidth;
int bdyHeight;
int bdyCaptionHeight ;
int bdyBorderBottomHeight ;
int bdyBorderLeftWidth ;
int bdyBorderRightWidth ;

int bdyCTop1Width ;
int bdyCTop2Width ;

int bdyCBottom1Width;
int bdyCBottom2Width;

int bdyCLeft1Height;
int bdyCLeft2Height;

int bdyCRight1Height;
int bdyCRight2Height;

RECT btnrClose;
RECT btnrMax;
RECT btnrMin;
RECT btnrNom;

RECT bdyrC11;
RECT bdyrC12;
RECT bdyrC13;

RECT bdyrC21;
RECT bdyrC22;
RECT bdyrC23;

RECT bdyrC31;
RECT bdyrC32;
RECT bdyrC33;

RECT bdyrC41;
RECT bdyrC42;
RECT bdyrC43;
};
class CLjfDialog
{
// 构造
public:
    CLjfDialog(HWND hWnd);
~CLjfDialog();
static void Install(CString sSkinIniFileName);
static void UnInstall();
static bool AddSubClass( HWND &hWnd,TCHAR * oldProcTag,DWORD Proc);

static CLjfDialog* AddWndHook(HWND hwnd);
static CLjfDialog* GetWndHook(HWND hwnd);

static LRESULT CALLBACK LjfDialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK WindowHook (int code, WPARAM wParam, LPARAM lParam);

static bool GetCBitmap(CString sFileName,CBitmap &cbmp);
static bool FillRect(HWND hWnd,CDC *pDC, RECT rt, RECT rtbmp,CBitmap *pcbmp);
static bool FillRect(CDC* pdcMem,CDC *pdcMemShow, RECT rt, RECT rtbmp);
static bool FillButton(HWND hWnd,CDC* pdcMem,CDC *pdcMemShow,CLjfDialogPrivateInfo * _p,int intBtnNo,int intBtnState);//
static bool FillButton(HWND hWnd,CLjfDialogPrivateInfo * _p,int intBtnNo,int intBtnState, CDC *pDC);//
static void DrawNC(HWND hWnd,CLjfDialogPrivateInfo *_p,CDC* pDC);//画非客户区.
static bool GetBtnRect(HWND hWnd,CLjfDialogPrivateInfo * _p,RECT &rbtn, RECT &rbtnWnd, int intBtnNo,int intState);
// 消息
public:
LRESULT OnNcCalcsize(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);
void NcCalcSize(RECT* rect);
void OnShowWindow(BOOL bShow);
void OnNcDestroy();
void OnCreate(LPCREATESTRUCT lpCreateStruct);
void OnNcPaint();
UINT OnNcHitTest(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);
void OnNcActivate(BOOL bActive);
void OnMove(int x, int y);
void OnNcLButtonDown(UINT nHitTest, CPoint point);
void OnNcLButtonUp(UINT nHitTest, CPoint point);
void OnNcMouseMove(UINT nHitTest, CPoint point);
void OnSize();
// 数据
protected:
HWND m_hWnd;
CLjfDialogPrivateInfo m_p;//对象私有信息
static CMap<HWND, HWND, CLjfDialog*, CLjfDialog*> m_map;
    static HHOOK m_hHook;
static CString m_sSkinName;
static CLjfDialogInfo m_sif;//公用信息
static CBitmap m_cbmpDlgFocus;
static CBitmap m_cbmpDlgBlur;
static CBitmap m_cbmpSysBtn;
};

#endif // !defined(_LJF_LJFHOOK_H)
//

#include "stdafx.h"
#include "LjfIni.h"
#include "LjfDialog.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//静态变量
CMap <HWND, HWND, CLjfDialog*, CLjfDialog*> CLjfDialog::m_map;
HHOOK CLjfDialog::m_hHook = NULL;
CString CLjfDialog::m_sSkinName = "skin";
CLjfDialogInfo CLjfDialog::m_sif;
CBitmap CLjfDialog::m_cbmpDlgFocus;
CBitmap CLjfDialog::m_cbmpDlgBlur;
CBitmap CLjfDialog::m_cbmpSysBtn;

//回调函数
LRESULT CALLBACK CLjfDialog::LjfDialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WNDPROC oldWndProc = (WNDPROC)GetProp(hWnd, sLjfDialogOldProcTag);
    CLjfDialog* pWnd = GetWndHook(hWnd);
UINT uMsg1=uMsg;
if (pWnd == NULL) goto EndLjfDialogProc;

    switch (uMsg)
    {
   case WM_NCCALCSIZE:
    return pWnd->OnNcCalcsize(oldWndProc, hWnd, uMsg1, wParam, lParam);
   case WM_NCPAINT:
    pWnd->OnNcPaint();
    return HTNOWHERE;
   case WM_SHOWWINDOW:
    pWnd->OnShowWindow(wParam != NULL);
    break;
   case WM_NCDESTROY:
    pWnd->OnNcDestroy();
    break;
   case WM_CREATE:
    pWnd->OnCreate((CREATESTRUCT *)lParam);
    break;
   case WM_NCHITTEST:
    return pWnd->OnNcHitTest(oldWndProc, hWnd, uMsg1, wParam, lParam);
   case WM_NCACTIVATE:
    pWnd->OnNcActivate((BOOL)LOWORD(wParam));
    return HTCAPTION;
   case 0x00AE://在windows最佳性能时依然在NCBUTTONDOWN和调整大小时
   case 0x00AF://有系统最大最小关闭按钮出现,有待解决.
   //case WM_NOTIFY:
    return HTCAPTION;
   case WM_MOVE:
    pWnd->OnMove(LOWORD(lParam),HIWORD(lParam));
    break;
   case WM_NCLBUTTONDOWN:
    pWnd->OnNcLButtonDown((UINT)wParam,CPoint(LOWORD(lParam),HIWORD(lParam)));
    break;
   case WM_NCLBUTTONUP:
    pWnd->OnNcLButtonUp((UINT)wParam,CPoint(LOWORD(lParam),HIWORD(lParam)));
    break;
   case WM_NCMOUSEMOVE:
    pWnd->OnNcMouseMove((UINT)wParam,CPoint(LOWORD(lParam),HIWORD(lParam)));
    break;
   case WM_SIZE:
    pWnd->OnSize();
    break;
    }
EndLjfDialogProc:
if(IsWindow(hWnd))
   return CallWindowProc(oldWndProc, hWnd, uMsg1, wParam, lParam);
else
   return HTNOWHERE;
}
//消息处理函数
void CLjfDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
m_p.strCaption=lpCreateStruct->lpszName;
RECT r;GetWindowRect(m_hWnd,&r);//整个窗口的相对于屏幕的矩形
CWnd::FromHandle(m_hWnd)->ScreenToClient(&r);
m_p.iOrgCapHeight = -r.top;
m_p.iOrgBorderWidth = -r.left;

LONG lWindowStyle = GetWindowLong(m_hWnd,GWL_STYLE);  
if(!(lWindowStyle&WS_MINIMIZEBOX)) m_p.bHasMinBtn = FALSE;
if(!(lWindowStyle&WS_MAXIMIZEBOX)) m_p.bHasMaxBtn = FALSE;
if (!(lWindowStyle&WS_SYSMENU)) m_p.bHasCloseBtn = FALSE;

//重设窗体大小
CRect rtOrg;GetWindowRect(m_hWnd,&rtOrg);
int iEw=m_sif.bdyBorderLeftWidth+m_sif.bdyBorderRightWidth-2*m_p.iOrgBorderWidth;
int iEh = m_sif.bdyCaptionHeight-m_p.iOrgCapHeight+m_sif.bdyBorderBottomHeight-m_p.iOrgBorderWidth;
SetWindowPos(m_hWnd,HWND_TOP,0,0,rtOrg.Width()+iEw,rtOrg.Height()+iEh,SWP_NOMOVE);
}
void CLjfDialog::OnNcActivate(BOOL bActive)
{
m_p.bNcActive=bActive;
OnNcPaint();
}
void CLjfDialog::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
//检测最小,最大和关闭按钮是否按下,然后更换.
m_p.bNcLBtnDown = TRUE;
POINT p;
p.x = point.x-m_p.rWnd.left;
p.y = point.y-m_p.rWnd.top;
if (PtInRect(&m_p.rwndbtnMin,p) && m_p.bHasMinBtn)
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_MIN,SYSBTNSTATE_DOWN,&dc);
   ReleaseDC(m_hWnd,dc);
}
else if (PtInRect(&m_p.rwndbtnMax,p) && m_p.bHasMaxBtn)
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));  
   FillButton(m_hWnd,&m_p,SYSBTN_MAX,SYSBTNSTATE_DOWN,&dc);
   ReleaseDC(m_hWnd,dc);
}
else if (PtInRect(&m_p.rwndbtnClose,p) && m_p.bHasCloseBtn)
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_CLS,SYSBTNSTATE_DOWN,&dc);
   ReleaseDC(m_hWnd,dc);
}
}
void CLjfDialog::OnNcMouseMove(UINT nHitTest, CPoint point)
{
//检测最小,最大和关闭按钮是否有鼠标悬停,然后更换.
if(m_p.bNcLBtnDown)
{
   m_p.bNcLBtnDown = false;
   return;
}
POINT p;
p.x = point.x-m_p.rWnd.left;
p.y = point.y-m_p.rWnd.top;
if (PtInRect(&m_p.rwndbtnMin,p) & m_p.bHasMinBtn)
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_MIN,SYSBTNSTATE_OVER,&dc);
   ReleaseDC(m_hWnd,dc);
}
else if (PtInRect(&m_p.rwndbtnMax,p))
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_MAX,SYSBTNSTATE_OVER,&dc);
   ReleaseDC(m_hWnd,dc);
}
else if (PtInRect(&m_p.rwndbtnClose,p))
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_CLS,SYSBTNSTATE_OVER,&dc);
   ReleaseDC(m_hWnd,dc);
}
else
{
   CWindowDC dc(CWnd::FromHandle(m_hWnd));
   FillButton(m_hWnd,&m_p,SYSBTN_MIN,SYSBTNSTATE_NOM,&dc);
   FillButton(m_hWnd,&m_p,SYSBTN_MAX,SYSBTNSTATE_NOM,&dc);
   FillButton(m_hWnd,&m_p,SYSBTN_CLS,SYSBTNSTATE_NOM,&dc);
   ReleaseDC(m_hWnd,dc);
}
}
UINT CLjfDialog::OnNcHitTest(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
LRESULT lRet = CallWindowProc(lpPrevWndFunc,hWnd,Msg,wParam,lParam);
if (lRet == HTZOOM || lRet == HTMINBUTTON || lRet == HTCLOSE
   || HTHELP == lRet || lRet == HTTOP)//屏蔽最大最小关闭HITTEST.
   lRet = HTCAPTION;
if( HTCAPTION != lRet )
   return lRet;

POINT p;
p.x = LOWORD(lParam)-m_p.rWnd.left;
p.y = HIWORD(lParam)-m_p.rWnd.top;
if (PtInRect(&m_p.rwndbtnMin,p))
   m_p.bHasMinBtn?lRet = HTSYSMENU:lRet = HTCAPTION;
if (PtInRect(&m_p.rwndbtnMax,p))
   m_p.bHasMaxBtn?lRet = HTSYSMENU:lRet = HTCAPTION;
if (PtInRect(&m_p.rwndbtnClose,p))
   m_p.bHasCloseBtn?lRet = HTSYSMENU:lRet = HTCAPTION;
return lRet;
}
void CLjfDialog::OnMove(int x, int y)
{
GetWindowRect(m_hWnd,&m_p.rWnd);
}

void CLjfDialog::OnNcLButtonUp(UINT nHitTest, CPoint point)
{
//检测最小,最大和关闭按钮LButtonUp,执行对应操作
POINT p;
p.x = point.x-m_p.rWnd.left;
p.y = point.y-m_p.rWnd.top;
if (PtInRect(&m_p.rwndbtnMin,p) && m_p.bHasMinBtn)
   SendMessage(m_hWnd,WM_SYSCOMMAND, SC_MINIMIZE, MAKELPARAM(point.x, point.y) );
else if (PtInRect(&m_p.rwndbtnMax,p) && m_p.bHasMaxBtn)
   if (IsZoomed(m_hWnd))
    SendMessage(m_hWnd,WM_SYSCOMMAND, SC_RESTORE, MAKELPARAM(point.x, point.y));
   else
    SendMessage(m_hWnd,WM_SYSCOMMAND, SC_MAXIMIZE, MAKELPARAM(point.x, point.y) );
else if (PtInRect(&m_p.rwndbtnClose,p) && m_p.bHasCloseBtn)
   SendMessage(m_hWnd,WM_CLOSE,0,0);
}

LRESULT CLjfDialog::OnNcCalcsize(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
//重设NC度量为给定值
LRESULT lRet = CallWindowProc(lpPrevWndFunc,hWnd,Msg,wParam,lParam);
    if ( (BOOL)wParam )   
{
   NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)lParam;
   CRect oldrect = lpncsp->rgrc[0];       
   NcCalcSize(lpncsp->rgrc);       
   lpncsp->rgrc[1] = lpncsp->rgrc[0];       
   lRet = 0;   
}
return lRet;
}
void CLjfDialog::NcCalcSize(RECT* rect)
{
if (m_p.iOrgCapHeight>10)//has caption bar
{
   rect[0].left += m_sif.bdyBorderLeftWidth-m_p.iOrgBorderWidth;//窗体左边框的宽度       
   rect[0].right -= m_sif.bdyBorderRightWidth-m_p.iOrgBorderWidth;//窗体右边框的宽度       
   rect[0].top += m_sif.bdyCaptionHeight-m_p.iOrgCapHeight; //窗体标题栏的高度
   rect[0].bottom -= m_sif.bdyBorderBottomHeight-m_p.iOrgBorderWidth;//窗体底边框的高度
}
}
void CLjfDialog::OnNcPaint()
{
    CWindowDC dc(CWnd::FromHandle(m_hWnd));
DrawNC(m_hWnd,&m_p,&dc);
}
void CLjfDialog::OnSize()
{
m_sif.SetLjfWindowRgn(m_hWnd,&m_p);
}
void CLjfDialog::OnNcDestroy(){delete this;}
void CLjfDialog::OnShowWindow(BOOL bShow)
{
if (!bShow)
   delete this;
else
{
   //m_sif.SetLjfWindowRgn(m_hWnd,&m_cbmpDlgFocus,&m_p);
   OnSize();
   m_p.hIcon=CWnd::FromHandle(m_hWnd)->GetIcon(true);
   if(m_p.hIcon == NULL) m_p.hIcon = AfxGetApp()->LoadStandardIcon(IDI_APPLICATION);
}
}

//Draw NC
void CLjfDialog::DrawNC(HWND hWnd,CLjfDialogPrivateInfo *_p,CDC* pDC)
{
if (!hWnd) return;
m_sif.SetWindRect(hWnd,&m_cbmpDlgFocus,_p);//按钮,标题在窗口上的相对位置

CBitmap * pcbmp= &m_cbmpDlgFocus;
int iBtnState=SYSBTNSTATE_NOM;
if (!_p->bNcActive)
{
   pcbmp = &m_cbmpDlgBlur;
   iBtnState=SYSBTNSTATE_BLUR;
}

CDC dcMem;dcMem.CreateCompatibleDC(pDC);
CDC dcMemShow;dcMemShow.CreateCompatibleDC(pDC);

CBitmap cbmpMemShow;
cbmpMemShow.CreateCompatibleBitmap(pDC,_p->rWnd.right-_p->rWnd.left,_p->rWnd.bottom-_p->rWnd.top);
dcMemShow.SelectObject(cbmpMemShow);

dcMem.SelectObject(pcbmp);
FillRect(&dcMem,&dcMemShow,_p->rwndC11,m_sif.bdyrC11);
FillRect(&dcMem,&dcMemShow,_p->rwndC13,m_sif.bdyrC13);
FillRect(&dcMem,&dcMemShow,_p->rwndC12,m_sif.bdyrC12);

FillRect(&dcMem,&dcMemShow,_p->rwndC21,m_sif.bdyrC21);
FillRect(&dcMem,&dcMemShow,_p->rwndC23,m_sif.bdyrC23);
FillRect(&dcMem,&dcMemShow,_p->rwndC22,m_sif.bdyrC22);

FillRect(&dcMem,&dcMemShow,_p->rwndC31,m_sif.bdyrC31);
FillRect(&dcMem,&dcMemShow,_p->rwndC33,m_sif.bdyrC33);
FillRect(&dcMem,&dcMemShow,_p->rwndC32,m_sif.bdyrC32);

FillRect(&dcMem,&dcMemShow,_p->rwndC41,m_sif.bdyrC41);
FillRect(&dcMem,&dcMemShow,_p->rwndC43,m_sif.bdyrC43);
FillRect(&dcMem,&dcMemShow,_p->rwndC42,m_sif.bdyrC42);

dcMem.SelectObject(&m_cbmpSysBtn);
FillButton(hWnd,&dcMem,&dcMemShow,_p,SYSBTN_MIN,iBtnState);
FillButton(hWnd,&dcMem,&dcMemShow,_p,SYSBTN_MAX,iBtnState);
FillButton(hWnd,&dcMem,&dcMemShow,_p,SYSBTN_CLS,iBtnState);

//在dcMemShow中重画icon
DrawIconEx(dcMemShow.m_hDC, m_sif.icoLeftspace, m_sif.icoTopspace,_p->hIcon, m_sif.icoWidth, m_sif.icoWidth,0, NULL,DI_NORMAL);

//在dcMemShow中重画caption
dcMemShow.SetBkMode(TRANSPARENT);
dcMemShow.SetTextColor(RGB(150, 150, 150));
CFont font; font.CreateFont(m_sif.capFontHeight,0,0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
   CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,"宋体");
dcMemShow.SelectObject(&font);
dcMemShow.DrawText(_T(_p->strCaption),&_p->rwndCaption,DT_LEFT|DT_TOP|DT_END_ELLIPSIS);//先画Caption阴影.
if(_p->bNcActive)
   dcMemShow.SetTextColor(RGB(255, 255, 255));
else
   dcMemShow.SetTextColor(RGB(100, 100, 100));
OffsetRect(&_p->rwndCaption,1,-1);
dcMemShow.DrawText(_T(_p->strCaption),&_p->rwndCaption,DT_LEFT|DT_TOP|DT_END_ELLIPSIS);

//把dcMemShow中的图像粘到pDC的NC区中。
CBitmap* pBt=dcMemShow.GetCurrentBitmap();
CBrush br;br.CreatePatternBrush(pBt);

CRect rClient;CWnd::FromHandle(hWnd)->GetClientRect(&rClient);
OffsetRect(&rClient,m_sif.bdyBorderLeftWidth,m_sif.bdyCaptionHeight);
CRgn rgnClient;rgnClient.CreateRectRgn(rClient.left,rClient.top,rClient.right,rClient.bottom);
CRgn rgnWindow;rgnWindow.CreateRectRgn(0,0,_p->rWnd.right-_p->rWnd.left,_p->rWnd.bottom-_p->rWnd.top);

CRgn rgnNC;rgnNC.CreateRectRgn(0,0,0,0);
rgnNC.CombineRgn(&rgnWindow,&rgnClient,RGN_DIFF);

pDC->FillRgn(&rgnNC,&br);
}
//Draw NC end

//添加Hook到m_map
CLjfDialog* CLjfDialog::AddWndHook(HWND hwnd)
{
CLjfDialog* pWnd = NULL;
if (m_map.Lookup(hwnd, pWnd)) return pWnd;//如果已有hwnd,返回得到的值。

pWnd = new CLjfDialog(hwnd);
if (pWnd != NULL)
{
   m_map.SetAt(hwnd, pWnd);
}
return pWnd;
}
//得到m_map中的Hook
CLjfDialog* CLjfDialog::GetWndHook(HWND hwnd)
{
    CLjfDialog* pWnd = NULL;
    if (m_map.Lookup(hwnd, pWnd))
    {
        return pWnd;
    }
    return NULL;
}
bool CLjfDialog::FillRect(HWND hWnd,CDC *pDC, RECT rt, RECT rtbmp,CBitmap *pcbmp)
{
CDC MemDC;MemDC.CreateCompatibleDC (pDC);
CBitmap *pOldBitmap=MemDC.SelectObject (pcbmp);
pDC->StretchBlt(rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top,&MemDC,
   rtbmp.left,rtbmp.top,rtbmp.right-rtbmp.left, rtbmp.bottom-rtbmp.top,SRCCOPY);
MemDC.SelectObject (pOldBitmap);
ReleaseDC(hWnd,MemDC.m_hDC);
pOldBitmap->DeleteObject();
return true;
}
bool CLjfDialog::FillRect(CDC* pdcMem,CDC *pdcMemShow, RECT rt, RECT rtbmp)
{
pdcMemShow->StretchBlt(rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top,pdcMem,
   rtbmp.left,rtbmp.top,rtbmp.right-rtbmp.left, rtbmp.bottom-rtbmp.top,SRCCOPY);
return true;
}

//FillButton
bool CLjfDialog::FillButton(HWND hWnd,CLjfDialogPrivateInfo * _p,int intBtnNo,int intBtnState, CDC *pDC)
{
RECT rbtn,rbtnWnd;
if (GetBtnRect(hWnd,_p,rbtn, rbtnWnd, intBtnNo,intBtnState))
{
   FillRect(hWnd,pDC,rbtnWnd,rbtn,&m_cbmpSysBtn);
   return true;
}
return false;
}
bool CLjfDialog::FillButton(HWND hWnd,CDC* pdcMem,CDC *pdcMemShow,CLjfDialogPrivateInfo * _p,int intBtnNo,int intBtnState)
{
RECT rbtn,rbtnWnd;
if (GetBtnRect(hWnd,_p,rbtn, rbtnWnd, intBtnNo,intBtnState))
{
   FillRect(pdcMem,pdcMemShow,rbtnWnd,rbtn);
   return true;
}
return false;
}
bool CLjfDialog::GetBtnRect(HWND hWnd,CLjfDialogPrivateInfo * _p,RECT &rbtn, RECT &rbtnWnd, int intBtnNo,int intBtnState)
{
int intState = intBtnState;
if(intState <= SYSBTN_NON) return false;
switch(intBtnNo) {
case SYSBTN_MIN:
   if(!_p->bHasMinBtn && !_p->bHasMaxBtn) return false;
   if (!_p->bHasMinBtn) intState = SYSBTNSTATE_DIS;
   rbtn = m_sif.btnrMin;
   rbtnWnd = _p->rwndbtnMin;
   break;
case SYSBTN_NOM:
case SYSBTN_MAX:
   if(!_p->bHasMinBtn && !_p->bHasMaxBtn) return false;
   if(!_p->bHasMaxBtn) intState = SYSBTNSTATE_DIS;
   if(IsZoomed(hWnd))
    rbtn = m_sif.btnrNom;
   else
    rbtn = m_sif.btnrMax;
   rbtnWnd = _p->rwndbtnMax;
   break;
case SYSBTN_CLS:
   if(!_p->bHasCloseBtn) intState = SYSBTNSTATE_DIS;
   rbtn = m_sif.btnrClose;
   rbtnWnd = _p->rwndbtnClose;
   break;
}
OffsetRect(&rbtn,intState*m_sif.btnWidth,0);
return true;
}

//FillButton end

//子类化
bool CLjfDialog::AddSubClass( HWND &hWnd,TCHAR * oldProcTag,DWORD Proc)
{
if (GetProp(hWnd, oldProcTag) != NULL ) return false;//已被子类化
VERIFY(AddWndHook(hWnd) != NULL);
WNDPROC oldWndProc = (WNDPROC)(long)::GetWindowLong(hWnd, GWL_WNDPROC);// 取原来窗口过程
if (oldWndProc == NULL) return false;
ASSERT((DWORD)(ULONG)oldWndProc != Proc);
if (!SetProp(hWnd, oldProcTag, oldWndProc) ) return false;// 保存到窗口属性
if (!SetWindowLong(hWnd, GWL_WNDPROC,Proc))// 子类化
   RemoveProp(hWnd, oldProcTag);
return true;
}
bool CLjfDialog::GetCBitmap(CString sFileName,CBitmap &cbmp)
{
char cpath[100];
sprintf(cpath,"%s//%s.bmp",m_sSkinName,sFileName);
HBITMAP hBitmap=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),
   cpath,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
cbmp.Attach(hBitmap);
return true;
}

//构造
CLjfDialog::CLjfDialog (HWND hWnd)
: m_hWnd(hWnd)
{}
//析构
CLjfDialog::~CLjfDialog ()
{
    WNDPROC oldWndProc = (WNDPROC)::GetProp(m_hWnd, sLjfDialogOldProcTag);
    if (oldWndProc != NULL)
    {
        SetWindowLong(m_hWnd, GWL_WNDPROC, (DWORD)(ULONG)oldWndProc);
        RemoveProp(m_hWnd, sLjfDialogOldProcTag);
    }
    m_map.RemoveKey(m_hWnd);

}
//安装钩子
void CLjfDialog::Install(CString sSkinIniFileName)
{
    if (m_hHook == NULL )
        m_hHook = SetWindowsHookEx(WH_CALLWNDPROC, WindowHook,AfxGetApp()->m_hInstance,GetCurrentThreadId());

CLjfIni ini(sSkinIniFileName);
m_sSkinName=ini.GetString("skin","skin","");
if(m_sSkinName == "") m_sSkinName = "skin";//默认
CString sIniPath;sIniPath.Format("%s\\skin.ini",m_sSkinName);
m_sif.GetInfoFromIniFile(sIniPath);

GetCBitmap("bodyfocus",m_cbmpDlgFocus);
GetCBitmap("bodyblur",m_cbmpDlgBlur);
GetCBitmap("sysbtn",m_cbmpSysBtn);
m_sif.PreparBitmapTranRgn(&m_cbmpDlgFocus);
}
//卸载钩子
void CLjfDialog::UnInstall()
{
    POSITION pos = m_map.GetStartPosition();
    while (pos != NULL)
    {
        HWND hwnd;
        CLjfDialog* pHook;
        m_map.GetNextAssoc(pos, hwnd, pHook);
        delete pHook;
   pHook = NULL;
    }
    m_map.RemoveAll();
m_cbmpSysBtn.DeleteObject();
m_cbmpDlgFocus.DeleteObject();
m_cbmpDlgBlur.DeleteObject();

    if (m_hHook != NULL) UnhookWindowsHookEx(m_hHook);
}
//消息过程
LRESULT CALLBACK CLjfDialog::WindowHook(int code, WPARAM wParam, LPARAM lParam)
{
    CWPSTRUCT* pStruct = (CWPSTRUCT*)lParam;
    if (code == HC_ACTION)
    {
        HWND hWnd = pStruct->hwnd;
        if (pStruct->message != WM_CREATE && pStruct->message != 0x01E2) goto EndProc;

   TCHAR strClassName[20];
   GetClassName (hWnd, strClassName, sizeof(strClassName));

   LPCSTR lpszClassName = CWnd::FromHandle(hWnd)->GetRuntimeClass()->m_lpszClassName;
   TRACE(lpszClassName);TRACE("---------\r\n");

   //是CDialog类,无标题栏
   //if (_tcscmp(lpszClassName, _T("CDialog")) == 0 && GetWindowLong(hWnd,GWL_STYLE)&WS_CAPTION)
   if (_tcscmp(strClassName, _T("#32770")) == 0 && GetWindowLong(hWnd,GWL_STYLE)&WS_CAPTION)
    AddSubClass(hWnd,sLjfDialogOldProcTag,(DWORD)(ULONG)LjfDialogProc);
}

EndProc:
    return CallNextHookEx (m_hHook, code, wParam, lParam);
}
CLjfDialogInfo::CLjfDialogInfo(){}
CLjfDialogInfo::~CLjfDialogInfo()
{
rgnBmpTran.DeleteObject();
}
CLjfDialogPrivateInfo::CLjfDialogPrivateInfo()
: bHasMaxBtn(TRUE),bHasMinBtn(TRUE),bHasCloseBtn(TRUE)
{}
bool CLjfDialogInfo::GetInfoFromIniFile(CString sFileName)
{
CLjfIni ini(sFileName);

capLeftspace = ini.GetInt("cap","capleftspace",0);
capTopspace = ini.GetInt("cap","captopspace",0);
capFontHeight= ini.GetInt("cap","capfontheight",0);
icoLeftspace = ini.GetInt("icon","leftspace",0);
icoTopspace = ini.GetInt("icon","topspace",0);
icoWidth     = ini.GetInt("icon","width",0);

btnHeight =     ini.GetInt("sysbtn","height",0);
btnWidth =      ini.GetInt("sysbtn","width",0);
btnInspace =    ini.GetInt("sysbtn","inspace",0);
btnRightspace = ini.GetInt("sysbtn","rightspace",0);
btnTopspace =   ini.GetInt("sysbtn","topspace",0);

bdyWidth =       ini.GetInt("body","width",0);
bdyHeight =      ini.GetInt("body","height",0);

bdyCaptionHeight =      ini.GetInt("body","border1",0);
bdyBorderBottomHeight = ini.GetInt("body","border2",0);
bdyBorderLeftWidth =    ini.GetInt("body","border3",0);
bdyBorderRightWidth =   ini.GetInt("body","border4",0);

bdyCTop1Width = ini.GetInt("body","c11w",0);
bdyCTop2Width = ini.GetInt("body","c12w",0);

bdyCBottom1Width = ini.GetInt("body","c21w",0);
bdyCBottom2Width = ini.GetInt("body","c22w",0);

bdyCLeft1Height = ini.GetInt("body","c31h",0);
bdyCLeft2Height = ini.GetInt("body","c32h",0);

bdyCRight1Height = ini.GetInt("body","c41h",0);
bdyCRight2Height = ini.GetInt("body","c42h",0);

//btnr在sysbtn图片上位置
SetRect(&btnrMin,0,0,btnWidth,btnHeight);
SetRect(&btnrNom,btnWidth*5,0,btnWidth*6,btnHeight);//多加一个Nom;
SetRect(&btnrMax,btnWidth*10,0,btnWidth*11,btnHeight);
SetRect(&btnrClose,btnWidth*15,0,btnWidth*16,btnHeight);

SetRect(&bdyrC11,0,0,bdyCTop1Width,bdyCaptionHeight);
SetRect(&bdyrC12,bdyWidth-bdyCTop2Width,0,bdyWidth,bdyCaptionHeight);
SetRect(&bdyrC13,bdyCTop1Width,0,bdyWidth-bdyCTop2Width,bdyCaptionHeight);

SetRect(&bdyrC21,bdyBorderLeftWidth,bdyHeight-bdyBorderBottomHeight,bdyBorderLeftWidth+bdyCBottom1Width,bdyHeight);
SetRect(&bdyrC22,bdyWidth-bdyBorderRightWidth-bdyCBottom2Width,bdyHeight-bdyBorderBottomHeight,bdyWidth-bdyBorderRightWidth,bdyHeight);
SetRect(&bdyrC23,bdyBorderLeftWidth+bdyCBottom1Width,bdyHeight-bdyBorderBottomHeight,bdyWidth-bdyBorderRightWidth-bdyCBottom2Width,bdyHeight);

SetRect(&bdyrC31,0,bdyCaptionHeight,bdyBorderLeftWidth,bdyCaptionHeight+bdyCLeft1Height);
SetRect(&bdyrC32,0,bdyHeight-bdyCLeft2Height,bdyBorderLeftWidth,bdyHeight);
SetRect(&bdyrC33,0,bdyCaptionHeight+bdyCLeft1Height,bdyBorderLeftWidth,bdyHeight-bdyCLeft2Height);

SetRect(&bdyrC41,bdyWidth-bdyBorderRightWidth,bdyCaptionHeight,bdyWidth,bdyCaptionHeight+bdyCRight1Height);
SetRect(&bdyrC42,bdyWidth-bdyBorderRightWidth,bdyHeight-bdyCRight2Height,bdyWidth,bdyHeight);
SetRect(&bdyrC43,bdyWidth-bdyBorderRightWidth,bdyCaptionHeight+bdyCRight1Height,bdyWidth,bdyHeight-bdyCRight2Height);

return true;
}
void CLjfDialogInfo::SetWindRect(HWND hWnd,CBitmap* pBitmapWnd,CLjfDialogPrivateInfo *_p)
{
GetWindowRect(hWnd,&_p->rWnd);//整个窗口的相对于屏幕的矩形

int iWndWidth=_p->rWnd.right-_p->rWnd.left;
int iWndHeight=_p->rWnd.bottom-_p->rWnd.top;

int iEWidth = iWndWidth-bdyWidth;
int iEHeight = iWndHeight - bdyHeight;

//在窗体图片上的相对位置
SetRect(&_p->rwndbtnMin ,bdyWidth-btnRightspace-3*btnWidth-2*btnInspace,btnTopspace,bdyWidth-btnRightspace-2*btnWidth-2*btnInspace,btnTopspace+btnHeight);
SetRect(&_p->rwndbtnMax ,bdyWidth-btnRightspace-2*btnWidth-btnInspace ,btnTopspace,bdyWidth-btnRightspace-btnWidth-btnInspace,btnTopspace+btnHeight);
SetRect(&_p->rwndbtnClose,bdyWidth-btnRightspace-btnWidth,btnTopspace,bdyWidth-btnRightspace,btnTopspace+btnHeight);

//窗口实例上的位置
OffsetRect(&_p->rwndbtnClose,iEWidth,0);
OffsetRect(&_p->rwndbtnMax,iEWidth,0);
OffsetRect(&_p->rwndbtnMin,iEWidth,0);

_p->rwndC11=bdyrC11;
_p->rwndC12=bdyrC12;
_p->rwndC13=bdyrC13;

_p->rwndC21=bdyrC21;
_p->rwndC22=bdyrC22;
_p->rwndC23=bdyrC23;

_p->rwndC31=bdyrC31;
_p->rwndC32=bdyrC32;
_p->rwndC33=bdyrC33;

_p->rwndC41=bdyrC41;
_p->rwndC42=bdyrC42;
_p->rwndC43=bdyrC43;

OffsetRect(&_p->rwndC11,0,0);
OffsetRect(&_p->rwndC12,iEWidth,0);
_p->rwndC13.right+=iEWidth;

OffsetRect(&_p->rwndC21,0,iEHeight);
OffsetRect(&_p->rwndC22,iEWidth,iEHeight);
OffsetRect(&_p->rwndC23,0,iEHeight);
_p->rwndC23.right+=iEWidth;

OffsetRect(&_p->rwndC31,0,0);
OffsetRect(&_p->rwndC32,0,iEHeight);
_p->rwndC33.bottom+=iEHeight;

OffsetRect(&_p->rwndC41,iEWidth,0);
OffsetRect(&_p->rwndC42,iEWidth,iEHeight);
OffsetRect(&_p->rwndC43,iEWidth,0);
_p->rwndC43.bottom+=iEHeight;

SetRect(&_p->rwndCaption,capLeftspace,capTopspace,_p->rwndbtnMin.left-5,bdyCaptionHeight);
}
void CLjfDialogInfo::SetLjfWindowRgn(HWND hWnd,CLjfDialogPrivateInfo *_p)
{
CRgn rgnWnd;
rgnWnd.CreateRectRgn(0,0,_p->rWnd.right-_p->rWnd.left,_p->rWnd.bottom-_p->rWnd.top);
CRgn rgnTran;rgnTran.CreateRectRgn(0,0,0,0);rgnTran.CopyRgn(&rgnBmpTran);

int iEWidth = _p->rWnd.right-_p->rWnd.left-bdyWidth;
int iEHeight = _p->rWnd.bottom-_p->rWnd.top - bdyHeight;

CRgn rgnTopLeft;
rgnTopLeft.CreateRectRgn(bdyrC11.left,bdyrC11.top,bdyrC11.right,bdyrC11.bottom);
rgnTopLeft.CombineRgn(&rgnTopLeft,&rgnTran,RGN_AND);

CRgn rgnTopRight;
rgnTopRight.CreateRectRgn(bdyrC12.left,bdyrC12.top,bdyrC12.right,bdyrC12.bottom);
rgnTopRight.CombineRgn(&rgnTopRight,&rgnTran,RGN_AND);
rgnTopRight.OffsetRgn(iEWidth,0);

CRgn rgnBottomLeft;
rgnBottomLeft.CreateRectRgn(bdyrC32.left,bdyrC32.top,bdyrC32.right,bdyrC32.bottom);
rgnBottomLeft.CombineRgn(&rgnBottomLeft,&rgnTran,RGN_AND);
rgnBottomLeft.OffsetRgn(0,iEHeight);

CRgn rgnBottomRight;
rgnBottomRight.CreateRectRgn(bdyrC42.left,bdyrC42.top,bdyrC42.right,bdyrC42.bottom);
rgnBottomRight.CombineRgn(&rgnBottomRight,&rgnTran,RGN_AND);
rgnBottomRight.OffsetRgn(iEWidth,iEHeight);

rgnTran.DeleteObject();rgnTran.CreateRectRgn(0,0,0,0);
rgnTran.CombineRgn(&rgnTran,&rgnTopLeft,RGN_OR);
rgnTran.CombineRgn(&rgnTran,&rgnTopRight,RGN_OR);
rgnTran.CombineRgn(&rgnTran,&rgnBottomLeft,RGN_OR);
rgnTran.CombineRgn(&rgnTran,&rgnBottomRight,RGN_OR);

rgnWnd.CombineRgn(&rgnWnd,&rgnTran,RGN_DIFF);
SetWindowRgn(hWnd,rgnWnd,true);
}
void CLjfDialogInfo::PreparBitmapTranRgn(CBitmap* pBitmap)
{
CDC dcImage;dcImage.CreateCompatibleDC (NULL);dcImage.SelectObject (pBitmap);
COLORREF clTransparent=dcImage.GetPixel(0, 0);//第一行第一列的像素为透明参考色。
CRect r(0,0,bdyWidth,bdyHeight);

CRgn rgnTra;rgnTra.CreateRectRgn(0,0,0,0);
for (int y=r.top; y<=r.bottom; y++)//遍历r所在的行
{
   if (y<=bdyrC11.bottom || y>=max(bdyrC32.top,bdyrC42.top))
   {
    for (int x=r.left; x<r.right; x++)//遍历r所在的列
    {
     if (x<=bdyrC11.right || x>=bdyrC12.left)
     {
      if (dcImage.GetPixel(x, y) == clTransparent)//透明
      {
       CRgn rgnAdd;
       rgnAdd.CreateRectRgn (r.left+x,r.top+y, r.left+x+1, r.top+y+1);
       rgnTra.CombineRgn (&rgnTra, &rgnAdd, RGN_OR);
       rgnAdd.DeleteObject();
      }
     }
    }
   }
}
rgnBmpTran.DeleteObject();
rgnBmpTran.CreateRectRgn(0,0,0,0);
rgnBmpTran.CopyRgn(&rgnTra);
}

ljfIni.h:

class CLjfIni {
public:
CLjfIni(CString filename);
CString GetString(CString Section,CString Key,CString sDefault);
bool SetString(CString Section,CString Key,CString sValue);
int GetInt(CString Section,CString Key,int iDefault);
bool SetInt(CString Section,CString Key,int iValue);
private:
CString m_sFileName;
bool GetFilePath(char * c);
};

#include "stdafx.h"
#include "ljfIni.h"

CLjfIni::CLjfIni(CString filename){
m_sFileName=filename;
}
CString CLjfIni::GetString(CString Section,CString Key,CString sDefault){
CString sReturn;
try{
   LPTSTR lpszm_sFilePath = new TCHAR[MAX_PATH];
   GetFilePath(lpszm_sFilePath);
   GetPrivateProfileString(Section,Key,sDefault,
    sReturn.GetBuffer(MAX_PATH),MAX_PATH,lpszm_sFilePath);
}
catch (...) {
   sReturn="error";
}
return sReturn;
}
bool CLjfIni::SetString(CString Section,CString Key,CString sValue){
LPTSTR lpszm_sFilePath = new TCHAR[MAX_PATH];
GetFilePath(lpszm_sFilePath);
BOOL bResult=WritePrivateProfileString(Section,Key,sValue,lpszm_sFilePath);
if (bResult == FALSE) return false;
return true;
}
int CLjfIni::GetInt(CString Section,CString Key,int iDefault){
int iReturn;
try{
   LPTSTR lpszm_sFilePath = new TCHAR[MAX_PATH];
   GetFilePath(lpszm_sFilePath);
   iReturn=GetPrivateProfileInt(Section,Key,(INT)iDefault,lpszm_sFilePath);
}
catch (...) {
   iReturn=-1;
}
return iReturn;
}
bool CLjfIni::SetInt(CString Section,CString Key,int iValue){
CString siValue;
siValue.Format("%d",iValue);
return SetString(Section,Key,siValue);
}
bool CLjfIni::GetFilePath(char * c)
{
char pBuf[MAX_PATH];GetModuleFileName(NULL, pBuf, MAX_PATH);
(_tcsrchr(pBuf, _T('\\')))[1] = 0;
sprintf(c,"%s\\%s",pBuf,m_sFileName);
return true;
}

转载于:https://www.cnblogs.com/superanyi/archive/2011/03/27/1997161.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/495530.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Jupyter 安装使用

Jupyter的官网&#xff1a;http://jupyter.org/index.html 官方文档&#xff1a;https://jupyter-notebook.readthedocs.io/en/stable/https://github.com/jupyter/jupyter/wiki/A-gallery-of-interesting-Jupyter-Notebooks 1. jupyter notebook是什么 官网的介绍是&#xff…

结构思考力~结构化接收信息的三个步骤

第一步&#xff1a;识别信息中的事实、理由及结论。找出信息中哪些是观点类的&#xff0c;哪些是事实描述 类的信息&#xff0c;观点类的信息中哪些是结论、哪些是支撑结论的理由&#xff0c;并将它们区分开。 第二步&#xff1a;找到事实与观点的对应关系&#xff0c;并画出结…

VisualStudio 的 Spy++ —— 窗口、消息 的 查看分析利器

spy 中文使用手册&#xff1a;https://pan.baidu.com/s/1NtLQMP1odHDAla4VH8m9Mg 提取码&#xff1a;294c Spy使用方法&#xff1a;https://www.cnblogs.com/happykoukou/p/6755444.html 教你使用Spy查看软件的流氓行径&#xff1a;https://blog.csdn.net/zahuopuboss/ar…

《MFC初探》之变量类型

From&#xff1a;https://blog.csdn.net/a1459268562/article/details/70653695 MFC常用数据类型&#xff1a;https://www.cnblogs.com/xzxl/p/7955477.html 刚接触 MFC 的人一看到里面各种各样的关键字肯定傻眼了&#xff0c;仿佛完全是另外一门语言了&#xff0c;因为 MFC 中…

WPF获取窗口句柄

.NET WinForm获取窗口句柄很方便&#xff0c;this.Handle搞定。 WPF就有些麻烦了&#xff0c;获取方法如下&#xff1a; 引入命名空间&#xff1a;using System.Windows.Interop; 获取方法&#xff1a;new WindowInteropHelper(this).Handle this是个Window类的实例 作者: 翟士…

VS 编写 x64 内联汇编

From&#xff1a;https://www.cnblogs.com/talenth/p/9135626.html VS 中使用 X64 汇编&#xff1a;https://blog.csdn.net/kingswb/article/details/64108715 编写涉及系统特性的一些底层程序&#xff0c;特别是ShellCode&#xff0c;不可避免地要采用直接编写汇编代码的方式…

结构思考力~设定主题

一、确定结论&#xff1a;一个为目标服务的结论 二、包装主题&#xff1a;一个打动人心的主题 SPA主题确认法 确定主题&#xff0c;让表达观点明确&#xff0c;如果我们自己要写报告&#xff0c;就需要思考两个问题&#xff1a; 你要说服对方接受你什么观点&#xff1b;如何…

MSSQL中实现多表更新

续2010年11月09日的《SQL语句中CASE WHEN以及CAST的运用》一文&#xff0c;如果在基础数据教师表中添加了新的教师用户&#xff0c;而恰好添加的教师已经存在于教学成果数据中&#xff0c;则需要更新教学成果数据中该教师的信息&#xff0c;即&#xff1a;之前存储的是教师的姓…

VS2019 使用 C/C++ 动态链接库 并 进行调用

vs2019生成dll并调用的实现示例&#xff1a;https://www.jb51.net/article/179759.htm vs2017创建linux c程序&#xff1a;https://blog.csdn.net/qingyulove/article/details/86659726 vs2019编写Linux c/c项目&#xff1a;https://blog.csdn.net/mmmsss987/article/details/…

结构思考力~设计序言

一、 初步设计&#xff1a;完善序言的基本要素&#xff1a; 序言是沟通前将对方吸引过来的一种方式&#xff0c;就是所谓的开场白。序言包括 SCQA 四要&#xff0c;下面就是一个包含四要素的例子&#xff1a; S&#xff08;情景&#xff09;需要让对方产生共鸣&#xff0c;必须…

ASP.NET 用户控件自定义属性、方法、事件

原文件链接&#xff1a;http://www.cnblogs.com/stalwart/archive/2010/12/16/1908302.html 之前一直写MVC的&#xff0c;本来就不大喜欢.NET中的服务器控件&#xff0c;里面的缺点很多&#xff0c;但有时候用起来方便&#xff0c;而且现在的项目开发中也要用到。 所以就找了好…

安卓逆向_1 --- 逆向环境配置、APK 文件结构、APK 打包流程

哔哩哔哩&#xff1a;https://www.bilibili.com/video/BV1UE411A7rW?p1 Android 逆向工程师系统培训‹第九期›&#xff08; 课程目录 &#xff09;&#xff1a;https://ke.yijincc.com/course-21.htm 安卓逆向工程师&#xff1a;https://ke.yijincc.com/profession/1.htm 打…

业务架构·应用架构·数据架构实战~架构实践全景图

1.战略、BA、DA、AA、TA五者的关系 BA&#xff08;Business Architecture&#xff09;&#xff1a;业务架构 DA&#xff08;Data Architecture&#xff09;&#xff1a;数据架构 AA&#xff08;Application Architecture&#xff09;&#xff1a;应用架构 TA&#xff08;Te…

安卓逆向_2 --- Androidkiller,apktool、dex2jar、jd-gui、jadx反编译工具 的 安装、设置及使用教程

From&#xff1a;https://www.52pojie.cn/thread-726176-1-1.html 爱盘 - 在线 PJ 工具包&#xff1a;https://down.52pojie.cn/ 哔哩哔哩 &#xff1a;https://www.bilibili.com/video/BV1UE411A7rW?p6 Android反编译工具的使用-Android Killer - 反编译美柚&#xff1a;h…

业务架构·应用架构·数据架构实战~TOGAF理论全景解读

1、解读TOGAF 9.2的BA、DA、AA、TA内容模型 企业架构&#xff08;Enterprise Architecture&#xff09;包含如下四种架构 BA&#xff08;Business Architecture&#xff09;&#xff1a;业务架构 DA&#xff08;Data Architecture&#xff09;&#xff1a;数据架构 AA&…

Android 系统架构图

Android 操作系统架构开篇&#xff1a; http://gityuan.com/android/ https://cloud.tencent.com/developer/article/1429122 Android架构图&#xff08;五层框架&#xff09;&#xff1a;https://www.cnblogs.com/pengdonglin137/p/3858254.html 官方系统架…

业务架构·应用架构·数据架构实战~战略驱动的业务架构设计

1、什么是业务架构&#xff08;BA&#xff09; 业务架构是企业治理结构、商业能力与价值的正式蓝图。 业务架构明确定义企业的治理结构、业务能力、业务流程、业务数据。其中&#xff0c;业务能力定义企业做什么&#xff0c;业务流程定义企业怎么做。 业务能力定义企业做什么…

Python 操控手机 APP

From&#xff1a;https://www.cnblogs.com/7758520lzy/p/11994776.html Python 控制雷电模拟器&#xff1a;https://blog.csdn.net/zerglurker/article/details/102931511 python 控制手机 python控制雷电模拟器 经常看到用 Python 操作手机 APP 的项目&#xff0c;例如抖音…

Log4Net 全方位跟踪程序运行

前端日子自己写了一个简单的日志跟踪程序&#xff0c;现在目前正在做的一个项目中使用以便于跟踪程序异常和运行状况&#xff0c;但是被否认了&#xff01;可能是没有权威性&#xff0c;于是自己总结了一下Log4net日志跟踪系统&#xff0c;这里分享大家学习一下。当然写这个文章…

业务架构·应用架构·数据架构实战~业务驱动的应用架构设计

1、什么是应用架构 应用架构是一组应用系统及其交互关系的描述&#xff0c;其中的每个应用系统都是一个“逻辑功能组”&#xff0c;用于支撑业务功能、管理数据资产。 支撑业务架构中&#xff0c;具体业务功能、业务流程的要求。 支撑数据架构中&#xff0c;具体数据资产的操…