Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- TDeviceMode dv;
- bool bl;
- old_scr_width=Screen->Width;
- old_scr_height=Screen->Height;
- bl=EnumDisplaySettings(NULL,0,&dv);
- if(bl)
- {
- dv.dmFields=DM_PELSWIDTH | DM_PELSHEIGHT;
- dv.dmPelsWidth=1024;
- dv.dmPelsHeight=768;
- if(ChangeDisplaySettings(&dv,0)==DISP_CHANGE_SUCCESSFUL)
- ShowMessage("屏幕分辩率已改为1024*768n但该程序关闭后会恢复到原状");
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormDestroy(TObject *Sender)
- {
- TDeviceMode dv;
- bool bl;
- bl=EnumDisplaySettings(NULL,0,&dv);
- if(bl)
- {
- dv.dmFields=DM_PELSWIDTH | DM_PELSHEIGHT;
- dv.dmPelsWidth=old_scr_width;
- dv.dmPelsHeight=old_scr_height;
- if(ChangeDisplaySettings(&dv,0)==DISP_CHANGE_SUCCESSFUL)
- ShowMessage("屏幕恢复到原状");
- }
- }
- //---------------------------------------------------------------------------