Ignore:
Timestamp:
2000-09-12T13:36:44+12:00 (24 years ago)
Author:
sjboddie
Message:

Got compiling on VC++ 4.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsinstaller/gs16bit.cpp

    r1538 r1539  
     1#include "Splash.h"
     2
     3
     4
     5UINT        timer;
     6
     7HWND    splash_window;
     8
     9BOOL        splash_done;
     10
     11HBITMAP splash_bmp;
     12
     13int         splash_bmpheight;
     14
     15
     16
     17void CALLBACK splash_timerproc(HWND Window, UINT Message, UINT id, DWORD time)
     18
     19{   splash_done = TRUE;
     20
     21  KillTimer(NULL, 0);
     22
     23}
     24
     25
     26
     27long FAR PASCAL _export splash_windproc(HWND Window, UINT Message, WPARAM wParameter, LPARAM lParameter)
     28
     29{   switch (Message)
     30
     31    { case WM_CREATE:
     32
     33    { timer = SetTimer(NULL, 0, 3000, (TIMERPROC) splash_timerproc);
     34
     35    }
     36
     37    break;
     38
     39
     40
     41    case WM_TIMER: // valid id; just kill window after timer elapses
     42
     43      splash_done = TRUE;
     44
     45        KillTimer(Window, 0);
     46
     47    break;
     48
     49
     50
     51    case WM_DESTROY:
     52
     53      splash_window = 0;
     54
     55    break;
     56
     57
     58
     59        case WM_PAINT:
     60
     61        { PAINTSTRUCT   PaintInfo;
     62
     63        HDC                 dc, bmpDC;
     64
     65      BITMAP            bmpData;
     66
     67      POINT             origin, size;                                       
     68
     69
     70
     71            dc = BeginPaint(Window, &PaintInfo);
     72
     73      bmpDC = CreateCompatibleDC(dc);
     74
     75      SelectObject(bmpDC, splash_bmp);
     76
     77
     78
     79      GetObject(splash_bmp, sizeof(BITMAP), (LPVOID) &bmpData);
     80
     81
     82
     83      size.x = bmpData.bmWidth;
     84
     85      size.y = bmpData.bmHeight;
     86
     87      DPtoLP(dc, &size, 1);
     88
     89
     90
     91      origin.x = 0;
     92
     93      origin.y = 0;
     94
     95      DPtoLP(dc, &origin, 1);
     96
     97
     98
     99      BitBlt(dc, 0, 0, size.x, size.y,
     100
     101             bmpDC, origin.x, origin.y, SRCCOPY);
     102
     103
     104
     105      DeleteDC(bmpDC);
     106
     107            EndPaint(Window, &PaintInfo);
     108
     109        }
     110
     111        break;
     112
     113
     114
     115    case WM_COMMAND:
     116
     117    break;
     118
     119
     120
     121    default:
     122
     123            return(DefWindowProc(Window, Message, wParameter, lParameter));
     124
     125  }
     126
     127    return 0L;
     128
     129}
     130
     131
     132
     133void splash_register(HINSTANCE instance)
     134
     135{ WNDCLASS Class;
     136
     137    static bool registered = false;
     138
     139  if (registered == false)
     140
     141  { Class.lpszClassName = "Generic:Splash";
     142
     143        Class.hInstance     = instance;
     144
     145        Class.lpfnWndProc       = (WNDPROC) splash_windproc;
     146
     147        Class.hCursor               = LoadCursor(NULL, IDC_ARROW);
     148
     149        Class.hIcon                 = NULL;
     150
     151        Class.lpszMenuName  = NULL;
     152
     153        Class.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
     154
     155        Class.style                 = NULL;
     156
     157        Class.cbClsExtra        = 0;
     158
     159        Class.cbWndExtra        = 0;
     160
     161        RegisterClass(&Class);
     162
     163    registered  = TRUE;
     164
     165    }
     166
     167}
     168
     169
     170
     171void _export splash_show(HINSTANCE instance, unsigned int time)
     172
     173{ MSG       msg;
     174
     175  RECT      r;
     176
     177  BITMAP    bmpData;
     178
     179  POINT     size;
     180
     181  int     sx, sy;
     182
     183  HDC     dc;
     184
     185
     186
     187  splash_register(instance);
     188
     189
     190
     191  splash_bmp    = LoadBitmap(instance, (LPCSTR) MAKEINTRESOURCE(9007));
     192
     193    splash_done = FALSE;
     194
     195
     196
     197  GetObject(splash_bmp, sizeof(BITMAP), (LPVOID) &bmpData);
     198
     199  size.x = bmpData.bmWidth;
     200
     201  size.y = bmpData.bmHeight;
     202
     203
     204
     205  r.left        = 0;
     206
     207  r.top         = 0;
     208
     209  r.right       = size.x;
     210
     211  r.bottom  = size.y;
     212
     213  AdjustWindowRect(&r, 0, TRUE);
     214
     215
     216
     217  splash_bmpheight  = size.y;
     218
     219  dc = GetDC(GetDesktopWindow());
     220
     221  sx = GetDeviceCaps(dc, HORZRES);
     222
     223  sy = GetDeviceCaps(dc, VERTRES);
     224
     225  ReleaseDC(GetDesktopWindow(), dc);
     226
     227
     228
     229    splash_window = CreateWindow("Generic:Splash", "Greenstone Installer",
     230
     231                                                                WS_DLGFRAME | WS_VISIBLE,
     232
     233                                (sx - r.right + r.left) / 2,
     234
     235                                (sy - r.bottom + r.top) / 2,
     236
     237                                r.right-r.left, r.bottom-r.top,
     238
     239                                0, 0, instance, NULL);
     240
     241  while (GetMessage(&msg, NULL, NULL, NULL) &&
     242
     243                splash_done == FALSE)
     244
     245  { if (msg.message == WM_TIMER)
     246
     247    { msg.hwnd = splash_window;
     248
     249    }
     250
     251    TranslateMessage(&msg);
     252
     253    DispatchMessage(&msg);
     254
     255  }
     256
     257  DestroyWindow(splash_window);
     258
     259}
     260
     261
     262
    1263#include <windows.h>
    2264
Note: See TracChangeset for help on using the changeset viewer.