質問編集履歴
1
コードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,4 +6,170 @@
|
|
6
6
|
|
7
7
|
コンソールにerror LNK2019: 未解決の外部シンボルと出ます。
|
8
8
|
|
9
|
+
以下、そのコードです。
|
10
|
+
|
9
11
|
どなたか教えて下さい。
|
12
|
+
|
13
|
+
```lang-<
|
14
|
+
|
15
|
+
#include <windows.h>
|
16
|
+
|
17
|
+
#include <winuser.h>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
#define APP_NAME TEXT("CreateFlickBookImage")
|
22
|
+
|
23
|
+
#define BMP_FILE TEXT("BackgroundGrid.bmp")
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
28
|
+
|
29
|
+
{
|
30
|
+
|
31
|
+
HDC hdc;
|
32
|
+
|
33
|
+
PAINTSTRUCT ps;
|
34
|
+
|
35
|
+
static HDC hMemDC;
|
36
|
+
|
37
|
+
static HBITMAP hBitmap;
|
38
|
+
|
39
|
+
static BITMAP bitmap;
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
switch(uMsg) {
|
44
|
+
|
45
|
+
case WM_DESTROY :
|
46
|
+
|
47
|
+
DeleteDC(hMemDC);
|
48
|
+
|
49
|
+
DeleteObject(hBitmap);
|
50
|
+
|
51
|
+
PostQuitMessage(0);
|
52
|
+
|
53
|
+
return 0;
|
54
|
+
|
55
|
+
case WM_CREATE :
|
56
|
+
|
57
|
+
hMemDC = CreateCompatibleDC(NULL);
|
58
|
+
|
59
|
+
hBitmap = LoadImage(NULL, BMP_FILE, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
|
60
|
+
|
61
|
+
SelectObject(hMemDC, hBitmap);
|
62
|
+
|
63
|
+
GetObject(hBitmap, sizeof(BITMAP), &bitmap);
|
64
|
+
|
65
|
+
return 0;
|
66
|
+
|
67
|
+
case WM_PAINT :
|
68
|
+
|
69
|
+
hdc = BeginPaint(hWnd, &ps);
|
70
|
+
|
71
|
+
BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
72
|
+
|
73
|
+
EndPaint(hWnd, &ps);
|
74
|
+
|
75
|
+
return 0;
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
88
|
+
|
89
|
+
{
|
90
|
+
|
91
|
+
WNDCLASS wc;
|
92
|
+
|
93
|
+
HWND hWnd;
|
94
|
+
|
95
|
+
MSG msg;
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
//WNDCLASSの初期化
|
100
|
+
|
101
|
+
wc.style = CS_HREDRAW | CS_VREDRAW;
|
102
|
+
|
103
|
+
wc.lpfnWndProc = WindowProc;
|
104
|
+
|
105
|
+
wc.cbClsExtra = 0;
|
106
|
+
|
107
|
+
wc.cbWndExtra = 0;
|
108
|
+
|
109
|
+
wc.hInstance = hInstance;
|
110
|
+
|
111
|
+
wc.hIcon = NULL;
|
112
|
+
|
113
|
+
wc.hCursor = NULL;
|
114
|
+
|
115
|
+
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
|
116
|
+
|
117
|
+
wc.lpszMenuName = NULL;
|
118
|
+
|
119
|
+
wc.lpszClassName = APP_NAME;
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
//ウィンドウクラスの登録
|
124
|
+
|
125
|
+
if(!RegisterClass(&wc)) {
|
126
|
+
|
127
|
+
MessageBox(NULL, TEXT("ウィンドウクラスの登録に失敗しました"), NULL, MB_OK);
|
128
|
+
|
129
|
+
return 1;
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
//ウィンドウの生成
|
136
|
+
|
137
|
+
hWnd = CreateWindow(APP_NAME, TEXT("パラパラ漫画画像作成ツール"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
|
138
|
+
|
139
|
+
NULL, NULL, hInstance, NULL);
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
if(hWnd == NULL) {
|
144
|
+
|
145
|
+
MessageBox(NULL, TEXT("ウィンドウの生成に失敗しました"), NULL, MB_OK);
|
146
|
+
|
147
|
+
return 1;
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
//ウィンドウの表示
|
154
|
+
|
155
|
+
ShowWindow(hWnd, SW_SHOW);
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
while(GetMessage(&msg, NULL, 0, 0) > 0) { //メッセージキューからメッセージを取得
|
160
|
+
|
161
|
+
DispatchMessage(&msg);
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
return msg.wParam;
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
コード
|
174
|
+
|
175
|
+
```
|