\83\97ã\83­ã\82¸ã\82§ã\82¯ã\83\88/CD3DApplication.cpp on 'feature/Fixing_DirectSound_memoryleak' - RSS feed" href="/view?p=dtxmania/dtxmania.git;a=rss;f=DTXViewer%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88/@FDK10%C3%A3%C2%83%C2%97%C3%A3%C2%83%C2%AD%C3%A3%C2%82%C2%B8%C3%A3%C2%82%C2%A7%C3%A3%C2%82%C2%AF%C3%A3%C2%83%C2%88/CD3DApplication.cpp;h=refs/heads/feature/Fixing_DirectSound_memoryleak" type="application/rss+xml" /> \83\97ã\83­ã\82¸ã\82§ã\82¯ã\83\88/CD3DApplication.cpp on 'feature/Fixing_DirectSound_memoryleak' - RSS feed (no merges)" href="/view?p=dtxmania/dtxmania.git;a=rss;f=DTXViewer%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88/@FDK10%C3%A3%C2%83%C2%97%C3%A3%C2%83%C2%AD%C3%A3%C2%82%C2%B8%C3%A3%C2%82%C2%A7%C3%A3%C2%82%C2%AF%C3%A3%C2%83%C2%88/CD3DApplication.cpp;h=refs/heads/feature/Fixing_DirectSound_memoryleak;opt=--no-merges" type="application/rss+xml" /> \83\97ã\83­ã\82¸ã\82§ã\82¯ã\83\88/CD3DApplication.cpp on 'feature/Fixing_DirectSound_memoryleak' - Atom feed" href="/view?p=dtxmania/dtxmania.git;a=atom;f=DTXViewer%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88/@FDK10%C3%A3%C2%83%C2%97%C3%A3%C2%83%C2%AD%C3%A3%C2%82%C2%B8%C3%A3%C2%82%C2%A7%C3%A3%C2%82%C2%AF%C3%A3%C2%83%C2%88/CD3DApplication.cpp;h=refs/heads/feature/Fixing_DirectSound_memoryleak" type="application/atom+xml" /> \83\97ã\83­ã\82¸ã\82§ã\82¯ã\83\88/CD3DApplication.cpp on 'feature/Fixing_DirectSound_memoryleak' - Atom feed (no merges)" href="/view?p=dtxmania/dtxmania.git;a=atom;f=DTXViewer%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88/@FDK10%C3%A3%C2%83%C2%97%C3%A3%C2%83%C2%AD%C3%A3%C2%82%C2%B8%C3%A3%C2%82%C2%A7%C3%A3%C2%82%C2%AF%C3%A3%C2%83%C2%88/CD3DApplication.cpp;h=refs/heads/feature/Fixing_DirectSound_memoryleak;opt=--no-merges" type="application/atom+xml" />

OSDN Git Service

DirectSoundでClone()するとメモリリークする問題修正の途中版。WAVデータ実体への参照カウンタを実装済み。
[dtxmania/dtxmania.git] / DTXViewerプロジェクト / @FDK10ã\83\97ã\83­ã\82¸ã\82§ã\82¯ã\83\88 / CD3DApplication.cpp
1 #include "stdafx.h"
2 #include "Debug.h"
3 #include "CD3DDisplay.h"
4 #include "CTimer.h"
5 #include "WindowPositions.h"
6 #include "FDKError.h"
7 #include "CTexture.h"
8 #include "CD3DApplication.h"
9
10 namespace FDK {
11         namespace AppBase {
12
13 // static \82È\82â\82Â\82ç
14 LPDIRECTDRAW7                   CD3DApplication::pDD = NULL;
15 LPDIRECTDRAWSURFACE7    CD3DApplication::pddsFrontBuffer = NULL;
16 LPDIRECTDRAWSURFACE7    CD3DApplication::pddsBackBuffer = NULL;
17 LPDIRECT3D7                             CD3DApplication::pD3D = NULL;
18 LPDIRECT3DDEVICE7               CD3DApplication::pD3DDevice = NULL;
19 CD3DDisplay                             CD3DApplication::D3DDisplay;
20 HWND                                    CD3DApplication::hWnd = NULL;
21 int                                             CD3DApplication::nBpp = 16;
22
23 // \8bÇ\8f\8a\95Ï\90\94
24 static CD3DApplication* s_pD3DApp = NULL;               // WndProc\97p
25
26 // static WndProc
27 LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
28 {
29         return ( s_pD3DApp ) ? s_pD3DApp->WndProc( hWnd, uMsg, wParam, lParam ) : DefWindowProc( hWnd, uMsg, wParam, lParam );
30 }
31 //
32 CD3DApplication::CD3DApplication()
33 {
34         // \8aO\95\94\95Ï\90\94\82Ì\8f\89\8aú\89»
35         s_pD3DApp                                       = this;
36
37         // \93à\95\94\95Ï\90\94\82Ì\8f\89\8aú\89»
38         this->nWidth                            = 640;
39         this->nHeight                           = 480;
40         this->nBpp                                      = 16;
41         this->b\91S\89æ\96Ê\83\82\81[\83h                     = false;
42         this->hWnd                                      = NULL;
43         this->b\90\82\92¼\8bA\90ü\93¯\8aú                     = true;
44         this->dw\95`\89æ\8aÔ\8au                        = 3;
45         this->bReady                            = false;
46         this->bActive                           = false;
47     this->strWindowTitle                = _T("FDK10 Application");
48     this->strWindowClass                = _T("FDK10 WindowClass");
49         this->dw\83E\83B\83\93\83h\83E\83X\83^\83C\83\8b      = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_VISIBLE;
50         this->dw\91S\89æ\96Ê\83X\83^\83C\83\8b          = WS_POPUP | WS_VISIBLE;
51         this->bScreenSaverEnable        = false;
52 }
53 HRESULT CD3DApplication::Create( HINSTANCE hInst, LPCTSTR strCmdLine )
54 {
55         HRESULT hr;
56
57         this->hInstance   = hInst;
58
59         // IME \82ð\96³\8cø\89»
60         {
61                 WINNLSEnableIME( NULL, FALSE );
62         }
63         //
64         // \83E\83B\83\93\83h\83E\8dì\90¬\82ª\82Ü\82¾\82È\82ç\82±\82±\82Å\8dì\90¬\82·\82é
65         {
66                 if( this->hWnd == NULL )
67                 {
68                         WNDCLASS wndClass = {
69                                 0,                                                                              // \83N\83\89\83X\83X\83^\83C\83\8b
70                                 FDK::AppBase::WndProc,                                  // \83\81\83b\83Z\81[\83W\83v\83\8d\83V\81[\83W\83\83
71                                 0,                                                                              // ClsExtra
72                                 0,                                                                              // WndExtra
73                                 this->hInstance,                                                // \83C\83\93\83X\83^\83\93\83X
74                                 NULL,                                                                   // \83E\83B\83\93\83h\83E\83A\83C\83R\83\93
75                                 LoadCursor( NULL, IDC_ARROW ),                  // \83}\83E\83X\83A\83C\83R\83\93
76                                 (HBRUSH)GetStockObject( WHITE_BRUSH ),  // \94w\8ci\83u\83\89\83V
77                                 NULL,                                                                   // \83\81\83j\83\85\81[\96¼
78                                 this->strWindowClass                                    // \83N\83\89\83X\96¼
79                         };
80                         ::RegisterClass( &wndClass );
81
82                         RECT rc = { 0, 0, this->nWidth, this->nHeight };
83                         ::AdjustWindowRect( &rc, this->dw\83E\83B\83\93\83h\83E\83X\83^\83C\83\8b, FALSE );
84                         this->hWnd = ::CreateWindow(
85                                 this->strWindowClass,
86                                 this->strWindowTitle,
87                                 (this->b\91S\89æ\96Ê\83\82\81[\83h) ? this->dw\91S\89æ\96Ê\83X\83^\83C\83\8b : this->dw\83E\83B\83\93\83h\83E\83X\83^\83C\83\8b,
88                                 CW_USEDEFAULT, CW_USEDEFAULT,
89                                 (rc.right-rc.left), (rc.bottom-rc.top), 0L,
90                                 NULL, this->hInstance, 0L );
91                 }
92         }
93         //
94         // \83E\83B\83\93\83h\83E\97Ì\88æ\81i\83X\83N\83\8a\81[\83\93\8dÀ\95W\81j\82Ì\8eæ\93¾\81E\95Û\91
95         {
96                 this->t\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\83E\83B\83\93\83h\83E\97Ì\88æ\82Æ\83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82ð\8eæ\93¾\82·\82é();
97         }
98         //
99         // \83A\83_\83v\83^\81^\83f\83o\83C\83X\81^\83\82\81[\83h\82Ì\97ñ\8b\93
100         {
101                 if( FAILED( hr = this->D3DDisplay.EnumerateDevices() ) )
102                         return hr;      // \8e¸\94s
103         }
104         //
105         // \82R\82c\8aÂ\8b«\82Ì\8d\\92z
106         {
107                 if( FAILED( hr = t3D\8aÂ\8b«\82Ì\8d\\92z() ) )
108                         return hr;
109         }
110         //
111         // \83A\83v\83\8a\82Ì\88ê\93x\82¾\82¯\82Ì\8f\89\8aú\89»
112         {
113                 if( FAILED( hr = OneTimeSceneInit() ) ) {
114                         t3D\8aÂ\8b«\82Ì\94j\8aü();
115                         return hr;
116                 }
117         }
118         //
119         // \83f\83o\83C\83X\88Ë\91\83I\83u\83W\83F\83N\83g\82Ì\8f\89\8aú\89»
120         {
121                 if( FAILED( hr = InitDeviceObjects() ) ) {
122                         t3D\8aÂ\8b«\82Ì\94j\8aü();
123                         return hr;
124                 }
125         }
126         //
127         // \83f\83o\83C\83X\88Ë\91\83I\83u\83W\83F\83N\83g\82Ì\8d\\92z
128         {
129                 if( FAILED( hr = RestoreDeviceObjects() ) ) {
130                         t3D\8aÂ\8b«\82Ì\94j\8aü();
131                         return hr;
132                 }
133         }       
134         //
135         // \8f\80\94õ\8a®\97¹
136         this->bReady = true;
137
138         return S_OK;
139 }
140 HRESULT CD3DApplication::t3D\8aÂ\8b«\82Ì\8d\\92z()
141 {
142         HRESULT hr;
143         
144         D3DAdapterInfo* pAdapter = this->D3DDisplay.pAdapter;
145         D3DDeviceInfo*  pDevice  = pAdapter->pDevice;
146
147         // \83\82\83j\83^\82Ì\93d\8c¹\90Ý\92è\82ð\88ê\8e\9e\93I\82É\96³\8cø\82É\82·\82é
148         {
149                 this->exeState = ::SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_CONTINUOUS );
150         }
151         //
152         // \83X\83N\83\8a\81[\83\93\83Z\81[\83o\82Ì\97L\8cø\81E\96³\8cø\82ð\8eæ\93¾\82µ\81A\82»\82Ì\8cã\88ê\8e\9e\93I\82É\96³\8cø\82É\82·\82é
153         {
154                 HKEY    hKeyScreenSaver = NULL;
155                 long    lReturn = 0;
156                 long    lScreenSaver = 0;
157                 DWORD   dwData = 0;
158
159                 if( RegOpenKeyEx( HKEY_CURRENT_USER, TEXT("Control Panel\\Desktop"), 0, KEY_QUERY_VALUE, &hKeyScreenSaver ) == ERROR_SUCCESS )
160                 {
161                         this->bScreenSaverEnable = 
162                                 ( RegQueryValueEx( hKeyScreenSaver, TEXT("SCRNSAVE.EXE"), NULL, NULL, NULL, &dwData ) == ERROR_SUCCESS ) ? true : false;
163                 }
164                 RegCloseKey( hKeyScreenSaver );
165                 hKeyScreenSaver = NULL;
166
167                 // \96³\8cø\82É\82·\82é
168                 SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, 0, SPIF_SENDWININICHANGE );
169         }
170         //
171         // \91S\83E\83B\83\93\83h\83E\88Ê\92u\82Ì\95Û\91
172         {
173                 WindowPositions::Save();
174         }
175         //
176         // \83^\83C\83}\82Ì\8f\89\8aú\89»; \83^\83C\83}\8eí\95Ê\82ð\95Ï\8dX\82·\82é\8fê\8d\87\82Í\81A\88ê\93x Term() \82µ\82Ä Init() \82µ\82È\82¨\82·\82±\82Æ\81B
177         {
178                 this->timer.Init( TIMERTYPE_TIMEGTTIME );
179         }
180         //
181         // D3DX \82Ì\8f\89\8aú\89»
182         {
183                 if( FAILED( hr = D3DXInitialize() ) )
184                         return hr;
185         }
186         //
187         // DirectDraw7 \82Ì\8dì\90¬
188         {
189                 if( FAILED( hr = DirectDrawCreateEx( NULL, (VOID**)&this->pDD, IID_IDirectDraw7, NULL ) ) ) {
190                         D3DXUninitialize();
191                         return hr;
192                 }
193         }
194         //
195         // \8b¦\92²\83\82\81[\83h\82Ì\90Ý\92è
196         {
197                 if( FAILED( hr = this->pDD->SetCooperativeLevel( this->hWnd, this->b\91S\89æ\96Ê\83\82\81[\83h ? (DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN) : (DDSCL_NORMAL|DDSCL_NOWINDOWCHANGES) ) ) ) 
198                 {
199                         SAFE_RELEASE( this->pDD );
200                         D3DXUninitialize();
201                         return hr;
202                 }
203         }
204         //
205         // \83f\83B\83X\83v\83\8c\83C\83\82\81[\83h\82Ì\90Ý\92è\81i\91S\89æ\96Ê\83\82\81[\83h\8e\9e\82Ì\82Ý\81j
206         {
207                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
208                 {
209                         if( FAILED( hr = this->pDD->SetDisplayMode( this->nWidth, this->nHeight, this->nBpp, 0, 0 ) ) )
210                         {
211                                 SAFE_RELEASE( this->pDD );
212                                 D3DXUninitialize();
213                                 return hr;
214                         }
215                 }
216         }
217         //
218         // \83v\83\89\83C\83}\83\8a\81\95\83o\83b\83N\83T\81[\83t\83F\83C\83X\82Ì\8dì\90¬
219         {
220                 // a. \91S\89æ\96Ê\83\82\81[\83h\82Ì\8fê\8d\87
221                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
222                 {
223                         DDSURFACEDESC2 ddsd;
224                         ZeroMemory( &ddsd, sizeof( ddsd ) );
225                         ddsd.dwSize     = sizeof( ddsd );
226                         ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
227                         ddsd.ddsCaps.dwCaps     = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
228                         ddsd.dwBackBufferCount = 1;
229                         if( FAILED( hr = this->pDD->CreateSurface( &ddsd, &this->pddsFrontBuffer, NULL ) ) ) {
230                                 D3DXUninitialize();
231                                 SAFE_RELEASE( this->pDD );
232                                 return hr;      // \83v\83\89\83C\83}\83\8a\83T\81[\83t\83F\83C\83X\82Ì\8dì\90¬\82É\8e¸\94s
233                         }
234                         DDSCAPS2 ddscaps;
235                         ZeroMemory( &ddscaps, sizeof( ddscaps ) );
236                         ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
237                         if( FAILED( hr = this->pddsFrontBuffer->GetAttachedSurface( &ddscaps, &this->pddsBackBuffer ) ) )
238                         {
239                                 D3DXUninitialize();
240                                 SAFE_RELEASE( this->pddsFrontBuffer );
241                                 SAFE_RELEASE( this->pDD );
242                                 return hr;      // \83o\83b\83N\83T\81[\83t\83F\83C\83X\82Ì\8eæ\93¾\82É\8e¸\94s
243                         }
244                 }
245                 //
246                 // b. \83E\83B\83\93\83h\83E\83\82\81[\83h\82Ì\8fê\8d\87
247                 else
248                 {
249                         DDSURFACEDESC2 ddsd;
250                         ZeroMemory( &ddsd, sizeof( ddsd ) );
251                         ddsd.dwSize = sizeof( ddsd );
252                         ddsd.dwFlags = DDSD_CAPS;
253                         ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE;
254                         if( FAILED( hr = this->pDD->CreateSurface( &ddsd, &this->pddsFrontBuffer, NULL ) ) ) {
255                                 SAFE_RELEASE( this->pDD );
256                                 D3DXUninitialize();
257                                 return hr;      // \83v\83\89\83C\83}\83\8a\83T\81[\83t\83F\83C\83X\82Ì\8dì\90¬\82É\8e¸\94s
258                         }
259                         ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
260                         ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN;
261                         ddsd.dwWidth = this->nWidth;
262                         ddsd.dwHeight = this->nHeight;
263                         if( FAILED( hr = this->pDD->CreateSurface( &ddsd, &this->pddsBackBuffer, NULL ) ) ) {
264                                 SAFE_RELEASE( this->pddsFrontBuffer );
265                                 SAFE_RELEASE( this->pDD );
266                                 D3DXUninitialize();
267                                 return hr;      // \83o\83b\83N\83T\81[\83t\83F\83C\83X\82Ì\8dì\90¬\82É\8e¸\94s
268                         }
269                 }
270         }
271         //
272         // \83N\83\8a\83b\83p\81[\82Ì\8dì\90¬\81i\83E\83B\83\93\83h\83E\83\82\81[\83h\8e\9e\82Ì\82Ý\81j
273         {
274                 if( ! this->b\91S\89æ\96Ê\83\82\81[\83h )
275                 {
276                         LPDIRECTDRAWCLIPPER pClipper;
277                         if( FAILED( hr = this->pDD->CreateClipper( 0, &pClipper, NULL ) ) )
278                         {
279                                 SAFE_RELEASE( this->pddsBackBuffer );
280                                 SAFE_RELEASE( this->pddsFrontBuffer );
281                                 SAFE_RELEASE( this->pDD );
282                                 D3DXUninitialize();
283                                 return hr;      // \83N\83\8a\83b\83p\81[\82Ì\8dì\90¬\82É\8e¸\94s
284                         }
285                         pClipper->SetHWnd( 0, this->hWnd );
286                         this->pddsFrontBuffer->SetClipper( pClipper );
287                         SAFE_RELEASE( pClipper );
288                 }
289         }
290         //
291         // Direct3D \82Ì\8eæ\93¾
292         {
293                 if( FAILED( hr = this->pDD->QueryInterface( IID_IDirect3D7, (LPVOID *) &this->pD3D ) ) )
294                 {
295                         if( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) SAFE_RELEASE( this->pddsBackBuffer );
296                         SAFE_RELEASE( this->pddsFrontBuffer );
297                         SAFE_RELEASE( this->pDD );
298                         D3DXUninitialize();
299                         return hr;      // Direct3D7 \82Ì\8eæ\93¾\82É\8e¸\94s
300                 }
301         }
302         //
303         // Direct3D \83f\83o\83C\83X\82Ì\8dì\90¬
304         {
305                 if( FAILED( hr = this->pD3D->CreateDevice( IID_IDirect3DTnLHalDevice, this->pddsBackBuffer, &this->pD3DDevice ) ) )                             // TnLHAL \82Å\83g\83\89\83C
306                 {
307                         if( FAILED( hr = this->pD3D->CreateDevice( IID_IDirect3DHALDevice, this->pddsBackBuffer, &this->pD3DDevice ) ) )                        // HAL \82Å\83g\83\89\83C
308                         {
309                                 if( FAILED( hr = this->pD3D->CreateDevice( IID_IDirect3DMMXDevice, this->pddsBackBuffer, &this->pD3DDevice ) ) )                // MMX \82Å\83g\83\89\83C
310                                 {
311                                         if( FAILED( hr = this->pD3D->CreateDevice( IID_IDirect3DRGBDevice, this->pddsBackBuffer, &this->pD3DDevice ) ) )        // RGB \82Å\83g\83\89\83C
312                                         {
313                                                 SAFE_RELEASE( this->pD3D );
314                                                 if( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) SAFE_RELEASE( this->pddsBackBuffer );
315                                                 SAFE_RELEASE( this->pddsFrontBuffer );
316                                                 SAFE_RELEASE( this->pDD );
317                                                 D3DXUninitialize();
318                                                 return hr;      // Direct3DDevice \82Ì\8dì\90¬\82É\8e¸\94s
319                                         } else
320                                                 Debug::Msg( _T("Direct3D RGB \83f\83o\83C\83X\82ð\8dì\90¬\82µ\82Ü\82µ\82½\81B\n") );
321                                 } else
322                                         Debug::Msg( _T("Direct3D MMX \83f\83o\83C\83X\82ð\8dì\90¬\82µ\82Ü\82µ\82½\81B\n") );
323                         } else
324                                 Debug::Msg( _T("Direct3D HAL \83f\83o\83C\83X\82ð\8dì\90¬\82µ\82Ü\82µ\82½\81B\n") );
325                 } else
326                         Debug::Msg( _T("Direct3D T&L HAL \83f\83o\83C\83X\82ð\8dì\90¬\82µ\82Ü\82µ\82½\81B\n") );
327         }
328         //
329         // \83f\83o\83C\83X\82É\83r\83\85\81[\83|\81[\83g\82ð\90Ý\92è
330         {
331                 D3DVIEWPORT7 vp = { 0, 0, this->nWidth, this->nHeight, 0.0f, 1.0f };
332                 if( FAILED( hr = this->pD3DDevice->SetViewport( &vp ) ) )
333                 {
334                         SAFE_RELEASE( this->pD3DDevice );
335                         SAFE_RELEASE( this->pD3D );
336                         if( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) SAFE_RELEASE( this->pddsBackBuffer );
337                         SAFE_RELEASE( this->pddsFrontBuffer );
338                         SAFE_RELEASE( this->pDD );
339                         D3DXUninitialize();
340                         return hr;      // \83r\83\85\81[\83|\81[\83g\82Ì\90Ý\92è\82É\8e¸\94s
341                 }
342         }
343         //
344         // \95s\95Ï\82Ì\83\8c\83\93\83_\83\8a\83\93\83O\83X\83e\81[\83^\83X\82Ì\90Ý\92è
345         {
346                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_LIGHTING, FALSE );
347                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
348                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ANTIALIAS, FALSE );
349                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE );
350                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, TRUE );
351                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHAREF, 10 );
352                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHAFUNC, D3DCMP_GREATER );
353                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP,              D3DTOP_SELECTARG1 );
354                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1,    D3DTA_TEXTURE );
355                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,              D3DTOP_MODULATE );
356                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1,    D3DTA_TEXTURE );
357                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2,    D3DTA_DIFFUSE );
358                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_MINFILTER,    D3DTFN_POINT );
359                 this->pD3DDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER,    D3DTFN_POINT );
360         }
361         //
362         // \93K\8bX\95Ï\8dX\82³\82ê\82é\83\8c\83\93\83_\83\8a\83\93\83O\83X\83e\81[\83^\83X\82Ì\90Ý\92è
363         {
364                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_COLORKEYENABLE, FALSE );
365                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
366                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA );
367                 this->pD3DDevice->SetRenderState( D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA );
368         }
369         //
370         // \8eË\89e\8ds\97ñ\82ð\83f\83t\83H\83\8b\83g\82Ì\82à\82Ì\82©\82ç\95Ï\8dX
371         {
372                 float d, t, a;
373                 D3DXMATRIX proj;
374                 CD3DApplication::GetProjectionParam( &d, &t, &a );
375                 D3DXMatrixPerspectiveFovLH( &proj, t, 1.0f, 0.0000001f, 50.0f );
376                 D3DMATRIX pm = proj;
377                 this->pD3DDevice->SetTransform( D3DTRANSFORMSTATE_PROJECTION, &pm );
378         }
379         //
380         // \83}\83E\83X\83J\81[\83\\83\8b\95\\8e¦ON/OFF
381         {
382                 if( this->b\91S\89æ\96Ê\83\82\81[\83h ) {
383                         while( ShowCursor( FALSE ) >= 0 )
384                                 Sleep(2);
385                 } else {
386                         ShowCursor( TRUE );
387                 }
388         }
389
390         return S_OK;
391 }
392 void    CD3DApplication::t3D\8aÂ\8b«\82Ì\94j\8aü()
393 {
394         this->bActive = false;
395         this->bReady  = false;
396
397         // \83A\83v\83\8a\91¤\82Ì\8fI\97¹\8f\88\97\9d
398         {
399                 InvalidateDeviceObjects();
400                 DeleteDeviceObjects();
401                 FinalCleanup();
402         }
403         //
404         // \83f\83B\83X\83v\83\8c\83C\83\82\81[\83h\82Ì\95\9c\8c³
405         {
406                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
407                         this->pDD->RestoreDisplayMode();
408         }
409         //
410         // \8ae DirectX \83I\83u\83W\83F\83N\83g\82Ì\89ð\95ú
411         {
412                 this->pDD->SetCooperativeLevel( this->hWnd, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES );
413                 SAFE_RELEASE( this->pD3DDevice );
414                 SAFE_RELEASE( this->pD3D );
415                 if( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) SAFE_RELEASE( this->pddsBackBuffer );
416                 SAFE_RELEASE( this->pddsFrontBuffer );
417                 SAFE_RELEASE( this->pDD );
418                 D3DXUninitialize();
419         }
420         //
421         // \91S\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95\9c\8c³\81i\91S\89æ\96Ê\83\82\81[\83h\8e\9e\82Ì\82Ý\81j
422         {
423                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
424                         WindowPositions::Load();
425                 WindowPositions::Clear();               // \93à\95\94\83\8a\83X\83g\89ð\95ú
426         }
427         //
428         // \83^\83C\83}\8fI\97¹
429         {
430                 this->timer.Term();
431         }
432         //
433         // \83X\83N\83\8a\81[\83\93\83Z\81[\83o\82ª\97L\8cø\82¾\82Á\82½\82È\82ç\82à\82Æ\82É\96ß\82·
434         {
435                 if( this->bScreenSaverEnable )
436                         SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, TRUE, 0, SPIF_SENDWININICHANGE );
437         }
438         //
439         // \83\82\83j\83^\93d\8c¹\90Ý\92è\82Ì\95\9c\8c³
440         {
441                 ::SetThreadExecutionState( this->exeState );
442         }
443 }
444 HRESULT CD3DApplication::t3D\8aÂ\8b«\82Ì\8dÄ\8d\\92z( bool b\90V\91S\89æ\96Ê\83\82\81[\83h )
445 {
446         HRESULT hr;
447
448         this->bReady = false;
449         
450         // \82·\82×\82Ä\82Ì\83f\83o\83C\83X\88Ë\91\83I\83u\83W\83F\83N\83g\82ð\89ð\95ú\82·\82é
451         {
452                 InvalidateDeviceObjects();
453         }
454         //
455         // \8c»\8dÝ\91S\89æ\96Ê\83\82\81[\83h\82È\82ç\83f\83B\83X\83v\83\8c\83C\83\82\81[\83h\82ð\95\9c\8c³\82·\82é
456         {
457                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
458                         this->pDD->RestoreDisplayMode();
459         }
460         //
461         // \8ae DirectX \83I\83u\83W\83F\83N\83g\82Ì\89ð\95ú
462         {
463                 this->pDD->SetCooperativeLevel( this->hWnd, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES );
464                 SAFE_RELEASE( this->pD3DDevice );
465                 SAFE_RELEASE( this->pD3D );
466                 if( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) SAFE_RELEASE( this->pddsBackBuffer );
467                 SAFE_RELEASE( this->pddsFrontBuffer );
468                 SAFE_RELEASE( this->pDD );
469                 D3DXUninitialize();
470         }
471         //
472         // \83E\83B\83\93\83h\83E\83X\83^\83C\83\8b\82Ì\90Ý\92è
473         {
474                 // \83E\83B\83\93\83h\83E\83X\83^\83C\83\8b\82ð\95Ï\8dX\82µ\82½\8fê\8d\87\82Í\81ASetWindowsPos() \82Å\93à\95\94\83L\83\83\83b\83V\83\85\82ð\83N\83\8a\83A\82·\82é\95K\97v\82ª\82 \82é\81B
475                 if( b\90V\91S\89æ\96Ê\83\82\81[\83h )
476                 {
477                         ::SetWindowLongPtr( this->hWnd, GWL_STYLE, this->dw\91S\89æ\96Ê\83X\83^\83C\83\8b );
478                         ::SetWindowPos( this->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED );
479                 }
480                 else
481                 {
482                         ::SetWindowLongPtr( this->hWnd, GWL_STYLE, this->dw\83E\83B\83\93\83h\83E\83X\83^\83C\83\8b );
483                         ::SetWindowPos( this->hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_SHOWWINDOW );
484                 }
485         }
486         //
487         // \91S\83E\83B\83\93\83h\83E\88Ê\92u\82Æ\83T\83C\83Y\82Ì\95\9c\8c³\81i\91S\89æ\96Ê\83\82\81[\83h\8e\9e\82Ì\82Ý\81j
488         {
489                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
490                 {
491                         // \83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
492                         WindowPositions::Load();
493                         WindowPositions::Clear();
494
495                         this->t\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\83E\83B\83\93\83h\83E\97Ì\88æ\82Æ\83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82ð\8eæ\93¾\82·\82é();
496                 }
497         }
498         //
499         // \83f\83o\83C\83X\82Ì\8d\\92z
500         {
501                 bool b\95Û\91¶ = this->b\91S\89æ\96Ê\83\82\81[\83h;
502                 this->b\91S\89æ\96Ê\83\82\81[\83h = b\90V\91S\89æ\96Ê\83\82\81[\83h;          // t3D\8aÂ\8b«\82Ì\8d\\92z() \82Ì\91O\82É this->b\91S\89æ\96Ê\83\82\81[\83\82Ì\90Ý\92è\82ª\95K\97v
503         
504                 if( FAILED( hr = this->t3D\8aÂ\8b«\82Ì\8d\\92z() ) ) {
505                         this->b\91S\89æ\96Ê\83\82\81[\83h = b\95Û\91¶;
506                         return hr;
507                 }
508         }
509         //
510         // \83f\83o\83C\83X\88Ë\91\83I\83u\83W\83F\83N\83g\82Ì\95\9c\8c³\82Ì\91O\82É\81AWait a moment \89æ\91\9c\82ð\8fo\82µ\82Ä\82¨\82­\81B\81i\95\9c\8c³\82ª\92·\88ø\82¢\82½\82Æ\82«\82Ì\82½\82ß\81j
511         {
512                 CTexture::BeginScene();
513                 this->tWaitAMoment\82Ì\95`\89æ();
514                 CTexture::EndScene();
515                 this->tFlip\82Ü\82½\82ÍBlt();
516         }
517         //
518         // \83f\83o\83C\83X\88Ë\91\83I\83u\83W\83F\83N\83g\82Ì\95\9c\8c³
519         {
520                 if( FAILED( hr = this->RestoreDeviceObjects() ) )
521                         return hr;
522         }
523         //
524         // \8f\80\94õ\8a®\97¹
525         this->bReady = true;
526
527         return S_OK;
528 }
529 HRESULT CD3DApplication::t3D\8aÂ\8b«\82Ì\95`\89æ()
530 {
531         HRESULT hr;
532
533         // \8b¦\92²\83\8c\83x\83\8b\82ð\83`\83F\83b\83N\82·\82é
534         {
535                 if( FAILED( hr = this->pDD->TestCooperativeLevel() ) )
536                 {
537                         switch( hr )
538                         {
539                         case DDERR_EXCLUSIVEMODEALREADYSET:             // \81i\8e©\95ª\82ª\83E\83B\83\93\83h\83E\83\82\81[\83h\82Ì\82Æ\82«\81j\91¼\82Ì\83A\83v\83\8a\82ª\94r\91¼\83\82\81[\83h\82É\93ü\82Á\82½
540                         case DDERR_NOEXCLUSIVEMODE:                             // \94r\91¼\82ð\8e¸\82Á\82½\81iAlt+TAB\82È\82Ç\81j
541                                 Sleep( 1000 );          // \91¼\82Ì\83A\83v\83\8a\82ª\94r\91¼\83\82\81[\83h\82É\93ü\82Á\82Ä\82¢\82é\82Ì\82Å\91Ò\8b@\82·\82é\81B\96³\91Ê\82ÉCPU\82ð\8eg\82í\82È\82¢(2006/5/6)
542                                 return S_OK;
543
544                         case DDERR_WRONGMODE:                                   // \83f\83B\83X\83v\83\8c\83C\83\82\81[\83h\82ª\95Ï\8dX\82³\82ê\82½\81B\91S\83T\81[\83t\83F\83C\83X\82ð\94j\8aü\82µ\82Ä\8dì\82è\92¼\82µ\82ª\95K\97v\81B
545                                 if( this->D3DDisplay.pAdapter->pDevice->bWindowed )
546                                 {
547                                         hr = this->t3D\8aÂ\8b«\82Ì\8dÄ\8d\\92z( this->b\91S\89æ\96Ê\83\82\81[\83h );
548                                         return hr;
549                                 }
550                                 break;
551                         }
552                         return hr;
553                 }
554         }
555         //
556         // \90i\8ds\95`\89æ
557         {
558                 if( this->Render() )
559                 {
560                         // Render() \82ª true \82ð\95Ô\82µ\82½\82ç WM_CLOSE \82ð\91\97\90M\82·\82é\81B
561                         SendMessage( this->hWnd, WM_CLOSE, 0, 0 );
562                         return S_OK;
563                 }
564
565                 this->tFPS\82ð\8eZ\8fo\82·\82é();
566         }
567         //
568         // \95\\8e¦
569         {
570                 if( FAILED( hr = this->tFlip\82Ü\82½\82ÍBlt() ) )
571                 {
572                         if( hr == DDERR_SURFACELOST )
573                         {
574                                 // \83T\81[\83t\83F\83C\83X\82ð\82·\82×\82Ä\95\9c\8c³\82µ\81A\8dÄ\8d\\92z\81B
575                                 this->pDD->RestoreAllSurfaces();
576                                 return this->RestoreDeviceObjects();
577                         }
578                         else
579                                 return hr;      // \82»\82Ì\91¼\82Ì\83G\83\89\81[
580                 }
581         }
582         //
583         return S_OK;
584 }
585 HRESULT CD3DApplication::tFlip\82Ü\82½\82ÍBlt()
586 {
587         HRESULT hr = S_OK;
588
589     if( this->pddsFrontBuffer == NULL )
590                 return FDKERR_\8f\89\8aú\89»\82³\82ê\82Ä\82È\82¢;
591
592     // \91S\89æ\96Ê\83\82\81[\83h\8e\9e\81F
593         if( this->b\91S\89æ\96Ê\83\82\81[\83h )
594     {
595                 if( this->b\90\82\92¼\8bA\90ü\93¯\8aú )
596                 {
597                         hr = this->pddsFrontBuffer->Flip( NULL, DDFLIP_WAIT );
598                         return hr;
599                 }
600                 else
601                 {
602                         return this->t\90\82\92¼\93¯\8aú\82ð\8eg\82í\82È\82¢\83E\83F\83C\83g\82ÆBlt( NULL );
603                 }
604     }
605
606     // \83E\83B\83\93\83h\83E\83\82\81[\83h\8e\9e\81F
607     else
608         {
609                 return this->t\90\82\92¼\93¯\8aú\82ð\8eg\82í\82È\82¢\83E\83F\83C\83g\82ÆBlt( &this->rc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ );
610         }
611
612         return hr;
613 }
614 HRESULT CD3DApplication::t\90\82\92¼\93¯\8aú\82ð\8eg\82í\82È\82¢\83E\83F\83C\83g\82ÆBlt( LPRECT prc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ )
615 {
616         static bool   bBltFast\82ð\8eg\82¤ = true;            // \8f\89\89ñ\82Ì\82Ý BltFast \82Å\8e\8e\82µ\81A\83_\83\81\82È\82ç\82»\82ê\88È\8d~\82ÍBlt\82ð\8eg\82¤\81B
617         static double db\91O\89ñ\82Ì\95`\89æ\8aJ\8en\8e\9e\8d\8f = INIT_TIME;
618
619         HRESULT hr = S_OK;
620
621         if( db\91O\89ñ\82Ì\95`\89æ\8aJ\8en\8e\9e\8d\8f != INIT_TIME )
622         {
623                 double db\8co\89ß\8e\9e\8aÔ = this->timer.GetSysTime() - db\91O\89ñ\82Ì\95`\89æ\8aJ\8en\8e\9e\8d\8f;
624                 double db\97]\8fè\8e\9e\8aÔ = (double)this->dw\95`\89æ\8aÔ\8au - db\8co\89ß\8e\9e\8aÔ;
625                 if( db\97]\8fè\8e\9e\8aÔ > 0 )
626                         ::Sleep( (DWORD)db\97]\8fè\8e\9e\8aÔ );           // \97]\8fè\8e\9e\8aÔ\82¾\82¯\96°\82é
627         }
628
629 retry:
630         if( bBltFast\82ð\8eg\82¤ )
631         {
632                 RECT rcBack = { 0, 0, this->nWidth, this->nHeight };
633                 if( FAILED( hr = this->pddsFrontBuffer->BltFast( 0, 0, this->pddsBackBuffer, &rcBack, DDBLTFAST_WAIT ) ) )
634                 {
635                         bBltFast\82ð\8eg\82¤ = false; // BltFast() \82É\8e¸\94s\82µ\82½\82Ì\82Å\81A\88È\8cã\82Í Blt() \82ð\8eg\82¤\81B
636                         goto retry;
637                 }
638         }
639         else
640                 hr = this->pddsFrontBuffer->Blt( prc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ, this->pddsBackBuffer, NULL, DDBLT_WAIT, NULL );
641
642         db\91O\89ñ\82Ì\95`\89æ\8aJ\8en\8e\9e\8d\8f = this->timer.GetSysTime();
643         
644         return hr;
645 }
646 //
647 void    CD3DApplication::t\91S\89æ\96Ê\81E\83E\83B\83\93\83h\83E\83\82\81[\83h\82ð\90Ø\82è\91Ö\82¦\82é()
648 {
649         HRESULT hr;
650
651         // \8c»\8dÝ\83E\83B\83\93\83h\83E\83\82\81[\83h\82È\82ç\91S\83E\83B\83\93\83h\83E\82Ì\88Ê\92u\82ð\95Û\91\82·\82é
652         if( ! this->b\91S\89æ\96Ê\83\82\81[\83h )
653                 WindowPositions::Save();
654
655         // \83f\83o\83C\83X\90Ø\82è\91Ö\82¦
656         if( FAILED( hr = t3D\8aÂ\8b«\82Ì\8dÄ\8d\\92z( ! this->b\91S\89æ\96Ê\83\82\81[\83h ) ) )
657         {
658                 // \8e¸\94s\82µ\82½\82ç\8c³\82É\96ß\82·\81i\82P\89ñ\82¾\82¯\81j
659                 if( FAILED( hr = t3D\8aÂ\8b«\82Ì\8dÄ\8d\\92z( this->b\91S\89æ\96Ê\83\82\81[\83h ) ) )
660                         return; // \82±\82ê\82Å\82à\83G\83\89\81[\82ª\8fo\82½\82ç\96³\8e\8b
661         }
662 }
663
664 void    CD3DApplication::t\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\83E\83B\83\93\83h\83E\97Ì\88æ\82Æ\83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82ð\8eæ\93¾\82·\82é()
665 {
666         // \83E\83B\83\93\83h\83E\97Ì\88æ\82Ì\8eæ\93¾
667         GetWindowRect( this->hWnd, &this->rc\83E\83B\83\93\83h\83E\97Ì\88æ );
668
669         // \83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82Ì\8eæ\93¾
670         GetClientRect( this->hWnd, &this->rc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ );
671         ClientToScreen( this->hWnd, (POINT*)&this->rc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ.left );           // left, top     \82ð\83X\83N\83\8a\81[\83\93\8dÀ\95W\82Ö
672         ClientToScreen( this->hWnd, (POINT*)&this->rc\83N\83\89\83C\83A\83\93\83g\97Ì\88æ.right );          // right, bottom \82ð\83X\83N\83\8a\81[\83\93\8dÀ\95W\82Ö
673 }
674
675 void    CD3DApplication::tWaitAMoment\82Ì\95`\89æ()
676 {
677 /*
678         \88È\89º\82Í\83T\83\93\83v\83\8b
679
680         CSurface sf;
681         sf.InitDeviceObjectsFromFile( _T("Wait a moment"), _T("sysdata/ses_frame.jpg") );
682         if( SUCCEEDED( sf.RestoreDeviceObjects() ) )
683         {
684                 sf.Draw( 0, 0 );
685                 sf.InvalidateDeviceObjects();
686         }
687         sf.DeleteDeviceObjects();
688 */
689 }
690
691 void    CD3DApplication::tFPS\82ð\8eZ\8fo\82·\82é()
692 {
693         static double fpstime = INIT_TIME;
694         static int fps = 0;
695
696         // \8f\89\8aú\89»
697         if( fpstime == INIT_TIME )
698         {
699                 fpstime = this->timer.GetSysTime();
700                 this->nFPS = fps = 0;
701         }
702
703         // \82P\95b\8co\89ß\82²\82Æ\82É\8cv\8eZ
704         while( this->timer.GetSysTime() - fpstime >= 1000.0 )
705         {
706                 this->nFPS = fps;
707                 fps = 0;
708                 fpstime += 1000.0;
709         }
710         fps ++;
711 }
712 //
713 INT             CD3DApplication::Run()
714 {
715     MSG  msg;
716
717         while( true )
718     {
719                 if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
720                 {
721                         if( msg.message == WM_QUIT )
722                                 break;
723                         TranslateMessage( &msg );
724                         DispatchMessage( &msg );
725                 }
726                 else
727                 {
728                         if( this->bReady && this->bActive )
729                         {
730                                 if( FAILED( t3D\8aÂ\8b«\82Ì\95`\89æ() ) ) {
731                                         Debug::Msg( _T("3D\8aÂ\8b«\82Ì\95`\89æ\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B\8fI\97¹\82µ\82Ü\82·\81B\n") );
732                                         SendMessage( this->hWnd, WM_CLOSE, 0, 0 );
733                                 }
734                         }
735                 }
736         }
737     return (INT)msg.wParam;
738 }
739 LRESULT CD3DApplication::WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
740 {
741     switch( uMsg )
742     {
743
744         case WM_CLOSE:
745                 this->bActive = false;
746                 this->t3D\8aÂ\8b«\82Ì\94j\8aü();
747                 break;
748
749         case WM_DESTROY:
750                 PostQuitMessage( 0 );
751                 return 0;
752
753         case WM_SIZE:
754                 // \83E\83B\83\93\83h\83E\82ª\91S\95\94\89B\82ê\82½\82è\8dÅ\8f¬\89»\82³\82ê\82½\82è\82µ\82½\82ç this->bActive = false \82É\82·\82é\81B
755                 this->bActive = ( wParam == SIZE_MAXHIDE || wParam == SIZE_MINIMIZED ) ? false : true;
756                 break;
757
758         case WM_MOVE:
759                 // \90V\82µ\82¢\97Ì\88æ\8dÀ\95W\82ð\8eæ\93¾\82µ\82Ä\82¨\82­
760                 this->t\8c»\8dÝ\82Ì\83E\83B\83\93\83h\83E\82Ì\83E\83B\83\93\83h\83E\97Ì\88æ\82Æ\83N\83\89\83C\83A\83\93\83g\97Ì\88æ\82ð\8eæ\93¾\82·\82é();
761                 break;
762
763         case WM_GETMINMAXINFO:
764                 // \83A\83v\83\8a\82Ì\8dÅ\8f¬\83T\83C\83Y\82Ì\96â\82¢\8d\87\82í\82¹\82Ö\82Ì\89ñ\93\9a\81B
765                 ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 100;
766                 ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 100;
767                 return 0;
768
769         case WM_NCHITTEST:
770                 if( this->b\91S\89æ\96Ê\83\82\81[\83h )
771                         return HTCLIENT;                // \82·\82×\82Ä\82ª\83N\83\89\83C\83A\83\93\83g\97Ì\88æ
772                 break;
773         }
774         return DefWindowProc( hWnd, uMsg, wParam, lParam );
775 }
776         }//AppBase
777 }//FDK