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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? viewerlib.cpp

?? 圖像顯示軟件源碼
?? CPP
?? 第 1 頁 / 共 4 頁
字號(hào):
/****************************************************************************
ViewerLib.cpp : Defines the Image Viewer DLL application.
written by PJ Arends
pja@telus.net

For updates check http://www.codeproject.com/tools/imageviewer.asp

-----------------------------------------------------------------------------
This code is provided as is, with no warranty as to it's suitability or usefulness
in any application in which it may be used.

This code may be used in any way you desire. This file may be redistributed by any
means as long as it is not sold for profit, and providing that this notice and the
author's name are included. Any modifications not made by the original author should
be clearly marked as such to remove any confusion between the original version and
any other versions.

If any bugs are found and fixed, a note to the author explaining the problem and
fix would be nice.
-----------------------------------------------------------------------------
****************************************************************************/

#define _WIN32_WINNT 0x0501     // Windows XP
#define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <commctrl.h>           // for HIMAGELIST
#include <tchar.h>
#include <sstream>
#include <string>
#include <iomanip>
#include <atlbase.h>            // for CA2W string conversion function and ATLTRACE macro
#include <sys\timeb.h>
#include <math.h>
#include "resource.h"
#include "..\common files\pja_dc.h"
#include "..\common files\pja_bitmap.h"
#include "..\common files\pja_format.h"
#include "..\common files\tstl.h"

#include "IVDllWindow.h"
CIVDllWindow Window;

HMODULE DllModule = NULL;

/////////////////////////////////////////////////////////////////////////////
//
//  DllMain
//    The dll's entry point
//
//  Parameters :
//    None
//
//  Returns :
//    TRUE
//
/////////////////////////////////////////////////////////////////////////////

BOOL APIENTRY DllMain(HMODULE hModule, DWORD, LPVOID)
{
    DllModule = hModule;
    return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
//
//  CurrentTime
//    Retrieves the current system time
//
//  Parameters :
//    None
//
//  Returns :
//    A wide string containing the current system time
//
/////////////////////////////////////////////////////////////////////////////

std::wstring CurrentTime()
{
    _timeb TimeB;
    _ftime_s(&TimeB);

    std::wstring String = _wctime(&TimeB.time);

    std::wostringstream str;
    str << String.substr(0, 10) << L',' << String.substr(19, 5);
    str << String.substr(10, 9) << L'.' << std::setw(3) << std::setfill(L'0') << TimeB.millitm << std::ends;

    return str.str().c_str();
}

/////////////////////////////////////////////////////////////////////////////
//
//  class BGBrush
//    This class is used to retrieve a HBRUSH that is the same colour as that saved
//    as the background colour by the user of the Image Viewer utility.
//
/////////////////////////////////////////////////////////////////////////////

class BGBrush
{
    HBRUSH m_Brush;
    COLORREF m_Colour;

public:
    BGBrush()
    {
        // default brush colour
        m_Colour = RGB(192, 192, 192);

        HKEY hKey = NULL;
        if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER,
                                          _T("Software\\PJ Arends\\Image Viewer\\Settings"),
                                          0,
                                          KEY_READ,
                                          &hKey))
        {
            DWORD Size = sizeof(COLORREF);
            RegQueryValueEx(hKey,
                            _T("Background Colour"),
                            NULL,
                            NULL,
                            (LPBYTE)&m_Colour,
                            &Size);
            RegCloseKey(hKey);
        }
        m_Brush = CreateSolidBrush(m_Colour);
    }
    
    ~BGBrush()
    {
        DeleteObject(m_Brush);
    }

    operator HBRUSH()
    {
        return m_Brush;
    }

    operator COLORREF()
    {
        // returns the ideal text colour that will contrast with this brush
        // technique by John Simmons http://www.codeproject.com/useritems/IdealTextColor.asp
        int Grey = (GetRValue(m_Colour) * 299 + GetGValue(m_Colour) * 587 + GetBValue(m_Colour) * 114) / 1000;
        return Grey > 105 ? RGB(0, 0, 0) : RGB(255, 255, 255);
    }
};

/////////////////////////////////////////////////////////////////////////////
//
//  AreWindowsReady
//    Creates the dll's hidden window and checks if the app's hidden window
//    is also present. If these two windows are not present and properly
//    setup the dll will fail to show any output.
//
//  Parameters :
//    None
//
//  Returns :
//    true if the windows are properly setup
//    false if the windows are not setup
//
/////////////////////////////////////////////////////////////////////////////

bool AreWindowsReady()
{
    if (!Window.Create())
    {
        ATLTRACE(_T("ImageViewer.dll : ImageViewer dll window not created"));
        return false;
    }

    if (!IsWindow(Window))
    {
        ATLTRACE(_T("ImageViewer.dll : Image Viewer application not running\n"));
        return false;
    }

    return true;
}

/////////////////////////////////////////////////////////////////////////////
//
//  SendImageToViewer
//    Convert the supplied HBITMAP to a DIBSection, and pass it on
//    to the Image Viewer application.
//
//  Parameters :
//    TheBitmap   [in] - The bitmap to send
//    File        [in] - The complete path to the source file that called this function
//    Line        [in] - The line number in the source file from where the call was made
//    Function    [in] - The name of the function from where the call was made
//    Text        [in] - User defined text
//    pRegionRect [in] - For regions only, the region's bounding rectangle
//
//  Returns :
//    ERROR_SUCCESS if the image was sent to the viewer, a Win32 error code otherwise
//
//  Note :
//    The Image Viewer application has to be able to read the data that is sent to it.
//    If you change this function to either add data to, remove data from, or otherwise
//    alter it, then you will also have to change the CImageData class in the Viewer
//    Application project to reflect the changes made here. You may also have to change
//    the CRecieverWindow::OnCopyData() function.
//
/////////////////////////////////////////////////////////////////////////////

LRESULT SendImageToViewer (HBITMAP TheBitmap,
                           LPCWSTR File,
                           UINT Line,
                           LPCWSTR Function,
                           LPCWSTR Text,
                           LPCRECT pRegionRect)
{
    // Check that the windows are properly setup
    if (!AreWindowsReady())
    {
        return ERROR_NOT_READY;
    }

    // Validate the parameters
    if (!TheBitmap)
    {
        ATLTRACE(_T("ImageViewer.dll : SendImageToViewer - A NULL HBITMAP handle was passed in\n"));
        return ERROR_INVALID_HANDLE;
    }

    if (NULL == File)
    {
        File = _T("");
    }

    if (NULL == Function)
    {
        Function = _T("");
    }

    if (NULL == Text)
    {
        Text = _T("");
    }

    // Create the bitmap that gets displayed in the Image Viewer application
    // by making a copy of the supplied bitmap 'TheBitmap'
    pja::CBitmap Image(TheBitmap, true);
    if (NULL == Image)
    {
        ATLTRACE(_T("ImageViewer.dll : SendImageToViewer - Failed to copy the supplied image\n"));
        return ERROR_FUNCTION_FAILED;
    }

    // Create the memory dc needed to extract the bitmap's bits
    pja::CCompatibleDC ImageDC(NULL);
    if (NULL == ImageDC)
    {
        ATLTRACE(_T("ImageViewer.dll : SendImageToViewer - Failed to create the memory device context\n"));
        return ERROR_FUNCTION_FAILED;
    }

    SelectObject(ImageDC, Image);

    // Calculate the size of the memory needed for the data buffer
    size_t ColourTableSize = 0;
    if (Image.BitsPixel() < 16)
    {
        ColourTableSize = sizeof(RGBQUAD) * 256;
    }
    
    // size of the bitmaps bit table
    DWORD BitsSize = ((Image.Width() * Image.BitsPixel() + 31) & (~31)) / 8 * Image.Height();

    DWORD InfoSize = sizeof(BITMAPINFO);

    // Build the information string
    std::wostringstream stream;
    stream << File << std::endl;
    stream << Line << std::endl;
    stream << Function << std::endl;
    stream << CurrentTime() << std::endl;
    stream << Text << std::ends;
    size_t len = wcslen(stream.str().c_str()) + 1;
    
    // Create the data buffer that will be sent via the WM_COPYDATA message
    DWORD DataBufferSize = InfoSize + ColourTableSize + BitsSize + len * sizeof(wchar_t) + sizeof(DWORD) + sizeof(RECT);
    BYTE *DataBuffer = new BYTE[DataBufferSize];
    if (NULL == DataBuffer)
    {
        ATLTRACE(_T("ImageViewer.dll : SendImageToViewer - Failed to allocate memory for the data buffer\n"));
        return ERROR_FUNCTION_FAILED;
    }

    // Assume success for the rest of the operation
    LRESULT ReturnCode = ERROR_SUCCESS;

    // Fill the data buffer with data
    memset(DataBuffer, 0, DataBufferSize);
    BYTE *DataInsertionPointer = DataBuffer;

    // The ID of the current process goes into the data buffer first
    DWORD ProcessID = GetCurrentProcessId();
    *reinterpret_cast<DWORD *>(DataInsertionPointer) = ProcessID;

    // The region rectangle goes in second
    DataInsertionPointer += sizeof(DWORD);

    if (NULL != pRegionRect)
    {
        memcpy_s(DataInsertionPointer, sizeof(RECT), pRegionRect, sizeof(RECT));
    }
    else
    {
        memset(DataInsertionPointer, 0, sizeof(RECT));
    }

    DataInsertionPointer += sizeof(RECT);

    // The descriptive text goes into the data buffer third
    wcscpy_s(reinterpret_cast<wchar_t *>(DataInsertionPointer), len, stream.str().c_str());
    DataInsertionPointer += len * sizeof(wchar_t);

    // The BITMAPINFO structure goes into the DataBuffer fourth
    BITMAPINFO *pBitmapInfo = reinterpret_cast<BITMAPINFO *>(DataInsertionPointer);
    pBitmapInfo->bmiHeader.biSize          = sizeof(BITMAPINFOHEADER);
    pBitmapInfo->bmiHeader.biHeight        = Image.Height();
    pBitmapInfo->bmiHeader.biWidth         = Image.Width();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品精华液2区45| 美国精品在线观看| 日韩激情一区二区| 国内久久婷婷综合| 色诱亚洲精品久久久久久| 欧美日韩成人综合| 欧美经典一区二区| 亚洲一区二区三区四区在线| 韩国成人精品a∨在线观看| 91美女精品福利| 精品国产精品一区二区夜夜嗨| 国产精品理论片在线观看| 午夜婷婷国产麻豆精品| 国产精品白丝jk白祙喷水网站 | 久久亚区不卡日本| 亚洲色图一区二区三区| 久久精品99国产精品| 国产欧美一区二区精品久导航| 国产精品1区二区.| 色94色欧美sute亚洲线路一ni| 日韩一区二区三区免费观看| 亚洲色欲色欲www| 久草这里只有精品视频| 91国产丝袜在线播放| 久久久久久久久一| 午夜精品久久久久久久久久| 成人免费毛片嘿嘿连载视频| 8x8x8国产精品| 亚洲色图第一区| 国产一区二区三区免费在线观看| 91久久精品网| 欧美国产一区视频在线观看| 蜜臀a∨国产成人精品| 色久综合一二码| 国产日韩欧美a| 久久国产福利国产秒拍| 欧美午夜精品理论片a级按摩| 国产精品麻豆欧美日韩ww| 青青草视频一区| 91黄色免费看| 国产精品国产三级国产普通话99| 久久av资源网| 欧美人成免费网站| 国产精品美日韩| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美高清一级片在线| 中文字幕中文在线不卡住| 精品一区中文字幕| 91麻豆精品国产自产在线观看一区 | 久久国产三级精品| 91.com在线观看| 亚洲综合小说图片| 色诱亚洲精品久久久久久| 国产精品久久免费看| 国产高清视频一区| 精品国产乱码久久久久久牛牛| 日本伊人色综合网| 欧美日韩高清一区二区| 亚洲国产精品一区二区尤物区| 91丨porny丨最新| 国产精品乱码妇女bbbb| 成人亚洲一区二区一| 欧美激情综合在线| 成人精品一区二区三区中文字幕| 国产日韩成人精品| 国产成人av影院| 国产欧美日韩在线看| 国产一区二区在线影院| 国产亚洲精品7777| 国产jizzjizz一区二区| 国产精品少妇自拍| 不卡的看片网站| 国产精品久久久久久久第一福利| 成人高清av在线| 亚洲欧洲制服丝袜| 欧美午夜电影一区| 日本成人中文字幕在线视频| 777午夜精品免费视频| 一区二区三区在线免费观看| 在线视频欧美精品| 亚洲成av人综合在线观看| 欧美久久高跟鞋激| 免费在线观看一区| 久久夜色精品国产噜噜av| 国产a视频精品免费观看| 国产精品国产成人国产三级| 91美女片黄在线| 午夜精品一区在线观看| 91麻豆精品国产91久久久资源速度| 免费成人在线观看| 国产日韩欧美一区二区三区乱码 | 亚洲一区二区在线播放相泽 | 久久成人18免费观看| 精品国产电影一区二区| 丁香网亚洲国际| 亚洲综合另类小说| 欧美一区二区三区免费| 国内成+人亚洲+欧美+综合在线| 国产欧美一区二区三区在线老狼| 91麻豆国产福利在线观看| 日日欢夜夜爽一区| 欧美大片免费久久精品三p| 国产精品996| 伊人色综合久久天天| 91精品国产日韩91久久久久久| 国产真实乱子伦精品视频| 日韩理论片在线| 91精品黄色片免费大全| 国产精品18久久久久久久久久久久| 综合自拍亚洲综合图不卡区| 欧美美女一区二区三区| 国内精品国产三级国产a久久| 中文字幕在线不卡视频| 欧美日韩一区二区在线观看| 国产老妇另类xxxxx| 亚洲免费视频中文字幕| 欧美大黄免费观看| 不卡大黄网站免费看| 手机精品视频在线观看| 国产欧美一区二区精品性| 欧美日韩激情一区| 国产成人av电影在线| 亚洲成人你懂的| 国产欧美一二三区| 这里只有精品电影| 99麻豆久久久国产精品免费优播| 日韩精品一卡二卡三卡四卡无卡| 欧美国产精品v| 日韩视频免费观看高清在线视频| 99久久久久久99| 精品一区二区久久| 亚洲一卡二卡三卡四卡无卡久久| 亚洲精品在线三区| 欧美三级韩国三级日本三斤| 国产99久久久国产精品免费看| 亚洲综合丁香婷婷六月香| 国产欧美一区二区精品婷婷| 日韩一区二区三区免费看| 色婷婷精品大在线视频| 国产成人免费视频网站| 美国精品在线观看| 亚洲五月六月丁香激情| 国产精品视频观看| 亚洲精品一区二区三区精华液| 欧美综合色免费| 成人avav在线| 国产精品456| 韩国三级中文字幕hd久久精品| 午夜精品久久久久久久久久久| 18成人在线观看| 国产日本亚洲高清| 精品理论电影在线观看| 欧美日韩成人在线| 91久久久免费一区二区| 97se狠狠狠综合亚洲狠狠| 国产成人激情av| 精品亚洲成a人在线观看| 日精品一区二区三区| 一区二区三区成人| 亚洲免费观看高清| 中文字幕一区三区| 久久精品免视看| 精品国一区二区三区| 69精品人人人人| 欧美日韩国产美| 欧美性淫爽ww久久久久无| 色噜噜夜夜夜综合网| 97精品国产97久久久久久久久久久久| 成人在线视频一区二区| 国产酒店精品激情| 国产一区欧美日韩| 国产一区二区三区免费看 | 亚洲国产成人一区二区三区| 久久精子c满五个校花| 久久精品视频一区二区| 精品久久人人做人人爽| 欧美成人精品3d动漫h| 日韩免费在线观看| 日韩精品中午字幕| 日韩一二在线观看| 日韩精品一区二区三区视频| 日韩欧美一二三四区| 日韩欧美精品在线| 欧美www视频| 久久久久久一二三区| 久久精品一区蜜桃臀影院| 久久久精品蜜桃| 欧美韩日一区二区三区四区| 国产精品网站在线播放| 国产精品另类一区| 一区二区在线观看视频在线观看| 亚洲综合图片区| 日韩中文字幕区一区有砖一区| 日韩电影在线观看一区| 免费成人av资源网| 久久 天天综合| 国产91精品久久久久久久网曝门| 国产福利一区二区三区视频| 波多野结衣中文字幕一区二区三区 | 久久久亚洲精品石原莉奈|