Win32 CreateWindow GdiPlus
2020-12-13 03:12
标签:des style class blog tar ext Win32 CreateWindow GdiPlus,搜素材,soscw.com Win32 CreateWindow GdiPlus 标签:des style class blog tar ext 原文地址:http://www.cnblogs.com/d3inc/p/3799701.html#include "stdafx.h"
#include "TestGidPlus.h"
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
// Initialize GDI+.
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
WNDCLASSEX wcApp;
wcApp.lpszClassName = TEXT("Test_Window");
wcApp.cbSize = sizeof(wcApp);
wcApp.style = CS_HREDRAW | CS_VREDRAW;
wcApp.hInstance = hInstance;
wcApp.cbWndExtra = 0;
wcApp.cbClsExtra = 0;
wcApp.hCursor = LoadCursor(NULL,IDC_ARROW);
wcApp.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wcApp.lpfnWndProc = WndProc;
wcApp.hCursor = LoadCursor(NULL,IDC_ARROW);
wcApp.hbrBackground = (HBRUSH)(COLOR_WINDOW);
wcApp.lpszMenuName = NULL;
wcApp.hIconSm = NULL;
RegisterClassExW(&wcApp);
HWND hwnd = CreateWindowExW (NULL, TEXT("Test_Window"), TEXT(""), WS_OVERLAPPEDWINDOW, 100, 100, 600, 400, NULL, NULL, hInstance, NULL);
ShowWindow(hwnd,SW_NORMAL);
UpdateWindow(hwnd);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GdiplusShutdown(gdiplusToken);
return msg.lParam;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT b;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CREATE:
//SendMessage(hwnd,WM_PAINT,0,0);
break;
case WM_PAINT:
{
///////////////////Gdiplus与Gdi混合实现双缓冲////////////////////
//HDC hMemDC = CreateCompatibleDC(m_hDC);
//HBITMAP hMemBitmap = CreateCompatibleBitmap(m_hDC, DEFAULT_STATUS_WIDTH, DEFAULT_STATUS_HEIGHT);
//SelectObject(hMemDC, hMemBitmap);
//Graphics *memGraphics = new Graphics(hMemDC);
//Pen pen(Color(192, 192, 192));
//SolidBrush brush(Color(255, 255, 255));
//memGraphics->FillRectangle(&brush, xPos, yPos, DEFAULT_STATUS_WIDTH, DEFAULT_STATUS_HEIGHT);
//memGraphics->DrawRectangle(&pen, xPos, yPos, DEFAULT_STATUS_WIDTH, DEFAULT_STATUS_HEIGHT);
//for (int i = 0; i