[
板情報
|
カテゴリランキング
]
したらばTOP
■掲示板に戻る■
全部
1-100
最新50
|
メール
|
1-
101-
201-
301-
401-
501-
601-
701-
801-
901-
1001-
1101-
1201-
1301-
1401-
1501-
1601-
1701-
1801-
1901-
2001-
2101-
2201-
2301-
2401-
2501-
2601-
2701-
2801-
2901-
3001-
3101-
3201-
3301-
3401-
3501-
3601-
3701-
3801-
3901-
4001-
4101-
4201-
4301-
4401-
4501-
4601-
4701-
4801-
4901-
5001-
5101-
5201-
5301-
5401-
この機能を使うにはJavaScriptを有効にしてください
|
管理人の独り言(プログラミング関連)
2483
:
774さん
:2010/07/23(金) 10:28:28
#include <iostream>
#include <windows.h>
#define nullptr NULL
//関数
auto WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)->int;
auto CleanMessage(int *ret)->bool;
auto CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)->LRESULT;
//実装
auto WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow)->int{
WNDCLASSEX wc = {sizeof(wc)};
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWndProc;
wc.cbWndExtra = 0;
wc.cbClsExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
wc.lpszMenuName = nullptr;
wc.lpszClassName = TEXT("AA");
wc.hIconSm = nullptr;
ATOM aWnd = RegisterClassEx(&wc);
if(aWnd == INVALID_ATOM){
return -1;
}
//ウィンドウの大きさの計算 横:600 縦;300
const int clientwidth = 800;
const int clientheight = 600;
const int screenx = GetSystemMetrics(SM_CXSCREEN);
const int screeny = GetSystemMetrics(SM_CYSCREEN);
RECT windowRect;
windowRect.left = screenx / 2 - clientwidth / 2;
windowRect.right = screenx / 2 + clientwidth / 2;
windowRect.top = screeny / 2 - clientheight / 2;
windowRect.bottom = screeny / 2 + clientheight / 2;
AdjustWindowRectEx(&windowRect, WS_CAPTION | WS_SYSMENU, FALSE, 0);
HWND hWnd = CreateWindowEx(
0,
reinterpret_cast<LPCTSTR>(aWnd),
TEXT("WindowTitle!!"),
WS_CAPTION | WS_SYSMENU,
windowRect.left, windowRect.top,
windowRect.right - windowRect.left, windowRect.bottom - windowRect.top,
nullptr,
nullptr,
hInstance,
nullptr
);
if(hWnd == nullptr){
return -2;
}
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
static const DWORD waitTimes[] = {
16, 17, 17
};
int index = 0;
int retValue;
HDC hdcWin = GetDC(hWnd);
HDC hdcMem = CreateCompatibleDC(hdcWin);
HBITMAP hBitmapMem = CreateCompatibleBitmap(hdcWin, clientwidth, clientheight);
SelectObject(hdcMem, hBitmapMem);
DWORD old = timeGetTime();
int i = 0;
timeBeginPeriod(1);
for(;;){
if(CleanMessage(&retValue)){
break;
}
//ただただ面倒臭い処理
{
RECT rc;
rc.left = 0;
rc.right = clientwidth;
rc.top = 0;
rc.bottom = clientheight;
FillRect(hdcMem, &rc, reinterpret_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
int j = 0;
BitBlt(hdcWin, 0, 0, clientwidth, clientheight, hdcMem, 0, 0, SRCCOPY);
}
std::cout << timeGetTime() - old << std::endl;
if(CleanMessage(&retValue)){
break;
}
新着レスの表示
名前:
E-mail
(省略可)
:
※書き込む際の注意事項は
こちら
※画像アップローダーは
こちら
(画像を表示できるのは「画像リンクのサムネイル表示」がオンの掲示板に限ります)
スマートフォン版
掲示板管理者へ連絡
無料レンタル掲示板