⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01_9_13_15.asp.html

📁 有用的VC教程,包括编程思想编程技巧程序效率等方面的指导
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<TITLE>计算机世界网-用VC++6.0制作图片屏幕保护程序</TITLE></HEAD>
<style>
.a14{font-size:14px;text-indent:25px;line-height:20px}
.f{font-size:18px;color=#0f3ccd}
img{border:0px;}
td,p,input{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>
<center>
<BODY topmargin=2 leftmargin=0>
<style>
.v12{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>

<style>
.v13{font-size:10pt;color:"#ffffff";FONT-WEIGHT: bold}
.v12{font-size:13px;color:"#4C029C";FONT-WEIGHT: bold}
.v14{font-size:14px;text-indent:25px;line-height:20px}
img{border:0px;}
td,p,input,select{font-fammily:verdana,宋体;font-size:12px;}
A:link {text-decoration:none;color:black}
A:visited {text-decoration:none;color:#80006f}
A:hover {text-decoration:underline;color:black}
</style>

<!--头-->

<table align=center cellpadding="0" cellspacing="0" border="0" width="767">
  <tr><td valign=bottom>
      <table cellpadding="0" cellspacing="0" border=0>
        <tr><td valign=top><img src="../../../../../center/image/ccwlogo.gif"></td></tr>
        <tr><td height="27" valign=top><img src="../../../../../center/image/knowledge.gif" width="207" height="27"></td></tr>
      </table></td>
	<td valign=bottom width=556 bgcolor="#4c029c" height=96>
		  <table cellpadding="0" cellspacing="0" border=0 width=556 bgcolor="#4c029c" height=96>
        <tr><td height=25 valign=bottom bgcolor="#ffffff"  colspan=2 ><img src="../../../../../image2002/top.gif" usemap="#F"></td></tr>
	<tr  valign=middle >
		<td align=center valign=middle height="60" align=center>
		<!-- <a href="http://www.ccw.com.cn/search/" target=_blank><img src="../../../../../img2/esearch.GIF" border=0 width=468 height=60></a> --><a href="http://www.ccw.com.cn/html/search/thememail/" target=_blank><img src="../../../../../img2/topbanner_thememail.GIF" border=0 width=468 height=60></a>	
		</td>		
		<td  align=center width=15%>
			<table width=95%>
				<tr><td><a href="mailto:center@ccw.com.cn?subject=我要投稿:" target=_blank><font class=v13>我要投稿</a><br><a href="mailto:center@ccw.com.cn?subject=编读往来"><font class=v13>编读往来</a><br><a href="javascript:AddBookMark('计算机世界网首页')"><font class=v13>加入收藏</a></font></td></tr>
			</table>
		</td>
	</tr>
		<tr><td bgcolor="#ffffff" height=1 colspan=2 ></td></tr>
		<tr><td bgcolor="#b4aafc" height=2 colspan=2 ></td></tr></table>
		<map name="F">
<area href="http://www.ccw.com.cn/" shape="rect" coords="29, 3, 61, 18" target=_blank>
<area href="http://www.ccw.com.cn/news1/" shape="rect" coords="72, 3, 143, 18" target=_blank>
<area href="http://www.ccw.com.cn/center/" shape="rect" coords="155, 2, 216, 18" target=_blank>
<area href="http://www.ccw.com.cn/work/" shape="rect" coords="225, 2, 299, 18" target=_blank>
<area href="http://www.ccw.com.cn/search/" shape="rect" coords="310, 3, 364, 19" target=_blank>
<area href="http://www3.ccw.com.cn/" shape="rect" coords="372, 2, 412, 19" target=_blank>
<area href="http://www2.ccw.com.cn/" shape="rect" coords="424, 2, 550, 18" target=_blank></map>
	</td></tr>
	<tr><td colspan=2 bgcolor="#b4aafc">
	<table border=0 cellpadding=0 cellspacing=0 width=100%>
		<tr>
            <td width=26% align=center><font  class=v12>【2003年6月24日】&nbsp;&nbsp;&nbsp;</font></td>
            <td CLASS=V12> <a href="http://www.ccw.com.cn/center/topic.asp">专 题</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/tech.asp">技 术</a>  /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/prod.asp">产 品</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/app.asp">应 用</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/net.asp">网 络</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/prog.asp">编 程</a> /</td>
            <td CLASS=V12><a href="http://www.ccw.com.cn/center/skill.asp">技 巧</a> </td>
         </tr>
	</table>
	</td></tr>
</table>
<table align=center width=728>
<tr><td align=center><br><h2><font color='#0f3ccd'>用VC++6.0制作图片屏幕保护程序</font></h2>
<br><b>武汉 鄢小征</b>
</td></tr><tr><td align=right>01-9-13 下午 04:02:55<br><hr size=1 width=718 color=#f46240></td></tr></table><br>
<table align=center width=728><tr><td valign=top width=600>
<table width=100% ><tr><td class=a14>VC++可谓神通广大,如果学到家了,或者就掌握了那么一点MFC,你也会感到它的方便快捷,当然最重要的是功能强大。不是吗,从最基本的应用程序.EXE到动态连接库DLL,再由风靡网上的ActiveX控件到Internet Server API,当然,还有数据库应用程序……瞧,我都用它来做屏幕保护程序了。一般的屏幕保护程序都是以SCR作为扩展名,并且要放在c:\windows 目录或 c:\windows\system 目录下,由Windows 98内部程序调用(Windows NT 是在 c:\windows\system32 目录下)。怎么调用?不用说了,这谁不知道。</td></tr></table><table width=100% ><tr>
      <td class=a14> 好了,我们来作一个简单的。选择MFC AppWizard(exe),Project Name 为MyScreensaver,[NEXT],对话框,再后面随你了。打开菜单Project、Settings,在Debug页、Executable 
        for debug session项,以及Link页中Output file name项改为c:\windows\MyScreensaver.scr,这样,你可以调试完后,直接在VC中运行(Ctrl+F5),便可看到结果。当然,这样做的唯一缺点是你必须手动清除Windows 
        目录下的垃圾文件(当然是在看到满意结果后;还有,你可借助SafeClean 这个小东东来帮你清除,除非你的硬盘大的让你感到无所谓……快快快回来,看我跑到那里去了)。接下来用Class 
        Wizard生成CMyWnd类,其基类为CWnd(在Base Class 中为generic CWnd)。这个类是我们所要重点研究的。创建满屏窗口、计时器,隐藏鼠标,展示图片,响应键盘、鼠标等等,这家伙全包了。至于MyScreensaverDlg.h与MyScreensaverDlg.cpp文件我们暂时不管。打开MyScreensaver.cpp,修改InitInstance()函数:</td>
    </tr></table><table width=100% ><tr><td class=a14>
  BOOL CMyScreensaverApp::InitInstance()</td></tr></table><table width=100% ><tr><td class=a14>
  {</td></tr></table><table width=100% ><tr><td class=a14>
   AfxEnableControlContainer();</td></tr></table><table width=100% ><tr><td class=a14>
  #ifdef _AFXDLL</td></tr></table><table width=100% ><tr><td class=a14>
   Enable3dControls(); // Call this when using MFC in a shared DLL</td></tr></table><table width=100% ><tr><td class=a14>
  #else</td></tr></table><table width=100% ><tr><td class=a14>
   Enable3dControlsStatic(); // Call this when linking to MFC statically</td></tr></table><table width=100% ><tr><td class=a14>
  #endif</td></tr></table><table width=100% ><tr><td class=a14>
   CMyWnd* pWnd = new CMyWnd;</td></tr></table><table width=100% ><tr><td class=a14>
   pWnd->Create();</td></tr></table><table width=100% ><tr><td class=a14>
   m_pMainWnd = pWnd;</td></tr></table><table width=100% ><tr><td class=a14>
   return TRUE;</td></tr></table><table width=100% ><tr><td class=a14>
  }</td></tr></table><table width=100% ><tr>
      <td class=a14> 当然,再这之前得先 #include “MyWnd.h" 。后面要做的都在MyWnd.h 与 MyWnd.cpp 
        两文件中了。</td>
    </tr></table><table width=100% ><tr>
      <td class=a14> 下面给出CMyWnd 的说明:</td>
    </tr></table><table width=100% ><tr><td class=a14>
  class CMyWnd : public CWnd</td></tr></table><table width=100% ><tr><td class=a14>
  {</td></tr></table><table width=100% ><tr><td class=a14>
  public:</td></tr></table><table width=100% ><tr><td class=a14>
   CMyWnd();</td></tr></table><table width=100% ><tr><td class=a14>
   static LPCSTR lpszClassName; //注册类名</td></tr></table><table width=100% ><tr><td class=a14>
  public:</td></tr></table><table width=100% ><tr><td class=a14>
   BOOL Create();</td></tr></table><table width=100% ><tr><td class=a14>
  public:</td></tr></table><table width=100% ><tr><td class=a14>
   // ClassWizard generated virtual function overrides</td></tr></table><table width=100% ><tr><td class=a14>
   //{{AFX_VIRTUAL(CMyWnd)</td></tr></table><table width=100% ><tr><td class=a14>
   protected:</td></tr></table><table width=100% ><tr><td class=a14>
   virtual void PostNcDestroy();</td></tr></table><table width=100% ><tr><td class=a14>
   //}}AFX_VIRTUAL</td></tr></table><table width=100% ><tr><td class=a14>
  public:</td></tr></table><table width=100% ><tr><td class=a14>
   virtual ~CMyWnd();</td></tr></table><table width=100% ><tr><td class=a14>
  protected:</td></tr></table><table width=100% ><tr><td class=a14>
   CPoint m_prePoint; //检测鼠标移动</td></tr></table><table width=100% ><tr><td class=a14>
   void DrawBitmap(CDC& dc, int nIndexBit);</td></tr></table><table width=100% ><tr><td class=a14>
   //{{AFX_MSG(CMyWnd)</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnPaint();</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnLButtonDown(UINT nFlags, CPoint point);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnMButtonDown(UINT nFlags, CPoint point);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnMouseMove(UINT nFlags, CPoint point);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnRButtonDown(UINT nFlags, CPoint point);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnDestroy();</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnTimer(UINT nIDEvent);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);</td></tr></table><table width=100% ><tr><td class=a14>
   afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);</td></tr></table><table width=100% ><tr><td class=a14>
   //}}AFX_MSG</td></tr></table><table width=100% ><tr><td class=a14>
   DECLARE_MESSAGE_MAP()</td></tr></table><table width=100% ><tr><td class=a14>
  };</td></tr></table><table width=100% ><tr><td class=a14>
  MyWnd.cpp 文件:</td></tr></table><table width=100% ><tr><td class=a14>
  ……</td></tr></table><table width=100% ><tr><td class=a14>
  CMyWnd::CMyWnd()</td></tr></table><table width=100% ><tr><td class=a14>
  {</td></tr></table><table width=100% ><tr><td class=a14>
   m_prePoint=CPoint(-1, -1);</td></tr></table><table width=100% ><tr><td class=a14>
  } </td></tr></table><table width=100% ><tr><td class=a14>
  LPCSTR CMyWnd::lpszClassName=NULL;</td></tr></table><table width=100% ><tr><td class=a14>
  BOOL CMyWnd::Create()</td></tr></table><table width=100% ><tr><td class=a14>
  {</td></tr></table><table width=100% ><tr><td class=a14>
   if(lpszClassName==NULL)</td></tr></table><table width=100% ><tr><td class=a14>
   {</td></tr></table><table width=100% ><tr><td class=a14>
   lpszClassName=AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW, </td></tr></table><table width=100% ><tr><td class=a14>
  ::LoadCursor(AfxGetResourceHandle(),MAKEINTRESOURCE(IDC_NOCURSOR)));</td></tr></table><table width=100% ><tr><td class=a14>
  //注册类;IDC_NOCURSOR为新建光标的ID,这个光标没有任何图案</td></tr></table><table width=100% ><tr><td class=a14>
   }</td></tr></table><table width=100% ><tr><td class=a14>
   CRect rect(0, 0, ::GetSystemMetrics(SM_CXSCREEN),</td></tr></table><table width=100% ><tr><td class=a14>
   ::GetSystemMetrics(SM_CYSCREEN));</td></tr></table><table width=100% ><tr><td class=a14>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -