Пробую через olectl.h- почему не получается.Вот код.
static TCHAR szWindowClass[] = _T("winClass");
static TCHAR szTitle[] = _T("Pattern");
HINSTANCE hInst;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCSTR)IDI_ICON1);
wcex.hCursor = LoadCursor(hInstance, (LPCSTR)IDC_CURSOR6);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(hInstance, (LPCSTR)IDI_ICON1);
if (!RegisterClassEx(&wcex))
{
MessageBox(NULL,_T("Call to RegisterClassEx failed!"),_T("Win32 Guided Tour"),NULL);
return 1;
}
hInst = hInstance; // Store instance handle in our global variable
HWND hWnd = CreateWindow(szWindowClass,szTitle,WS_OVERLAPPEDWINDOW|WS_VISIBLE,CW_USEDEFAULT, CW_USEDEFAULT,800, 300,NULL,NULL, hInstance,NULL);
if (!hWnd)
{
MessageBox(NULL,_T("Call to CreateWindow failed!"),_T("Win32 Guided Tour"), NULL);
return 1;
}
/*ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);*/
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
/*case WM_PAINT:
{
PAINTSTRUCT ps;
hDC = BeginPaint(hWnd, &ps);
BITMAP bm;
HDC hdcMem;
HBITMAP back = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP3));
hdcMem = CreateCompatibleDC(hDC);
SelectObject(hdcMem, back);
GetObject(back, sizeof(BITMAP), (LPVOID)&bm);
RECT r;
GetClientRect(hWnd, &r);
if (!bm.bmWidth || !bm.bmHeight)
return 0;
int w = r.right - r.left,
h = r.bottom - r.top,
bw = bm.bmWidth,
bh = bm.bmHeight;
StretchBlt(hDC, r.left, r.top, r.right, r.bottom, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
EndPaint(hWnd, &ps);
}*/
default:
return DefWindowProc(hWnd, message, wParam, lParam);
break;
}
return 0;
}
HRESULT Load(LPCTSTR szFile)
{
CComPtr <IStream> Stream;
// Load the file to a memory stream
HRESULT hr = FileToStream(szFile, &Stream);
if (SUCCEEDED(hr))
{
// Decode the picture
hr = ::OleLoadPicture(
Stream, // [in] Pointer to the stream that contains picture's data
0, // [in] Number of bytes read from the stream (0 == entire)
true, // [in] Loose original format if true
IID_IPicture, // [in] Requested interface
(void**)&m_pPicture // [out] IPictire object on success
);
}
return hr;
}
HRESULT DrawImg(HDC hdc, const RECT& rcBounds)
{
if (m_pPicture)
{
// Get the width and the height of the picture
long hmWidth = 0, hmHeight = 0;
m_pPicture->get_Width(&hmWidth);
m_pPicture->get_Height(&hmHeight);
// Convert himetric to pixels
int nWidth = MulDiv(hmWidth, ::GetDeviceCaps(hdc, LOGPIXELSX), HIMETRIC_INCH);
int nHeight = MulDiv(hmHeight, ::GetDeviceCaps(hdc, LOGPIXELSY), HIMETRIC_INCH);
// Display the picture using IPicture::Render
return m_pPicture->Render(
hdc, // [in] Handle of device context on which to render the image
rcBounds.left, // [in] Horizontal position of image in hdc
rcBounds.top, // [in] Vertical position of image in hdc
rcBounds.right - rcBounds.left, // [in] Horizontal dimension of destination rectangle
rcBounds.bottom - rcBounds.top, // [in] Vertical dimension of destination rectangle
0, // [in] Horizontal offset in source picture
hmHeight, // [in] Vertical offset in source picture
hmWidth, // [in] Amount to copy horizontally in source picture
-hmHeight, // [in] Amount to copy vertically in source picture
&rcBounds // [in, optional] Pointer to position of destination for a metafile hdc
);
}
return E_UNEXPECTED;
}
`
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Перевод документов на английский язык: Важность и ключевые аспекты
Какие существуют виды рекламных бордов и как выбрать подходящий?
Хочу сделать пошаговою регистрацию с помощью Vue routerНо, не понимаю как можно реализовать задумку