🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.program
Article #1183

vc���ָ��68ƪ(4)

#1183
From: �ϵ�
Date: Sun, 19 Apr 1998 00:00
143 lines
7402 bytes
2m������:m TINA (�ռ�����)
2m��  ��:m RAD
2m��  ��:m VC��̼���68ƪ(4)
2m����վ:m '3m�Ͻ�ɺ�m' (Mon Apr  6 08:34:56 1998) , 5mվ���ż�m

[������ҳ] [����������] [ȫ��������]

������: Zeemon (������), ����: Visual 
��  ��: vc���ָ��68ƪ(4) 
����վ: BBS ˮľ�廪վ (Wed Oct 22 21:14:47 1997) 

21����ε������˴��ڱ��������������ʹ�����ƶ� 

   ��������Ҫȷ�����λ��ʱWindows�򴰿ڷ���WM_NCHITTEST��Ϣ�����Դ��� 
����ϢʹWindows��Ϊ����ڴ��ڱ����ϡ����ڶԻ���ͻ��ڶԻ���Ӧ�ó��򣬿� 
��ʹ��ClassWizard�������Ϣ�����û��ຯ�� ������HTCLIENT ����� 
����ڿͷ����򣬷���HTCAPTION���������Windows�ı������С� 
UINT CSampleDialog : : OnNcHitTest  (Cpoint point ) 
{ 
    UINT nHitTest =Cdialog: : OnNcHitTest (point ); 
    return (nHitTest = =HTCLIENT)? HTCAPTION : nHitTest ; 
} 
    �������������㲻��֮���� ��һ���ڴ��ڵĿͻ�����˫��ʱ�� ���ڽ����� 
����� ���ʺϰ���Ӵ������򴰿ڡ�����һ�ַ��������û����������� 
ʹ���򴰿���Ϊ������䴰�ڱ����ϣ�ʹ��ClassWizard���Ӵ��д���WM_LBUTTODOWN 
��Ϣ�������򴰿ڷ���һ��WM_NCLBUTTONDOWN��Ϣ��һ����������HTCAPTION�� 
void CSampleView : : OnLButtonDown  (UINT nFlags , Cpoint point ) 
{ 
    CView : : OnLButtonDow  (nFlags , pont ); 

    //Fool frame window into thinking somene clicked on  
    its caption bar . 
    GetParentFrame ( ) ��> PostMessage ( 
         WM_NCLBUTTONDOWN , HTCAPTION , MAKELPARAM (poitn .x , point .y) );

} 
    �ü���Ҳ�����ڶԻ���ͻ��ڶԵ�Ӧ�ó���ֻ�Dz��ص���CWnd : : 
GetParentFrame �� 
void CSampleDialog : : OnLbuttonDown (UINT nFlags, Cpoint point ) 
{ 
    Cdialog : : OnLButtonDow (nFlags, goint ); 
    //Fool dialog into thinking simeone clicked on its caption bar . 
  PostMessage (WM_NCLBUTTONDOWN , HTCAPTION , MAKELPARM (point.x , point. y
) )        
} 

22����θı��Ӵ��ı�����ɫ 

    Windows�򴰿ڷ���һ��WM_ERASEBKGND��Ϣ֪ͨ�ô��ڲ��������ʹ�� 
ClassWizard���ظ���Ϣ��ȱʡ��������������ʵ���ǻ�����������TRUE�� 
��ֹWindows����ڡ� 
//Paint area that needs to be erased. 
BOOL CSampleView : : OnEraseBkgnd (CDC* pDC) 
{ 
// Create a pruple brush. 
CBrush Brush (RGB (128 , 0 , 128) ); 

// Select the brush into the device context . 
CBrush* pOldBrush = pDC��>SelcetObject (&brush); 

// Get the area that needs to be erased . 
CRect reClip ; 
pDC��>GetCilpBox (&rcClip); 

//Paint the area. 
pDC��> PatBlt (rcClip.left , rcClip.top , 
        rcClip.Width ( ) , rcClip.Height ( ) , PATCOPY ); 

//Unselect brush out of device context . 
pDC��>SelectObject (pOldBrush ); 

// Return nonzero to half fruther processing . 
return TRUE; 
} 

23����θı䴰�ڱ��� 

    ����CWnd : : SetWindowText���Ըı��κδ��ڣ������ؼ����ı��⡣ 
//Set title for application's main frame window . 
AfxGetMainWnd ( ) ��> SetWindowText (_T("Application title") ); 

//Set title for View's MDI child frame window . 
GetParentFrame ( ) ��> SetWindowText ("_T ("MDI Child Frame new title") ); 

//Set title for dialog's push button control. 
GetDigitem  (IDC_BUTTON) ��> SetWindowText  (_T ("Button new title ") ); 
    �����Ҫ�����޸Ĵ��ڵı��⣨ע���ؼ�Ҳ�Ǵ��ڣ���Ӧ�ÿ���ʹ�ð��ĵ��� 
�ĺ���AfxSetWindowText���ú�����AFXPRIV.H��˵������WINUTIL.CPP��ʵ�֣��� 
����������Ҳ���������AFXPRIV.H�а��ĵ����� ���Ժ��е�MFC�н��ĵ����� 
AfxSetWindowText��ʵ�����£� 
voik AFXAPI AfxSetWindowText (HWND hWndCtrl , LPCTSTR IpszNew ) 
{ 
    itn nNewLen= Istrlen (Ipaznew); 
    TCHAR szOld [256]; 
    //fast check to see if text really changes (reduces flash in the 
controls ) 
    if (nNewLen >_contof (szOld) ��� 
        : : GetWindowText (hWndCrtl , szOld , _countof (szOld) !=nNewLen 
��� 
        Istrcmp (szOld , IpszNew )! = 0 
{ 
    //change it  
         : : SetWindowText (hWndCtrl , IpszNew ); 
    } 
}    

24����η�ֹ���򴰿�����˵������ʾ����ĵ��� 

    �������򴰿ں�MDI�Ӵ��ڽ�ͨ������FWS_ADDTOTITLE���λ�� ���ϣ���� 
˵�����Զ�����ĵ��� �����ֹ�÷��λ�� ����ʹ��ClassWizard���� 
CWnd: : PreCreateWindow���ر�FWS_ADDTOTITLE��� 
BOOL CMainFrame : : PreCreateWindow  (CREATESTRUCT&cs) 
{ 
    //Turn off  FWS_ADDTOTITLE in main frame . 
    cs.styel & = ~FWS_ADDTOTITLE ;�� 
    return CMDIFrameWnd : : PreCreateWindow (cs ); 
} 
    �ر�MDI�Ӵ��ڵ�FWS _ADDTOTITLE��񽫴���һ�����пձ���Ĵ��ڣ����Ե� 
��CWnd: : SetWindowText�����ñ��⡣��ס�Լ����ñ���ʱҪ��ѭ�ӿڷ��ָ�ϡ� 

25����λ�ȡ�йش������ڴ���ĵ�ǰ��Ϣ����Ϣ  

    ����CWnd: : GetCurrentMessage���Ի�ȡһ��MSGָ�롣���磬����ʹ�� 
ClassWizard�������˵�������ӳ�䵽һ�������У�Ȼ�����GetCurrentMessage 
��ȷ����ѡ�еIJ˵�� 
viod CMainFrame : : OnCommmonMenuHandler ( ) 
{ 
    //Display selected menu item in debug window . 
    TRACE ("Menu item %u was selected . \n" , 
                                 GetCruuentMessage ( ) ��> wParam ); 
} 

-- 
�� ��Դ:��BBS ˮľ�廪վ bbs.net.tsinghua.edu.cn��[FROM: sapphire.ncic.a] 

                         [������ҳ] [����������] [ȫ��������]

--
m;37m�� ��Դ:���Ͻ�ɺ� bbs.njupt.edu.cn��[FROM: pc05.info.njupt]m

--
�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: a507yjh.nju.edu]
Technical Details
Message-ID: <3OAiNl$svC@bbs.nju.edu.cn>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: Chinese,GB
X-Google-Thread: fc86e,377e39404dc0332e,start
X-Google-Attributes: gidfc86e,public
From: mendy.bbs@bbs.nju.edu.cn (�ϵ�)
Subject: vc���ָ��68ƪ(4) 
Date: 1998/04/19
Message-ID: <3OAiNl$svC@bbs.nju.edu.cn>
X-Deja-AN: 345936985
X-Filename: Programming/M.893022335.A
Organization: nju_bbs
Newsgroups: cn.bbs.comp.program