ReactOS 0.4.16-dev-91-g764881a
autocomp.cpp File Reference
#include "precomp.h"
Include dependency graph for autocomp.cpp:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commdlg)
 
EXTERN_C HRESULT DoInitAutoCompleteWithCWD (FileOpenDlgInfos *pInfo, HWND hwndEdit)
 
EXTERN_C HRESULT DoUpdateAutoCompleteWithCWD (const FileOpenDlgInfos *info, LPCITEMIDLIST pidl)
 
EXTERN_C HRESULT DoReleaseAutoCompleteWithCWD (FileOpenDlgInfos *pInfo)
 

Function Documentation

◆ DoInitAutoCompleteWithCWD()

EXTERN_C HRESULT DoInitAutoCompleteWithCWD ( FileOpenDlgInfos pInfo,
HWND  hwndEdit 
)

Definition at line 12 of file autocomp.cpp.

13{
14 pInfo->pvCWD = pInfo->pvDropDown = pInfo->pvACList = NULL;
15
16 WCHAR szClass[32];
17 GetClassNameW(hwndEdit, szClass, _countof(szClass));
18 if (lstrcmpiW(szClass, WC_COMBOBOXW) == 0)
19 {
20 COMBOBOXINFO info = { sizeof(info) };
22 hwndEdit = info.hwndItem;
23 }
24 else if (lstrcmpiW(szClass, WC_COMBOBOXEXW) == 0)
25 {
27 }
28
29 IACList2 *pACList = NULL;
30 HRESULT hr = CoCreateInstance(CLSID_ACListISF, NULL, CLSCTX_INPROC_SERVER,
31 IID_IACList2, reinterpret_cast<LPVOID *>(&pACList));
32 if (FAILED(hr))
33 {
34 TRACE("CoCreateInstance(CLSID_ACListISF): 0x%08lX\n", hr);
35 return hr;
36 }
37 pInfo->pvACList = static_cast<LPVOID>(pACList);
38
39 IAutoComplete2 *pAC = NULL;
40 hr = CoCreateInstance(CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER,
41 IID_IAutoComplete2, reinterpret_cast<LPVOID *>(&pAC));
42 if (SUCCEEDED(hr))
43 {
44 pAC->Init(hwndEdit, pACList, NULL, NULL);
45 pAC->SetOptions(ACO_AUTOSUGGEST);
46 pAC->QueryInterface(IID_IAutoCompleteDropDown, &pInfo->pvDropDown);
47 pAC->Release();
48 }
49 else
50 {
51 TRACE("CoCreateInstance(CLSID_AutoComplete): 0x%08lX\n", hr);
52 pACList->Release();
53 pInfo->pvACList = NULL;
54 return hr;
55 }
56
57 pACList->QueryInterface(IID_ICurrentWorkingDirectory, &pInfo->pvCWD);
58
59 return hr;
60}
HWND hwndEdit
Definition: combotst.c:65
#define NULL
Definition: types.h:112
HANDLE HWND
Definition: compat.h:19
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4261
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT SetOptions([in] DWORD dwFlag)
HRESULT Init([in] HWND hwndEdit, [in] IUnknown *punkACL, [in] LPCOLESTR pwszRegKeyPath, [in] LPCOLESTR pwszQuickComplete)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define WC_COMBOBOXEXW
Definition: commctrl.h:3786
#define WC_COMBOBOXW
Definition: commctrl.h:4722
#define CBEM_GETEDITCONTROL
Definition: commctrl.h:3838
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI GetComboBoxInfo(_In_ HWND, _Inout_ PCOMBOBOXINFO)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by FILEDLG95_InitControls().

◆ DoReleaseAutoCompleteWithCWD()

EXTERN_C HRESULT DoReleaseAutoCompleteWithCWD ( FileOpenDlgInfos pInfo)

Definition at line 94 of file autocomp.cpp.

95{
96 if (!pInfo)
97 return E_POINTER;
98
99 ICurrentWorkingDirectory* pCWD =
100 reinterpret_cast<ICurrentWorkingDirectory*>(pInfo->pvCWD);
101 if (pCWD)
102 pCWD->Release();
103
104 IAutoCompleteDropDown* pDropDown =
105 reinterpret_cast<IAutoCompleteDropDown*>(pInfo->pvDropDown);
106 if (pDropDown)
107 pDropDown->Release();
108
109 IACList2 *pACList = static_cast<IACList2*>(pInfo->pvACList);
110 if (pACList)
111 pACList->Release();
112
113 pInfo->pvCWD = pInfo->pvDropDown = pInfo->pvACList = NULL;
114 return S_OK;
115}
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

Referenced by FileOpenDlgProc95().

◆ DoUpdateAutoCompleteWithCWD()

EXTERN_C HRESULT DoUpdateAutoCompleteWithCWD ( const FileOpenDlgInfos info,
LPCITEMIDLIST  pidl 
)

Definition at line 63 of file autocomp.cpp.

64{
65 FileOpenDlgInfos *pInfo = const_cast<FileOpenDlgInfos*>(info);
66 if (!pInfo)
67 return E_POINTER;
68
69 ICurrentWorkingDirectory* pCWD =
70 reinterpret_cast<ICurrentWorkingDirectory*>(pInfo->pvCWD);
71
72 IAutoCompleteDropDown* pDropDown =
73 reinterpret_cast<IAutoCompleteDropDown*>(pInfo->pvDropDown);
74
75 IACList2* pACList = static_cast<IACList2*>(pInfo->pvACList);
76
78 if (!pidl || !SHGetPathFromIDListW(pidl, szPath))
79 {
81 }
82
83 if (pCWD)
84 pCWD->SetDirectory(szPath);
85 if (pDropDown)
86 pDropDown->ResetEnumerator();
87 if (pACList)
88 pACList->Expand(L"");
89
90 return S_OK;
91}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define MAX_PATH
Definition: compat.h:34
LPCWSTR szPath
Definition: env.c:37
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1348

Referenced by COMDLG32_UpdateCurrentDir().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commdlg  )