亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? icons.c

?? ICon文件格式
?? C
?? 第 1 頁 / 共 4 頁
字號:
/****************************************************************************\
*            
*     FILE:     ICONS.C
*
*     PURPOSE:  IconPro Project Icon handing Code C file
*
*     COMMENTS: This file contains the icon handling code
*
*     FUNCTIONS:
*      EXPORTS: 
*               ReadIconFromICOFile        - Reads Icon from ICO file
*               WriteIconToICOFile         - Writes Icon to ICO file
*               MakeIconFromResource       - Makes HICON from a resource
*               ReadIconFromEXEFile        - Reads Icon from a EXE or DLL file
*               IconImageToClipBoard       - Puts icon image on clipboard
*               IconImageFromClipBoard     - Gets icon image from clipboard
*               CreateBlankNewFormatIcon   - Makes a new, blank icon image
*               DrawXORMask                - Draws XOR mask using DIBs
*               DrawANDMask                - Draws AND mask using DIBs
*               GetXORImageRect            - Calculates XOR image position
*               MakeNewANDMaskBasedOnPoint - Calculates new AND mask
*               ConvertBMPFileToIcon       - Converts BMP to Icon
*               IconImageToBMPFile         - Writes an icon image to BMP file
*      LOCALS:
*               ReadICOHeader              - Reads ICO file header
*               AdjustIconImagePointers    - Adjusts internal pointers
*               ExtractDlgProc             - Dlg Proc for extract dialog
*               MyEnumProcedure            - For EnumResourceNames()
*               GetIconFromInstance        - Extracts Icon from Instance
*               ChooseIconFromEXEFile      - Gets a user's choice icon from file
*               WriteICOHeader             - Writes ICO file header
*               CalculateImageOffset       - Calcs offset in file of image
*               DIBToIconImage             - Converts DIB to icon image
*
*     Copyright 1995 Microsoft Corp.
*
*
* History:
*                July '95 - Created
*
\****************************************************************************/
#include <Windows.h>
#include "Resource.h"
#include "IconPro.h"
#include "Icons.H"
#include "Dib.H"


/****************************************************************************/
// Structs used locally (file scope)
// Resource Position info - size and offset of a resource in a file
typedef struct
{
    DWORD	dwBytes;
    DWORD	dwOffset;
} RESOURCEPOSINFO, *LPRESOURCEPOSINFO;
// EXE/DLL icon information - filename, instance handle and ID
typedef struct
{
    LPCTSTR    	szFileName;
    HINSTANCE	hInstance;
    LPTSTR    	lpID;
} EXEDLLICONINFO, *LPEXEDLLICONINFO;
/****************************************************************************/


/****************************************************************************/
// External Globals
extern HINSTANCE    hInst;
extern HWND        	hWndMain;
/****************************************************************************/

/****************************************************************************/
// Prototypes for local functions
UINT ReadICOHeader( HANDLE hFile );
BOOL AdjustIconImagePointers( LPICONIMAGE lpImage );
BOOL CALLBACK ExtractDlgProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
BOOL CALLBACK MyEnumProcedure( HANDLE  hModule, LPCTSTR  lpszType, LPTSTR  lpszName, LONG  lParam );
HICON GetIconFromInstance( HINSTANCE hInstance, LPTSTR nIndex );
LPTSTR ChooseIconFromEXEFile( LPEXEDLLICONINFO lpEDII );
BOOL WriteICOHeader( HANDLE hFile, UINT nNumEntries );
DWORD CalculateImageOffset( LPICONRESOURCE lpIR, UINT nIndex );
BOOL DIBToIconImage( LPICONIMAGE lpii, LPBYTE lpDIB, BOOL bStretch );
/****************************************************************************/



/****************************************************************************
*
*     FUNCTION: MakeIconFromResource
*
*     PURPOSE:  Makes an HICON from an icon resource
*
*     PARAMS:   LPICONIMAGE	lpIcon - pointer to the icon resource
*
*     RETURNS:  HICON - handle to the new icon, NULL for failure
*
* History:
*                July '95 - Created
*
\****************************************************************************/
HICON MakeIconFromResource( LPICONIMAGE lpIcon )
{
    HICON        	hIcon = NULL;

    // Sanity Check
    if( lpIcon == NULL )
        return NULL;
    if( lpIcon->lpBits == NULL )
        return NULL;
    // Let the OS do the real work :)
    hIcon = CreateIconFromResourceEx( lpIcon->lpBits, lpIcon->dwNumBytes, TRUE, 0x00030000, 
            (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biWidth, (*(LPBITMAPINFOHEADER)(lpIcon->lpBits)).biHeight/2, 0 );
    
    // It failed, odds are good we're on NT so try the non-Ex way
    if( hIcon == NULL )
    {
        // We would break on NT if we try with a 16bpp image
        if(lpIcon->lpbi->bmiHeader.biBitCount != 16)
        {	
            hIcon = CreateIconFromResource( lpIcon->lpBits, lpIcon->dwNumBytes, TRUE, 0x00030000 );
        }
    }
    return hIcon;
}
/* End MakeIconFromResource() **********************************************/





/****************************************************************************
*
*     FUNCTION: ReadIconFromICOFile
*
*     PURPOSE:  Reads an Icon Resource from an ICO file
*
*     PARAMS:   LPCTSTR szFileName - Name of the ICO file
*
*     RETURNS:  LPICONRESOURCE - pointer to the resource, NULL for failure
*
* History:
*                July '95 - Created
*
\****************************************************************************/
LPICONRESOURCE ReadIconFromICOFile( LPCTSTR szFileName )
{
    LPICONRESOURCE    	lpIR = NULL, lpNew = NULL;
    HANDLE            	hFile = NULL;
    LPRESOURCEPOSINFO	lpRPI = NULL;
    UINT                i;
    DWORD            	dwBytesRead;
    LPICONDIRENTRY    	lpIDE = NULL;


    // Open the file
    if( (hFile = CreateFile( szFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL )) == INVALID_HANDLE_VALUE )
    {
        MessageBox( hWndMain, "Error Opening File for Reading", szFileName, MB_OK );
        return NULL;
    }
    // Allocate memory for the resource structure
    if( (lpIR = malloc( sizeof(ICONRESOURCE) )) == NULL )
    {
        MessageBox( hWndMain, "Error Allocating Memory", szFileName, MB_OK );
        CloseHandle( hFile );
        return NULL;
    }
    // Read in the header
    if( (lpIR->nNumImages = ReadICOHeader( hFile )) == (UINT)-1 )
    {
        MessageBox( hWndMain, "Error Reading File Header", szFileName, MB_OK );
        CloseHandle( hFile );
        free( lpIR );
        return NULL;
    }
    // Adjust the size of the struct to account for the images
    if( (lpNew = realloc( lpIR, sizeof(ICONRESOURCE) + ((lpIR->nNumImages-1) * sizeof(ICONIMAGE)) )) == NULL )
    {
        MessageBox( hWndMain, "Error Allocating Memory", szFileName, MB_OK );
        CloseHandle( hFile );
        free( lpIR );
        return NULL;
    }
    lpIR = lpNew;
    // Store the original name
    lstrcpy( lpIR->szOriginalICOFileName, szFileName );
    lstrcpy( lpIR->szOriginalDLLFileName, "" );
    // Allocate enough memory for the icon directory entries
    if( (lpIDE = malloc( lpIR->nNumImages * sizeof( ICONDIRENTRY ) ) ) == NULL )
    {
        MessageBox( hWndMain, "Error Allocating Memory", szFileName, MB_OK );
        CloseHandle( hFile );
        free( lpIR );
        return NULL;
    }
    // Read in the icon directory entries
    if( ! ReadFile( hFile, lpIDE, lpIR->nNumImages * sizeof( ICONDIRENTRY ), &dwBytesRead, NULL ) )
    {
        MessageBox( hWndMain, "Error Reading File", szFileName, MB_OK );
        CloseHandle( hFile );
        free( lpIR );
        return NULL;
    }
    if( dwBytesRead != lpIR->nNumImages * sizeof( ICONDIRENTRY ) )
    {
        MessageBox( hWndMain, "Error Reading File", szFileName, MB_OK );
        CloseHandle( hFile );
        free( lpIR );
        return NULL;
    }
    // Loop through and read in each image
    for( i = 0; i < lpIR->nNumImages; i++ )
    {
        // Allocate memory for the resource
        if( (lpIR->IconImages[i].lpBits = malloc(lpIDE[i].dwBytesInRes)) == NULL )
        {
            MessageBox( hWndMain, "Error Allocating Memory", szFileName, MB_OK );
            CloseHandle( hFile );
            free( lpIR );
            free( lpIDE );
            return NULL;
        }
        lpIR->IconImages[i].dwNumBytes = lpIDE[i].dwBytesInRes;
        // Seek to beginning of this image
        if( SetFilePointer( hFile, lpIDE[i].dwImageOffset, NULL, FILE_BEGIN ) == 0xFFFFFFFF )
        {
            MessageBox( hWndMain, "Error Seeking in File", szFileName, MB_OK );
            CloseHandle( hFile );
            free( lpIR );
            free( lpIDE );
            return NULL;
        }
        // Read it in
        if( ! ReadFile( hFile, lpIR->IconImages[i].lpBits, lpIDE[i].dwBytesInRes, &dwBytesRead, NULL ) )
        {
            MessageBox( hWndMain, "Error Reading File", szFileName, MB_OK );
            CloseHandle( hFile );
            free( lpIR );
            free( lpIDE );
            return NULL;
        }
        if( dwBytesRead != lpIDE[i].dwBytesInRes )
        {
            MessageBox( hWndMain, "Error Reading File", szFileName, MB_OK );
            CloseHandle( hFile );
            free( lpIDE );
            free( lpIR );
            return NULL;
        }
        // Set the internal pointers appropriately
        if( ! AdjustIconImagePointers( &(lpIR->IconImages[i]) ) )
        {
            MessageBox( hWndMain, "Error Converting to Internal Format", szFileName, MB_OK );
            CloseHandle( hFile );
            free( lpIDE );
            free( lpIR );
            return NULL;
        }
    }
    // Clean up	
    free( lpIDE );
    free( lpRPI );
    CloseHandle( hFile );
    return lpIR;
}
/* End ReadIconFromICOFile() **********************************************/




/****************************************************************************
*
*     FUNCTION: AdjustIconImagePointers
*
*     PURPOSE:  Adjusts internal pointers in icon resource struct
*
*     PARAMS:   LPICONIMAGE lpImage - the resource to handle
*
*     RETURNS:  BOOL - TRUE for success, FALSE for failure
*
* History:
*                July '95 - Created
*
\****************************************************************************/
BOOL AdjustIconImagePointers( LPICONIMAGE lpImage )
{
    // Sanity check
    if( lpImage==NULL )
        return FALSE;
    // BITMAPINFO is at beginning of bits
    lpImage->lpbi = (LPBITMAPINFO)lpImage->lpBits;
    // Width - simple enough
    lpImage->Width = lpImage->lpbi->bmiHeader.biWidth;
    // Icons are stored in funky format where height is doubled - account for it
    lpImage->Height = (lpImage->lpbi->bmiHeader.biHeight)/2;
    // How many colors?
    lpImage->Colors = lpImage->lpbi->bmiHeader.biPlanes * lpImage->lpbi->bmiHeader.biBitCount;
    // XOR bits follow the header and color table
    lpImage->lpXOR = FindDIBBits((LPSTR)lpImage->lpbi);
    // AND bits follow the XOR bits
    lpImage->lpAND = lpImage->lpXOR + (lpImage->Height*BytesPerLine((LPBITMAPINFOHEADER)(lpImage->lpbi)));
    return TRUE;
}
/* End AdjustIconImagePointers() *******************************************/




/****************************************************************************
*
*     FUNCTION: ReadICOHeader
*
*     PURPOSE:  Reads the header from an ICO file
*
*     PARAMS:   HANDLE hFile - handle to the file
*
*     RETURNS:  UINT - Number of images in file, -1 for failure
*
* History:
*                July '95 - Created
*
\****************************************************************************/
UINT ReadICOHeader( HANDLE hFile )
{
    WORD    Input;
    DWORD	dwBytesRead;

    // Read the 'reserved' WORD
    if( ! ReadFile( hFile, &Input, sizeof( WORD ), &dwBytesRead, NULL ) )
        return (UINT)-1;
    // Did we get a WORD?
    if( dwBytesRead != sizeof( WORD ) )
        return (UINT)-1;
    // Was it 'reserved' ?   (ie 0)
    if( Input != 0 )
        return (UINT)-1;
    // Read the type WORD
    if( ! ReadFile( hFile, &Input, sizeof( WORD ), &dwBytesRead, NULL ) )
        return (UINT)-1;
    // Did we get a WORD?
    if( dwBytesRead != sizeof( WORD ) )
        return (UINT)-1;
    // Was it type 1?
    if( Input != 1 )
        return (UINT)-1;
    // Get the count of images
    if( ! ReadFile( hFile, &Input, sizeof( WORD ), &dwBytesRead, NULL ) )
        return (UINT)-1;
    // Did we get a WORD?
    if( dwBytesRead != sizeof( WORD ) )
        return (UINT)-1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91一区二区三区在线观看| 日本不卡在线视频| 一区二区三区在线观看视频| 婷婷成人综合网| 91行情网站电视在线观看高清版| 欧美日韩国产中文| 中文字幕日韩一区| 精品一区二区在线看| 色噜噜狠狠一区二区三区果冻| 久久嫩草精品久久久精品| 日韩一区精品视频| 在线观看www91| 亚洲国产精品ⅴa在线观看| 男女男精品网站| 欧美三级日韩三级| 亚洲激情图片qvod| av男人天堂一区| 国产亚洲va综合人人澡精品| 久久精品国产一区二区三 | 91福利国产成人精品照片| 久久精品人人做人人爽人人| 日本不卡一二三| 在线成人av网站| 亚洲第一福利一区| 91蝌蚪porny| 日韩理论片在线| 99精品一区二区三区| 26uuu色噜噜精品一区| 五月婷婷综合激情| 欧美人妇做爰xxxⅹ性高电影| 一区二区三区四区国产精品| 99久久精品久久久久久清纯| 国产精品久久久99| 91.麻豆视频| 一区二区三区中文在线观看| 91在线免费看| 亚洲午夜三级在线| 欧美日韩不卡一区| 美国欧美日韩国产在线播放| 日韩精品中文字幕在线不卡尤物 | 国产成人免费视频| 国产精品免费人成网站| 99久久er热在这里只有精品66| 国产精品国产自产拍高清av王其| 成人性视频网站| 亚洲欧美另类久久久精品2019| 色爱区综合激月婷婷| 亚洲高清不卡在线观看| 欧美精品一级二级| 久久精品99国产精品| 欧美激情一区二区在线| 91丝袜高跟美女视频| 一区二区国产视频| 欧美一级免费观看| 国产999精品久久| **欧美大码日韩| 欧美日韩综合在线| 久久99精品国产麻豆不卡| 精品久久国产老人久久综合| 成人中文字幕在线| 一区二区高清视频在线观看| 91麻豆精品国产91久久久使用方法| 精品一区二区三区香蕉蜜桃 | 日韩精品资源二区在线| 国产成人精品一区二区三区四区| 最新日韩在线视频| 欧美一级精品大片| av成人动漫在线观看| 毛片av一区二区三区| 国产精品国产a| 欧美一区二区三区视频免费| 不卡的电视剧免费网站有什么| 亚洲综合久久久久| 国产欧美日韩三级| 欧美一级高清片| 99vv1com这只有精品| 久久精品国产一区二区三| 亚洲欧美激情一区二区| 日韩欧美一区在线观看| 色哟哟精品一区| 国产成人在线免费| 日韩激情视频网站| 亚洲欧美成aⅴ人在线观看| 精品免费国产二区三区| 欧美性做爰猛烈叫床潮| 成人免费看片app下载| 日本成人在线网站| 亚洲精品美国一| 国产欧美日韩视频一区二区| 日韩一级成人av| 精品少妇一区二区三区免费观看| 91女厕偷拍女厕偷拍高清| 久久精品国产在热久久| 天天亚洲美女在线视频| 亚洲精选视频在线| 久久久激情视频| 日韩视频不卡中文| 欧美日韩中文字幕精品| 9l国产精品久久久久麻豆| 国产一区二区三区四区五区入口| 午夜精品一区二区三区免费视频 | 一区二区三区四区高清精品免费观看 | 丁香一区二区三区| 麻豆91免费观看| 亚洲成人av一区| 亚洲一区免费视频| 日韩码欧中文字| 国产精品天干天干在线综合| 久久久综合九色合综国产精品| 91麻豆精品国产91久久久资源速度| 在线观看视频一区二区欧美日韩 | 青青国产91久久久久久| 天堂成人国产精品一区| 亚洲成av人在线观看| 亚洲美女淫视频| 亚洲美女视频在线观看| 亚洲精品高清在线| 亚洲日本在线a| 尤物视频一区二区| 亚洲精品亚洲人成人网| 一区二区三区四区中文字幕| 一区二区三区精品| 午夜精品久久久久久| 五月天亚洲婷婷| 蜜桃久久久久久久| 精品一区精品二区高清| 国产成人啪午夜精品网站男同| 国产在线不卡一区| 国产成人av一区二区三区在线| 国产在线精品视频| 成人福利在线看| 91在线小视频| 91精品国产乱| 国产亚洲一区字幕| 亚洲三级电影网站| 亚洲国产精品视频| 久久成人久久爱| 成人免费av资源| 欧美私人免费视频| 日韩三级在线免费观看| 国产欧美精品区一区二区三区 | 欧美在线制服丝袜| 69堂亚洲精品首页| 久久免费电影网| 亚洲欧美自拍偷拍| 爽爽淫人综合网网站| 国产一区999| 色哟哟国产精品免费观看| 日韩一级黄色片| 日日骚欧美日韩| 国产精品一区二区久久不卡 | 日韩一级二级三级| 国产精品国产a| 爽爽淫人综合网网站| 国产宾馆实践打屁股91| 欧美在线免费观看亚洲| 久久一夜天堂av一区二区三区| 亚洲欧洲性图库| 久久精品国产精品亚洲精品| 99国产精品一区| 精品少妇一区二区三区在线视频| 亚洲特级片在线| 国产一区在线不卡| 欧美性受极品xxxx喷水| 久久久久青草大香线综合精品| 亚洲精品自拍动漫在线| 卡一卡二国产精品| 欧美日韩在线直播| 亚洲欧洲一区二区在线播放| 免费欧美在线视频| 欧美日韩一级黄| 成人免费一区二区三区视频 | 色一情一乱一乱一91av| 精品国产伦一区二区三区观看体验| 一区二区三区.www| 成人av网站免费观看| 日韩欧美一级精品久久| 亚洲已满18点击进入久久| 高清不卡一区二区在线| 欧美v国产在线一区二区三区| 一区二区三区不卡视频在线观看 | 91精品国产麻豆国产自产在线 | 亚洲精品v日韩精品| 丁香五精品蜜臀久久久久99网站 | 欧美一区二区观看视频| 一区二区在线观看不卡| 成人福利视频在线| 国产欧美日韩亚州综合| 国产一区二区三区精品视频| 日韩一级欧美一级| 青娱乐精品在线视频| 9191成人精品久久| 婷婷中文字幕一区三区| 欧美日韩电影在线| 亚洲国产一区二区在线播放| 一本久久综合亚洲鲁鲁五月天| 国产精品久久久久久久久免费丝袜 | 国产精品传媒入口麻豆| 成人精品视频一区二区三区| 日本一区二区三区国色天香|