paint.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 static void PaintBackground(HWND hDlg){
00027 int x;
00028 int y;
00029 HDC hDC;
00030 HPALETTE hpalT;
00031 HBRUSH hOldBrush;
00032 RECT rc1,rc2;
00033 HDC hMemDC;
00034 HBITMAP hBmBackground,hbmOld;
00035 BITMAP bm;
00036 PAINTSTRUCT ps;
00037 hDC = BeginPaint(hDlg,&ps);
00038 hBmBackground=LoadBitmap(hDLLinstance,"screen");
00039 if(hBmBackground != NULL){
00040 GetObject(hBmBackground,sizeof(BITMAP),&bm);
00041 hMemDC = CreateCompatibleDC(hDC);
00042 hbmOld = SelectObject(hMemDC,hBmBackground);
00043 GetClientRect(hDlg,&rc2);
00044 for(x=0;x<(rc2.right/bm.bmWidth)+1;x++)
00045 for(y=0;y<(rc2.bottom/bm.bmHeight)+1;y++)
00046 BitBlt(hDC,
00047 x*bm.bmWidth,y*bm.bmHeight,
00048 bm.bmWidth,
00049 bm.bmHeight,
00050 hMemDC,
00051 0,0,
00052 SRCCOPY);
00053 SelectObject(hMemDC,hbmOld);
00054 DeleteDC(hMemDC);
00055 DeleteObject(hBmBackground);
00056 }
00057 EndPaint(hDlg,&ps);
00058 }
00059
00060 static void CentreDialogOnScreen(HWND hwnd){
00061 RECT rcDlg;
00062 long Xres,Yres;
00063 Yres=GetSystemMetrics(SM_CYSCREEN);
00064 Xres=GetSystemMetrics(SM_CXSCREEN);
00065 GetWindowRect(hwnd,&rcDlg);
00066 OffsetRect(&rcDlg,-rcDlg.left,-rcDlg.top);
00067 OffsetRect(&rcDlg,(Xres-rcDlg.right)/2,(Yres-rcDlg.bottom)/2);
00068 SetWindowPos(hwnd,HWND_TOP,rcDlg.left,rcDlg.top,0,0,SWP_NOSIZE);
00069 return;
00070 }
00071
00072 static void LoadAnimatedClip(HWND hDlg){
00073 char *c,modname[256];
00074 GetModuleFileName(hDLLinstance,modname,255);
00075 if((c=strrchr(modname,'.')) != NULL){
00076 strcpy(c,".avi");
00077 Animate_Open(GetDlgItem(hDlg,DLG_ANIMATE),modname);
00078 Animate_Play(GetDlgItem(hDlg,DLG_ANIMATE),0, -1, -1);
00079 }
00080 }