mrDarker
2025-08-16 df45966c52bac2eb465cf05c1d6328bf0d00c5ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//  ===========================================================================
//  File    Splash.h
//  Desc    The interface of the CSplash class
//  ===========================================================================
#ifndef _ABHI_SPLASH_H_
#define _ABHI_SPLASH_H_
 
#include <afxwin.h>
 
#define        MAX_SPLASH_SIZE  12
 
#ifndef __PNS_SPLASH_ARRAY__
#define __PNS_SPLASH_ARRAY__
typedef struct _SPLASH_ARRAY {
    CString        strtxt;
    COLORREF    color;
}SPLASH_ARRAY, *LSPLASH_ARRAY;
#endif 
 
 
//  ===========================================================================
//  Class   CSplash
//  Desc    Use it for displaying splash screen for applications
//          Works only on Win2000 , WinXP and later versions of Windows
//  ===========================================================================
class CSplash
{
public:
    //  =======================================================================
    //  Func   CSplash
    //  Desc   Default constructor
    //  =======================================================================
    CSplash();
    
    //  =======================================================================
    //  Func   CSplash
    //  Desc   Constructor
    //  Arg    Path of the Bitmap that will be show on the splash screen
    //  Arg    The color on the bitmap that will be made transparent
    //  =======================================================================
    CSplash(UINT uBitmap, COLORREF colTrans);
 
    //  =======================================================================
    //  Func   ~CSplash
    //  Desc   Desctructor
    //  =======================================================================
    virtual ~CSplash();
 
    //  =======================================================================
    //  Func   ShowSplash
    //  Desc   Launches the non-modal splash screen
    //  Ret    void 
    //  =======================================================================
    void            ShowSplash();
 
    //  =======================================================================
    //  Func   DoLoop
    //  Desc   Launched the splash screen as a modal window. Not completely 
    //         implemented.
    //  Ret    int 
    //  =======================================================================
    int                DoLoop();
 
    //  =======================================================================
    //  Func   CloseSplash
    //  Desc   Closes the splash screen started with ShowSplash
    //  Ret    int 
    //  =======================================================================
    int                CloseSplash();
 
    //  =======================================================================
    //  Func   SetBitmap
    //  Desc   Call this with the path of the bitmap. Not required to be used
    //         when the construcutor with the image path has been used.
    //  Ret    1 if succesfull
    //  Arg    Either the file path or the handle to an already loaded bitmap
    //  =======================================================================
    DWORD            SetBitmap(UINT uBitmap);
    DWORD            SetBitmap(HBITMAP hBitmap);
 
    //  =======================================================================
    //  Func   SetTransparentColor
    //  Desc   This is used to make one of the color transparent
    //  Ret    1 if succesfull
    //  Arg    The colors RGB value. Not required if the color is specified 
    //         using the constructor
    //  =======================================================================
    bool            SetTransparentColor(COLORREF col);
 
    LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
    HWND            m_hwnd;
 
    void            SetText(CString strText,COLORREF color);
 
    void            ClearText();
 
private:
    void            Init();
    void            OnPaint(HWND hwnd);
    bool            MakeTransparent();
    HWND            RegAndCreateWindow();    
    void            FreeResources();
 
    COLORREF        m_colTrans;
    DWORD            m_dwWidth;
    DWORD            m_dwHeight;
    HBITMAP            m_hBitmap;
    LPCTSTR            m_lpszClassName;        
    UINT            m_uBitmap;
 
    SPLASH_ARRAY    m_TXTArr[MAX_SPLASH_SIZE];
    LONG            m_TXTCount;
};
 
 
#endif //_ABHI_SPLASH_H_