X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/27d2dbbccadf25bb1d892fe1c4afbf74cf76bb36..0055a7a437c6858a4d8aec082cc14910dcdef869:/src/msw/utilsgui.cpp diff --git a/src/msw/utilsgui.cpp b/src/msw/utilsgui.cpp index c49738c796..d1acea6ad5 100644 --- a/src/msw/utilsgui.cpp +++ b/src/msw/utilsgui.cpp @@ -30,6 +30,8 @@ #include "wx/utils.h" #endif //WX_PRECOMP +#include "wx/dynlib.h" + #include "wx/msw/private.h" // includes // ============================================================================ @@ -157,7 +159,7 @@ extern HCURSOR wxGetCurrentBusyCursor() } // Set the cursor to the busy cursor for all windows -void wxBeginBusyCursor(wxCursor *cursor) +void wxBeginBusyCursor(const wxCursor *cursor) { if ( gs_wxBusyCursorCount++ == 0 ) { @@ -257,7 +259,7 @@ void wxGetMousePosition( int* x, int* y ) GetCursorPos( & pt ); if ( x ) *x = pt.x; if ( y ) *y = pt.y; -}; +} // Return true if we have a colour display bool wxColourDisplay() @@ -267,7 +269,7 @@ bool wxColourDisplay() return true; #else // this function is called from wxDC ctor so it is called a *lot* of times - // hence we optimize it a bit but doign the check only once + // hence we optimize it a bit but doing the check only once // // this should be MT safe as only the GUI thread (holding the GUI mutex) // can call us @@ -452,3 +454,50 @@ void wxDrawLine(HDC hdc, int x1, int y1, int x2, int y2) } +// ---------------------------------------------------------------------------- +// Shell API wrappers +// ---------------------------------------------------------------------------- + +extern bool wxEnableFileNameAutoComplete(HWND hwnd) +{ +#if wxUSE_DYNLIB_CLASS + typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD); + + static SHAutoComplete_t s_pfnSHAutoComplete = NULL; + static bool s_initialized = false; + + if ( !s_initialized ) + { + s_initialized = true; + + wxLogNull nolog; + wxDynamicLibrary dll(_T("shlwapi.dll")); + if ( dll.IsLoaded() ) + { + s_pfnSHAutoComplete = + (SHAutoComplete_t)dll.GetSymbol(_T("SHAutoComplete")); + if ( s_pfnSHAutoComplete ) + { + // won't be unloaded until the process termination, no big deal + dll.Detach(); + } + } + } + + if ( !s_pfnSHAutoComplete ) + return false; + + HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */); + if ( FAILED(hr) ) + { + wxLogApiError(_T("SHAutoComplete"), hr); + return false; + } + + return true; +#else + wxUnusedVar(hwnd); + return false; +#endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS +} +