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

📄 lucyanny.cpp

📁 用C++Builder开发Windows下的屏保
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
USERES("lucyAnny.res");
USEFORM("Unitcontrol.cpp", MainForm);
USEFORM("Unitmain.cpp", FormControl);
USEFORM("Unitview.cpp", FormView);
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR p, int)
{ String StartType;
  AnsiString Command=p,temp;
  HWND CPWindow =NULL;
  if(Command=="")
   StartType = "/c";
  else
   StartType=Command.SubString(1,2);
        try
        {       // if(!FindWindow(NULL,"MainForm")){
                 Application->Initialize();
                 if(StartType=="/c")
                 {Application->CreateForm(__classid(TFormControl), &FormControl);
                 Application->CreateForm(__classid(TForm1), &Form1);}
                 else if(StartType=="/s")
                   Application->CreateForm(__classid(TMainForm), &MainForm);
                 else if(StartType=="/p")
                  {
                  Application->CreateForm(__classid(TFormView), &FormView);
                 temp=Command.SubString(3,Command.Length()-2);
                   CPWindow =(long *)temp.ToInt();
                   RECT *lookrect;
                   long style=GetWindowLong(Application->MainForm->Handle,GWL_STYLE);
                   style=style|WS_CHILD;
                   SetWindowLong(Application->MainForm->Handle,GWL_STYLE,style);
                   SetParent(Application->MainForm->Handle,CPWindow);
                   GetClientRect(CPWindow,lookrect);
                   SetWindowPos(Application->MainForm->Handle,HWND_TOP,0,0,lookrect->right,lookrect->bottom ,SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
                   }
                 else if(StartType=="/a")
                  {
                   temp=Command.SubString(3,Command.Length()-2);
                   CPWindow =(long *)temp.ToInt();
                   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;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

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