lucyAnny.cpp
上传用户:cqslgg
上传日期:2009-12-10
资源大小:128k
文件大小:3k
源码类别:

Delphi/CppBuilder

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. USERES("lucyAnny.res");
  5. USEFORM("Unitcontrol.cpp", MainForm);
  6. USEFORM("Unitmain.cpp", FormControl);
  7. USEFORM("Unitview.cpp", FormView);
  8. USEFORM("Unit1.cpp", Form1);
  9. //---------------------------------------------------------------------------
  10. WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR p, int)
  11. { String StartType;
  12.   AnsiString Command=p,temp;
  13.   HWND CPWindow =NULL;
  14.   if(Command=="")
  15.    StartType = "/c";
  16.   else
  17.    StartType=Command.SubString(1,2);
  18.         try
  19.         {       // if(!FindWindow(NULL,"MainForm")){
  20.                  Application->Initialize();
  21.                  if(StartType=="/c")
  22.                  {Application->CreateForm(__classid(TFormControl), &FormControl);
  23.                  Application->CreateForm(__classid(TForm1), &Form1);}
  24.                  else if(StartType=="/s")
  25.                    Application->CreateForm(__classid(TMainForm), &MainForm);
  26.                  else if(StartType=="/p")
  27.                   {
  28.                   Application->CreateForm(__classid(TFormView), &FormView);
  29.                  temp=Command.SubString(3,Command.Length()-2);
  30.                    CPWindow =(long *)temp.ToInt();
  31.                    RECT *lookrect;
  32.                    long style=GetWindowLong(Application->MainForm->Handle,GWL_STYLE);
  33.                    style=style|WS_CHILD;
  34.                    SetWindowLong(Application->MainForm->Handle,GWL_STYLE,style);
  35.                    SetParent(Application->MainForm->Handle,CPWindow);
  36.                    GetClientRect(CPWindow,lookrect);
  37.                    SetWindowPos(Application->MainForm->Handle,HWND_TOP,0,0,lookrect->right,lookrect->bottom ,SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
  38.                    }
  39.                  else if(StartType=="/a")
  40.                   {
  41.                    temp=Command.SubString(3,Command.Length()-2);
  42.                    CPWindow =(long *)temp.ToInt();
  43.                    typedef UINT(CALLBACK *FUN)(LPSTR,HWND,UINT,UINT);
  44.                    HINSTANCE hDll=LoadLibrary("mpr.DLL");
  45.                    FUN myfun;
  46.                    if(hDll!=NULL)
  47.                     {
  48.                      myfun=(FUN)GetProcAddress(hDll,"PwdChangePasswordA");
  49.                      if(!myfun)FreeLibrary(hDll);
  50.                      else
  51.                      myfun("SCRSAVE", CPWindow, 0, 0);
  52.                     }
  53.                   }//}
  54.                  Application->Run();
  55.         }
  56.         catch (Exception &exception)
  57.         {
  58.                  Application->ShowException(&exception);
  59.         }
  60.         return 0;
  61. }
  62. //---------------------------------------------------------------------------