| 首页 | 技术文章 | 软件下载 | 博客 | 论坛 | 精品教程 | 黑客动画 | 视频资源 | 在线服务 | 黑客游戏 | 

您现在的位置: 中国X黑客小组 >> 技术文章 >> 编程技术 >> 程序设计 >> 文章正文 用户登录 新用户注册
  用VC写一个完整的屏幕保护程序          【字体:
用VC写一个完整的屏幕保护程序
作者:未知    文章来源:CnXHacker.Net    点击数:    更新时间:2006-10-26    
sp;    {
        FreeLibrary( g_hPasswordDLL );
        g_hPasswordDLL = NULL;
     }

  
     PostQuitMessage( 0 );
}
/////////////////////////////////
VOID InterruptSaver()
{
    BOOL bPasswordOkay = FALSE;
    if( g_SaverMode == sm_test ||
        g_SaverMode == sm_full&&!g_bCheckingSaverPassword )
    {
        if( g_bIs9x && g_SaverMode == sm_full )
        {
            // Win9x下如果g_VerifySaverPassword==NULL,则没有设屏保密码。
            if ( g_VerifySaverPassword != NULL )
            {
               
                      g_bCheckingSaverPassword = TRUE;//告诉消息响应函数正在验证密码
                bPasswordOkay = g_VerifySaverPassword( g_hWnd );
                                                     g_bCheckingSaverPassword = FALSE; //密码验证结束。

                if ( !bPasswordOkay )
                {
                   //屏保程序继续运行…
                    SetCursor( NULL );
                    g_dwSaverMouseMoveCount = 0;

                    return;
                }
            }
        }

        ShutdownSaver();
    }
}

屏保设置方式下的响应程序为自定义Doconfig( ),因篇幅的关系不再详细介绍,读者应当很容易自己加上,也可以定义为空函数:VOID Doconfig ( ) { return;}。

黑屏屏幕保护程序主入口函数如下:

#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <regstr.h>
#include "Saver.h"
#include "resource.h"

HINSTANCE g_hinstance;
HWND g_hWndParent;
BOOL  g_bWaitForInputIdle;
HWND g_hWnd;


LRESULT CALLBACK SaverProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
                          // TODO: Place code here.
   
                           MSG msg;

                           g_bCheckingSaverPassword = FALSE;
                g_bIs9x = FALSE;
                g_dwSaverMouseMoveCount = 0;
                g_hWndParent = NULL;
                g_hPasswordDLL = NULL;
                g_hWnd = NULL;
                g_VerifySaverPassword = NULL;
                g_hinstance=hInstance;
   

                           WNDCLASS    cls;
                cls.hCursor = LoadCursor( NULL, IDC_ARROW );
                cls.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(IDI_MAIN_ICON) );
                cls.lpszMenuName = NULL;
                cls.lpszClassName = TEXT("SaverWndClass");
                cls.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
                cls.hInstance = hInstance;
                cls.style = CS_VREDRAW|CS_HREDRAW;
                cls.lpfnWndProc = SaverProc;
                cls.cbWndExtra = 0;
                cls.cbClsExtra = 0;

             if(!RegisterClass( &cls ))
                                    MessageBox(NULL,TEXT("Cant register window class"),TEXT("SaverWndClass"),MB_ICONERROR);

   
                           SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_IDLE );
                TCHAR* pstrCmdLine = GetCommandLine();
                           g_SaverMode = ParseCommandLine(pstrCmdLine);

                           switch(g_SaverMode)
                           {
      
                           case sm_preview:
                           case sm_full:
                           case sm_test:

                               g_hWnd=CreateSaverWindow(g_SaverMode,g_hWndParent,hInstance);
                          
                               if ( g_hWnd == NULL )
                                       {
                                                     &n

上一页  [1] [2] [3] [4] [5] 下一页

文章录入:IceRiver    责任编辑:IceRiver 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    用VMware虚拟环境让恶意软件
    设陷阱用VMware虚拟环境让恶
    zcfgsvc.exe - zcfgsvc - 进
    winstylerthemesvc.exe - wi
    6to4svc - 6to4svc.dll - DL
    yiesrvc.dll - yiesrvc - DL
    阿利谈安全之安装了 SAVCE的
    学会用 VC++ 动态链接库编写
    学会用 VC++ 动态链接库编写
    用vbs来写sql注入等80端口的
      网友评论:(只显示最新5条。评论内容只代表网友观点,与本站立场无关!)
    Powered by ICE RIVER - STUDIO
    » CnXHacker.CoM   © CopyRight 2002-2006, CnXHacker.CoM™, Inc. All Rights Reserved.