Changed CBGetDroppedControlRect to be compliant with Windows API.
[wine/testsucceed.git] / dlls / commdlg / generic.c
blobe71846fa2a69ee062ac27c681854014ea244c62c
1 /*
2 * COMMDLG/COMDLG32 functions
4 * Copyright 1994 Martin Ayotte
5 * Copyright 1996 Albrecht Kleine
6 * Copyright 1998,1999 Bertho Stultiens
7 * Copyright 1999 Klaas van Gend
8 */
10 #include "winbase.h"
11 #include "commdlg.h"
12 #include "debug.h"
14 DEFAULT_DEBUG_CHANNEL(commdlg)
16 #include "cdlg.h"
18 HINSTANCE16 COMMDLG_hInstance = 0;
19 HINSTANCE COMMDLG_hInstance32 = 0;
20 static int COMMDLG_Attach = 0;
22 /***********************************************************************
23 * COMMDLG_DllEntryPoint [COMMDLG.entry]
25 * Initialization code for the COMMDLG DLL
27 * RETURNS:
29 BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2)
31 TRACE(commdlg, "(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2);
32 switch(Reason)
34 case DLL_PROCESS_ATTACH:
35 COMMDLG_Attach++;
36 if(COMMDLG_hInstance)
38 ERR(commdlg, "commdlg.dll instantiated twice!\n");
40 * We should return FALSE here, but that will break
41 * most apps that use CreateProcess because we do
42 * not yet support seperate address-spaces.
44 return TRUE;
47 COMMDLG_hInstance = hInst;
48 if(!COMMDLG_hInstance32)
50 if(!(COMMDLG_hInstance32 = LoadLibraryA("comdlg32.dll")))
52 ERR(commdlg, "Could not load sibling comdlg32.dll\n");
53 return FALSE;
56 break;
58 case DLL_PROCESS_DETACH:
59 if(!--COMMDLG_Attach)
61 COMMDLG_hInstance = 0;
62 if(COMMDLG_hInstance32)
63 FreeLibrary(COMMDLG_hInstance32);
65 break;
67 return TRUE;
71 /***********************************************************************
72 * CommDlgExtendedError16 [COMMDLG.26]
74 * Get the last error value if a commdlg function fails.
75 * RETURNS
76 * Current error value which might not be valid
77 * if a previous call succeeded.
79 DWORD WINAPI CommDlgExtendedError16(void)
81 return CommDlgExtendedError();