Home > Software engineering >  How to obtain Follder select event
How to obtain Follder select event

Time:09-18

Using IShellBrowser wrapper class, how to obtain Follder select event

CodePudding user response:

The class ATL_NO_VTABLE CSyncCloudEx:
Public CComObjectRootEx ,
Public CComCoClassPublic IDispatchImpl//public IPersistFile,
Public IShellBrowser
{
Public:

DECLARE_REGISTRY_RESOURCEID (IDR_CLOUDDISK)

DECLARE_PROTECT_FINAL_CONSTRUCT ()

BEGIN_COM_MAP (CSyncCloudEx)
COM_INTERFACE_ENTRY (IComponentRegistrar)
COM_INTERFACE_ENTRY (IDispatch)
//COM_INTERFACE_ENTRY (IPersistFile)
COM_INTERFACE_ENTRY (IShellBrowser)
END_COM_MAP ()

CSyncCloudEx (void);
~ CSyncCloudEx (void);

Public:
STDMETHOD (Load) (LPCOLESTR wszFile, dwords dwMode);
STDMETHOD (CompareIDs) (LPARAM LPARAM, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2);

//STDMETHOD (OnViewWindowActive) (IShellView * PSHV);
//STDMETHOD (BrowseObject) (LPCITEMIDLIST pidl, UINT wflags);

//int the CALLBACK BrowseCallbackProc (HWND HWND, UINT uMsg, LPARAM LPARAM, LPARAM lpData);
//LRESUL CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM);
//STDMETHOD (QueryService) (REFGUID guidService, REFIID riid, char PPV);
STDMETHOD (EnumObjects) (HWND HWND, SHCONTF grfFlags, IEnumIDList * * ppenumIDList);

};

CodePudding user response:

CSyncCloudEx: : CSyncCloudEx (void)
{
//EnumerateFolder (LPCTSTR path)
}


CSyncCloudEx: : ~ CSyncCloudEx (void)
{
}

STDMETHODIMP CSyncCloudEx: : Load (LPCOLESTR wszFile, dwords dwMode)
{
Return S_OK.
}

STDMETHODIMP CSyncCloudEx: : CompareIDs (LPARAM LPARAM, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
{
MessageBox (NULL, L "Test event." and L "Test", MB_OK);
The switch (lParam)
{
Case SHCIDS_ALLFIELDS:
break;
Case SHCIDS_CANONICALONLY:
break;
//case PCUIDLIST_RELATIVE:
//break;

}

Return S_OK.
}

//STDMETHODIMP OnViewWindowActive (IShellView * PSHV)
//{
//MessageBox (NULL, "Test event." L, L "Test", MB_OK);

//return 0;
//}

//STDMETHODIMP BrowseObject (LPCITEMIDLIST pidl, UINT wflags)
//{
//MessageBox (NULL, "Test event." L, L "Test", MB_OK);

//return 0;
//}

//int the CALLBACK CSyncCloudEx: : BrowseCallbackProc (HWND HWND, UINT uMsg, LPARAM LPARAM, LPARAM lpData)
//{
//MessageBox (NULL, "Test event." L, L "Test", MB_OK);
//
//return 0;
//}

//STDMETHODIMP CSyncCloudEx: : QueryService (REFGUID guidService, REFIID riid, char PPV)
//{
//MessageBox (NULL, "Test event." L, L "Test", MB_OK);
//return 0;
//}


//LRESUL CALLBACK CSyncCloudEx: : WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
//{
//return 0;
//}

STDMETHODIMP EnumObjects (HWND HWND, SHCONTF grfFlags, IEnumIDList * * ppenumIDList)
{
MessageBox (NULL, L "Test event." and L "Test", MB_OK);
return 0;
}

CodePudding user response:

https://www.cnblogs.com/qingtian224/p/5566901.html

CodePudding user response:

Int the CALLBACK BrowserCallbackProc (HWND HWND, UINT uMsg, LPARAM LPARAM, LPARAM lpData)
{
The switch (uMsg) {
Case BFFM_INITIALIZED:
MessageBox (HWND, L "Test event... 1, "L" test ", MB_OK);
break;
Case BFFM_SELCHANGED:
MessageBox (HWND, L "Test event... 2, "L" test ", MB_OK);
break;
Case BFFM_VALIDATEFAILED:
MessageBox (HWND, L "Test event... 3, "L" test ", MB_OK);
break;
Default:
break;
}

return 0;
}

Don't have access to a resource manager (explorer) the click event

CodePudding user response:

Int the CALLBACK BrowseCallbackProc (HWND HWND, UINT uMsg, LPARAM LPARAM, LPARAM lpData) also tried

CodePudding user response:

How to obtain the resource manager (floder explorer), click the folder/file event

CodePudding user response:

Resource manager own implementation IShellBrowser don't need you to write a,

Resource manager for the implementation of the IWebBrowser2 is to give the Document property returns the current ShellFolderView, DWebBrowserEvents2: such as: NavigateComplete2 event triggers, hanging on to the current value of the Document DShellFolderViewEvents: : the SelectionChanged went, of course BeforeNavigate2 and exit to cancel to this event listener can have leak, otherwise

From the resource manager IShellWindows IWebBrowser2 methods refer to https://devblogs.microsoft.com/oldnewthing/20040720-00/? P=38393. Then I can hang DWebBrowserEvents2,

Since using ATL, need not taught how to hang events,
  • Related