You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception:
Message: Error HRESULT E_FAIL has been returned from a call to a COM component.
Source: Vanara.PInvoke.Shell32
StackTrace: at Vanara.PInvoke.Shell32.IOpenControlPanel.GetPath(String pszName, StringBuilder pszPath, UInt32 cchPath) at Vanara.Windows.Shell.ControlPanel.GetPath(String item) at Vanara.Windows.Shell.ControlPanel.GetPath(ControlPanelItem item)
This is in a WPF project VS 2017 CE, Windows 10 64bit
The text was updated successfully, but these errors were encountered:
It appears others have had this exact problem when trying to use C# in the past to access this COM interface. However, I've tried this in C, and it works just fine. So, let me play with it for a few days and see if I can get it to work.
I don't have a complete fix, but I do have at least a partial. I have gone through hours of iterations without any success other than this: Build your project with either "Any CPU" and not "Prefer 32-bit" OR "x64". These settings will cause the definition in the current library to pass the parameters properly.
I get an exception when trying to use ControlPanel.GetPath
Sample code:
ControlPanelItem cpi = ControlPanelItem.AutoPlay;
string path = ControlPanel.GetPath(cpi);
Exception:
Message: Error HRESULT E_FAIL has been returned from a call to a COM component.
Source: Vanara.PInvoke.Shell32
StackTrace: at Vanara.PInvoke.Shell32.IOpenControlPanel.GetPath(String pszName, StringBuilder pszPath, UInt32 cchPath) at Vanara.Windows.Shell.ControlPanel.GetPath(String item) at Vanara.Windows.Shell.ControlPanel.GetPath(ControlPanelItem item)
This is in a WPF project VS 2017 CE, Windows 10 64bit
The text was updated successfully, but these errors were encountered: