Use GetDC instead of CreateDC where possible.

This commit is contained in:
Alexandre Julliard 2007-01-02 17:16:36 +01:00
parent d44ed08d8a
commit 656fc93815
6 changed files with 12 additions and 13 deletions

View File

@ -4823,7 +4823,6 @@ TREEVIEW_MouseWheel(TREEVIEW_INFO *infoPtr, WPARAM wParam)
static LRESULT
TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
{
static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' };
RECT rcClient;
TREEVIEW_INFO *infoPtr;
LOGFONTW lf;
@ -4931,7 +4930,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
infoPtr->himlState =
ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
hdcScreen = CreateDCW(szDisplayW, NULL, NULL, NULL);
hdcScreen = GetDC(0);
/* Create a coloured bitmap compatible with the screen depth
because checkboxes are not black&white */
@ -4959,7 +4958,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
DeleteObject(hbm);
DeleteDC(hdc);
DeleteDC(hdcScreen);
ReleaseDC(0, hdcScreen);
infoPtr->stateImageWidth = 16;
infoPtr->stateImageHeight = 16;

View File

@ -164,9 +164,9 @@ DDRAW_Create(GUID *guid,
This->ImplType = DefaultSurfaceType;
/* Get the current screen settings */
hDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
hDC = GetDC(0);
This->orig_bpp = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
DeleteDC(hDC);
ReleaseDC(0, hDC);
This->orig_width = GetSystemMetrics(SM_CXSCREEN);
This->orig_height = GetSystemMetrics(SM_CYSCREEN);

View File

@ -1440,9 +1440,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
RECT clip_rc;
/* Get info on the current display setup */
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
hdc = GetDC(0);
bpp = GetDeviceCaps(hdc, BITSPIXEL);
DeleteDC(hdc);
ReleaseDC(0, hdc);
/* Change the display settings */
memset(&devmode, 0, sizeof(DEVMODEW));

View File

@ -2439,9 +2439,9 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
/* Get the initial screen setup for ddraw */
object->ddraw_width = GetSystemMetrics(SM_CXSCREEN);
object->ddraw_height = GetSystemMetrics(SM_CYSCREEN);
hDC = CreateDCA("DISPLAY", NULL, NULL, NULL);
hDC = GetDC(0);
object->ddraw_format = pixelformat_for_depth(GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES));
DeleteDC(hDC);
ReleaseDC(0, hDC);
return WINED3D_OK;
create_device_error:

View File

@ -1370,7 +1370,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
break;
}
ddc = CreateDCA("DISPLAY", NULL, NULL, NULL);
ddc = GetDC(0);
if (ddc == 0) {
HeapFree(GetProcessHeap(), 0, b_info);
return HRESULT_FROM_WIN32(GetLastError());
@ -1378,7 +1378,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
TRACE("Creating a DIB section with size %dx%dx%d, size=%d\n", b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage);
This->dib.DIBsection = CreateDIBSection(ddc, b_info, usage, &This->dib.bitmap_data, 0 /* Handle */, 0 /* Offset */);
DeleteDC(ddc);
ReleaseDC(0, ddc);
if (!This->dib.DIBsection) {
ERR("CreateDIBSection failed!\n");

View File

@ -489,9 +489,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *if
pMode->Height = GetSystemMetrics(SM_CYSCREEN);
pMode->RefreshRate = 85; /* FIXME: How to identify? */
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
hdc = GetDC(0);
bpp = GetDeviceCaps(hdc, BITSPIXEL);
DeleteDC(hdc);
ReleaseDC(0, hdc);
switch (bpp) {
case 8: pMode->Format = WINED3DFMT_R8G8B8; break;