首页/技术开发/内容

用C++Builder 5开发Windows下的屏保

技术开发2023-12-25 阅读()
SWP_SHOWWINDOW);//将FrmControl的窗口覆盖屏保预览窗口
的客户区,并显示它
                   }
                 else if(StartType=="/a")//启动密码设置窗口
                  {
                   temp=Command.SubString(3,Command.Length()-2);
                   CPWindow =(long *)temp.ToInt();
                  //以下是动态调用mpr.dll里的PwdChangePasswordA函数的过程
                   typedef UINT(CALLBACK *FUN)(LPSTR,HWND,UINT,UINT);
                   HINSTANCE hDll=LoadLibrary("mpr.DLL");
                   FUN myfun;
                   if(hDll!=NULL)
                    {
                     myfun=(FUN)GetProcAddress(hDll,"PwdChangePasswordA");
                     if(!myfun)FreeLibrary(hDll);
                     else
                     myfun("SCRSAVE", CPWindow, 0, 0);//函数的调用
                    }
                  }
                 Application->Run();
        }
        catch (Exception &exception)
        {
                 Application->ShowException(&exception);
        }
        return 0;
}
//---------------------------------------------------------------------------
/*{*******************************}*/
/*{*****   Unitmain.h     ****}*/
/*{*******************************}*/
//---------------------------------------------------------------------------

#ifndef UnitmainH
#define UnitmainH
//---------------------------------------------------------------------------
#include
#include
#include
#include
#include
#include
#include
//---------------------------------------------------------------------------
class TFrmmain : public TForm
{
__published: // IDE-managed Components
        TTimer *Timer1;
        TImage *Image1;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
        void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
        void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
        void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
        void __fastcall Image1MouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
        void __fastcall Image1MouseMove(TObject *Sender, TShiftState Shift,
          int X, int Y);
        void __fastcall Timer1Timer(TObject *Sender);
private: // User declarations
       DWORD PWProtect;
       DWORD Version;
       String picdir;
       int frequence;
public: // User declarations
        __fastcall TFrmmain(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFrmmain *Frmmain;
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
/*{*******************************}*/
/*{*****  Unitmain.cpp   ****}*/
/*{*******************************}*/
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include
#include "Unitmain.h"
#include
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFrmmain *Frmmain;
//---------------------------------------------------------------------------
__fastcall TFrmmain::TFrmmain(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFrmmain::FormCreate(TObject *Sender)
{
    //使窗口成为最顶层的窗口
    SetWindowPos(this->Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE(北联网教程,专业提供视频软件下载)

第1页  第2页  第3页  第4页  第5页  第6页  第7页 

……

相关阅读