⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splash.h

📁 我们学校牛人开发的选课外挂源代码
💻 H
字号:
/*****************************************************************************
*                                                                            *
* HPALETTE CreateSpectrumPalette()                                           *
*                                                                            *
* Parameter:                                                                 *
*                                                                            *
* (none)                                                                     *
*                                                                            *
* Return Value:                                                              *
*                                                                            *
* HPALETTE         - Returns a handle to a spectrum palette or NULL if it    *
*                    fails.                                                  *
*                                                                            *
* Description:                                                               *
*                                                                            *
* This function will build a palette with a spectrum of colors.  It is       *
* useful when you want to display a number of DIBs each with a different     *
* palette yet still have an a good selection of colors for the DIBs to map   *
* to.                                                                        *
*                                                                            *
*****************************************************************************/

/*HPALETTE CreateSpectrumPalette() 
{                 
    HPALETTE hPal;
    LPLOGPALETTE lplgPal;
    BYTE red, green, blue;
    int i; 
    
    lplgPal = (LPLOGPALETTE)GlobalAlloc(GPTR, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * MAXPALETTE); 
    if (!lplgPal)
        return NULL;
    
    lplgPal->palVersion = PALVERSION;
    lplgPal->palNumEntries = MAXPALETTE;
    
    red = green = blue = 0;
    for (i = 0; i < MAXPALETTE; i++) {
        lplgPal->palPalEntry[i].peRed   = red;
        lplgPal->palPalEntry[i].peGreen = green;
        lplgPal->palPalEntry[i].peBlue  = blue;
        lplgPal->palPalEntry[i].peFlags = (BYTE)0;
        
        if (!(red += 32))
            if (!(green += 32))
                blue += 64;
    }
    
    hPal = CreatePalette(lplgPal);
    GlobalFree(lplgPal);
    
    return hPal;
}
*/
/*****************************************************************************
*                                                                            *
* HPALETTE CreatePaletteFromRGBQUAD(LPRGBQUAD rgbqPalette, WORD wEntries)    *
*                                                                            *
* Parameter:                                                                 *
*                                                                            *
* LPRGBQUAD        - pointer to RGBQUADs                                     *
* WORD             - the number of RGBQUADs we are pointing to               *
*                                                                            *
* Return Value:                                                              *
*                                                                            *
* HPALETTE         - returns a handle to a palette or NULL if it failes      *
*                                                                            *
* Description:                                                               *
*                                                                            *
* This function will build a valid HPALETTE when given an array of RGBQUADs  *
*                                                                            *
*****************************************************************************/
/*HPALETTE CreatePaletteFromRGBQUAD(LPRGBQUAD rgbqPalette, WORD wEntries)
{ 
    HPALETTE hPal;
    LPLOGPALETTE lplgPal;
    int i;
    
    lplgPal = (LPLOGPALETTE)GlobalAlloc(GPTR, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * wEntries); 
    if (!lplgPal)
        return NULL;
    
    lplgPal->palVersion = PALVERSION;
    lplgPal->palNumEntries = wEntries;
    
    for (i=0; i<wEntries; i++) {
        lplgPal->palPalEntry[i].peRed   = rgbqPalette[i].rgbRed;
        lplgPal->palPalEntry[i].peGreen = rgbqPalette[i].rgbGreen;
        lplgPal->palPalEntry[i].peBlue  = rgbqPalette[i].rgbBlue;
        lplgPal->palPalEntry[i].peFlags = 0;
    }
    
    hPal = CreatePalette(lplgPal);
    GlobalFree(lplgPal);
    
    return hPal;
}

*/
/*****************************************************************************
*                                                                            *
* void ShowBitmap(HWND hWnd, DWORD dwResId)                                  *
*                                                                            *
* Parameter:                                                                 *
*                                                                            *
* HWND             - handle of the target window                             *
* DWORD            - the ID of the resource bitmap to display                *
*                                                                            *
* Description:                                                               *
*                                                                            *
* This function loads and displays a resource bitmap into a specified window *
*                                                                            *
*****************************************************************************/
void _ShowBitmap(HWND hWnd, DWORD dwResId, HDC hdcWindow)
{  
    HBITMAP  hBitmap;
//   HPALETTE hPalette;
    HDC      hdcMemory;
    BITMAP   bm;
    RECT     rect;
//    RGBQUAD  rgbq[256];
    
    // Get the extents of our window
    GetClientRect(hWnd, &rect);
    
    // Load the resource as a DIB section
    hBitmap = (HBITMAP)LoadImage(hInst, 
        MAKEINTRESOURCE(dwResId), 
        IMAGE_BITMAP,
        0,0,
        LR_CREATEDIBSECTION);
    GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
    
    // Create a DC to hold our surface and selct our surface into it
    hdcMemory = CreateCompatibleDC(hdcWindow);
    SelectObject(hdcMemory, hBitmap);
    
    // Retrieve the color table (if there is one) and create a palette
    // that reflects it
/*    if (GetDIBColorTable(hdcMemory, 0, 256, rgbq))
        hPalette = CreatePaletteFromRGBQUAD(rgbq, 256);
    else
        hPalette = CreateSpectrumPalette();
    
    // Select and realize the palette into our window DC
    SelectPalette(hdcWindow,hPalette,FALSE);
    RealizePalette(hdcWindow);*/

/*	BLENDFUNCTION   bf;   
	bf.BlendOp   =   AC_SRC_OVER;   
	bf.BlendFlags   =   0;   
	bf.AlphaFormat   =   0;   
	bf.SourceConstantAlpha   =   Alpha; 
	

	AlphaBlend(hdcWindow,0,0,rect.right,rect.bottom,hdcMemory, 0, 0, bm.bmWidth, bm.bmHeight,bf);*/
    
    // Display the bitmap
//	SetStretchBltMode(hdcWindow, COLORONCOLOR);
    //StretchBlt(hdcWindow, 0, 0, rect.right, rect.bottom,hdcMemory, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
	BitBlt(hdcWindow, 0, 0, rect.right, rect.bottom,hdcMemory, 0, 0, SRCCOPY);
	
    
	// Clean up our objects
    DeleteDC(hdcMemory);
    DeleteObject(hBitmap);
    ReleaseDC(hWnd, hdcWindow);
//    DeleteObject(hPalette);
}


LRESULT CALLBACK WndProcSplash(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
//	static char Alpha;
    
    switch (message) {
    case WM_CREATE:
//		Alpha=0;
        // Set the timer for the specified number of ms
//        SetTimer(hWnd, 1, 15, NULL);  
		SetTimer(hWnd, 2, 5000, NULL);
        break;
    
	// Handle the palette messages in case 
	// another app takes over the palette
/*    case WM_PALETTECHANGED:
        if ((HWND) wParam == hWnd)
            return 0;
    case WM_QUERYNEWPALETTE:
        InvalidateRect(hWnd, NULL, FALSE);
		UpdateWindow(hWnd);
		return TRUE;*/
        
    // Destroy the window if... 
    case WM_LBUTTONDOWN:      // ...the user pressed the left mouse button
    case WM_RBUTTONDOWN:      // ...the user pressed the right mouse button
        DestroyWindow(hWnd);  // Close the window
        break;
    
	case WM_TIMER:            // ...the timer timed out
		switch(wParam)
		{
//		case 1:
//			Alpha++;
//			PostMessage(hWnd,WM_PRINT,0,0);
//			break;
		case 2:
			DestroyWindow(hWnd);
			break;
		}
		break;   
	
	// Draw the window
/*	case WM_PAINT:
		hdc = BeginPaint (hWnd, &ps);
        _ShowBitmap(hWnd, IDB_SPLASH, hdc);
        EndPaint (hWnd, &ps);
		break;*/
	case WM_PRINT:
		if (!(lParam & PRF_CLIENT)) 
			return (DefWindowProc(hWnd, message, wParam, lParam));
        _ShowBitmap(hWnd, IDB_SPLASH, (HDC)wParam);
        break;
        
    default:
        return (DefWindowProc(hWnd, message, wParam, lParam));
    }
    return (0);
}


void _SplashWindow()
{

	RECT rect;
	HBITMAP hbm;
	BITMAP bm;
	WNDCLASS wc = {0};

	// Load the bitmap and fill out a BITMAP structure for it
	hbm = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SPLASH));
	GetObject(hbm, sizeof(bm), &bm);
	DeleteObject(hbm);

	// Get the extents of the desktop window
	GetWindowRect(GetDesktopWindow(), &rect);
  
    // Fill in window class structure with parameters that describe
    // the main window.
    wc.style         = 0;
    wc.lpfnWndProc   = (WNDPROC)WndProcSplash;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInst;
    wc.hIcon         = 0;
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH);
    wc.lpszClassName = _T("YBJJ-SPLASH");
    
    // Register the window class and return success/failure code.
    RegisterClass(&wc);

	// Create a centered window the size of our bitmap
	hSplash = CreateWindowEx(WS_EX_TOOLWINDOW,_T("YBJJ-SPLASH"), NULL, WS_POPUP ,
                       (rect.right  / 2) - (bm.bmWidth  / 2),
                       (rect.bottom / 2) - (bm.bmHeight / 2),
                       bm.bmWidth,
                       bm.bmHeight,
                       NULL, NULL, hInst, NULL);
	
	if (!hSplash) return;
	
	SetWindowPos(hSplash, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
	
	//ShowWindow(hSplash, SW_SHOW);
	AnimateWindow(hSplash,500,AW_BLEND);
	UpdateWindow(hSplash);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -