🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

vc���ָ��68ƪ(9)

#1088
From: �ϵ�
Date: Sun, 19 Apr 1998 00:00
180 lines
7359 bytes
2m������:m TINA (�ռ�����)
2m��  ��:m RAD
2m��  ��:m  VC��̼���68ƪ(9)
2m����վ:m '3m�Ͻ�ɺ�m' (Mon Apr  6 08:39:03 1998) , 5mվ���ż�m

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

������: Zeemon (������), ����: Visual 
��  ��: vc���ָ��68ƪ(9) 
����վ: BBS ˮľ�廪վ (Thu Oct 23 12:57:58 1997) 

61����β�ѯ������ϵͳ���� 

    ��Windows 3.1 SDK�н��ܹ�SDK����SystemParametersInfo�����øú���� 
�Բ�ѯ������ϵͳ�������簴����ظ��������á����˫���ӳ�ʱ�䡢ͼ������ 
�Լ����渲��λͼ�ȵȡ� 

//Create a font that is used for icon titles. 
LOGFONT stFont; 
: : SystemParametersInfo (SPIF_GETICONTITLELOGFONT, 
     sizeof (LOGFONT), &stFont, SPIF_SENDWININICHANGE); 
m_font.CreateFontIndirect (&stFont); 

//Change the wallpaper to leaves.bmp. 
: : SystemParametersInfo (SPI_SETDESKWALLPAPER, 0, 
       _T (" forest.bmp"), SPIF_UPDATEINIFILE); 

62�����ʹ��һ��Ԥ�����Windows��� 

    ����CWinApp:: LoadStandardCursor�����͹���ʶ�� 
     BOOL CSampleDialog:: OnSetCursor (CWnd* pWnd, UINT nHitTest, UINT 
message) 
{ 
     //Display wait cursor if busy. 
     if (m_bBusy) 
     { 
         SetCursor (AfxGetApp () ->LoadStandardCursor (IDC_WAIT)); 
         return TRUE; 
     } 

     return CDialog:: OnSetCursor (pWnd. nHitTest,message); 
} 

63�����ȷ����ǰ��Ļ�ֱ��� 

    ����SDK����GetSystemMetrics���ú�����Լ����й�windows��ʾ��Ϣ������ 
�����С���߽��С�Լ���������С�ȵȡ� 

//Initialize CSize object with screen size. 
CSize sizeScreen (GetSystemMetrics (SM_CXSCREEN), 
     GetSystemMetrics (SM_CYSCREEN)); 

64����μ���ԭ�ȵ�Task ManagerӦ�ó���ʹ�õ������б� 

    ԭ�ȵ�Task ManagerӦ�ó�����ʾ���㴰�ڵ��б?Ϊ����ʾ���б?���� 
����ɼ��һ�������Լ����ܱ������ӵ�С�����CWnd:: GetWindow���� 
�������㴰�ڵ��б?����IsWindowVisible��GetWindowTextLength�Լ�GetOwner 
����ȷ�������Ƿ�Ӧ�����б��С������TaskManager���ڵı�����䵽�б��С� 

void GetTadkList (CListBox&list) 
{ 
     CString strCaption;        //Caption of window. 

     list.ResetContent ();       //Clear list box. 

     //Get first Window in window list. 
     ASSERT_VALID (AfxGetMainWnd ()); 
     CWnd* pWnd=AfxGetMainWnd () ->GetWindow (GW_HWNDFIRST); 

     //Walk window list. 
     while (pWnd) 
     { 
         // I window visible, has a caption, and does not have an owner? 
         if (pWnd ->IsWindowVisible () && 
            pWnd ->GetWindowTextLength () &&! pWnd ->GetOwner ()) 
         { 
            //Add caption o window to list box. 
            pWnd ->GetWindowText  (strCaption); 
            list.AddString (strCaption); 
         } 
         //Get next window in window list. 
         pWnd=pWnd->GetWindow (GW_HWNDNEXT); 
     } 
} 

65�����ȷ��Windows��WindowsϵͳĿ¼ 

    ������SDK���������ɸù��ܡ�GetWindowsDirectory��GetSystemDirectory�� 
����˵�������ʹ������������ 

TCHAR szDir [MAX_PATH]; 
//Get the full path of the windows directory. 
: : GetWindowsDirectory (szDir, MAX_PATH); 
TRACE ("Windows directory %s\n", szDir); 
//Get the full path of the windows system directory. 
: : GetSystemDirectory (szDir, MAX_PATH); 
TRACE ("Windows system directory %s\n", szDir); 

66�����Ķ����ļ� 

    ����SDK����GetTemPath����ȷ����ʱ�ļ���Ŀ¼���ú�������Ϊ��ʱ·�� 
���TMP�������������û��ָ��TMP�����TMP����������Ȼ�󷵻ص���ǰĿ¼�� 
����˵������δ���һ����ʱ�ļ��� 
�� 
     //get unique temporary file. 
     CString strFile; 
     GetUniqueTempName (strFile); 

     TRY 
     { 
        //Create file and write data.Note that file is closed 
        //in the destructor of the CFile object. 
        CFile file (strFile,CFile:: modeCreate | CFile:: modeWrite); 

        //write data 
     } 

     CATCH (CFileException, e) 
     { 
        //error opening file 
     } 
     END_CATCH 
�� 

Void GetuniqueTempName (CString& strTempName) 
{ 
     //Get the temporary files directory. 
     TCHAR szTempPath  [MAX_PATH]; 
     DWORD dwResult=:: GetTempPath (MAX_PATH, szTempPath); 
     ASSERT (dwResult); 

     //Create a unique temporary file. 
     TCHAR szTempFile  [MAX_PATH]; 
     UINT nResult=GetTempFileName (szTempPath, _T ("~ex"),0,szTempfile); 
     ASSERT (nResult); 

     strTempName=szTempFile; 
} 

67����η������洰�� 

    ��̬����CWnd:: GetDesktopWindow �������洰�ڵ�ָ�롣����˵����MFC 
����CFrameWnd::BeginModalStae�����ʹ�øú�������ڲ������б�ġ� 

void CFrameWnd::BeginModalState () 
{ 
     �� 

     //first count all windows that need to be disabled 
     UINT nCount=0; 
     HWND hWnd=:: GetWindow (:: GetDesktopWindow (), GW_CHILD); 
     while (hWnd!=NULL) 
     { 
        if (:: IsWindowEnabled (hwnd) && 
            CWnd::FromHandlePermanent (hWnd)!=NULL && 
            AfxIsDescendant (pParent->m_hWnd, hWnd) && 
            :: SendMessage (hWnd, WM_DISABLEMODAL, 0, 0)==0) 
        { 
            ++nCount; 
        } 
        hWnd=:: GetWindow (hWnd, GW_HWNDNEXT); 
     }      
     �� 
} 

68�� 
    12. ����ô��ں� MDI����һ��������󻯺���С��? 
     ���������ϲ�Ϊһ����. 
-- 
�� �޸�:��Zeemon � Oct 23 13:03:03 �޸ı��ġ�[FROM: sapphire.ncic.a] 
�� ��Դ:��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: <3OAiQ4$t18@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,271c4a729cfe57f3,start
X-Google-Attributes: gidfc86e,public
From: mendy.bbs@bbs.nju.edu.cn (�ϵ�)
Subject: vc���ָ��68ƪ(9) 
Date: 1998/04/19
Message-ID: <3OAiQ4$t18@bbs.nju.edu.cn>
X-Deja-AN: 345954041
X-Filename: Programming/M.893022436.A
Organization: nju_bbs
Newsgroups: cn.bbs.comp.program