lucyAnny.cpp
上传用户:cqslgg
上传日期:2009-12-10
资源大小:128k
文件大小:3k
- //---------------------------------------------------------------------------
- #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;
- }
- //---------------------------------------------------------------------------