Late, I know, but in case I will forget this in a couple of months again ...
Place ::CoInitialize(NULL) before the CWinApp::InitInstance () call when creating MFC linked DLL with /clr support
On Saturday, December 27, 2008 9:49 AM no_name wrote:
I am trying to use the SHBrowseForFolder dialog inside dialog based MFC
application.
If I use BIF_NEWDIALOGSTYLE flag, the appears, but the treeview does not.
Any suggestions??
If it helps, here is the code:
BROWSEINFO browsInfo;
LPITEMIDLIST pItemIDList;
WCHAR wszPath[MAX_PATH];
browsInfo.hwndOwner = m_hWnd;
browsInfo.pidlRoot = NULL;
browsInfo.pszDisplayName = wszPath;
browsInfo.lpszTitle = L"foo";
browsInfo.ulFlags = BIF_NEWDIALOGSTYLE; // if we use zero here, it will
work, but I need "Make New Folder" button
browsInfo.lpfn = NULL;
browsInfo.lParam = NULL;
browsInfo.iImage = 0;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
pItemIDList = SHBrowseForFolder(&browsInfo);
if(pItemIDList){
// TO DO....
}
CoUninitialize();
On Saturday, December 27, 2008 11:41 AM no_name wrote:
"no_name" <send_it_on@microsoft.com> wrote in message
news:u4WTaJDaJHA.552@TK2MSFTNGP06.phx.gbl...
What I found out is that CoInitializeEx() returns 0x80010106. I also tried
to use OleInitialize(NULL) instead, but the return value is the same.
Also, as first line in BOOL CMyApp::InitInstance() I put
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED). The result is again
0x80010106. Now, the question would be: Where and who is calling
CoInitializeEx() before me?
Thank you.
On Saturday, December 27, 2008 12:28 PM no_name wrote:
solved...
On Friday, March 13, 2009 2:16 PM dvtaylo wrote:
"no_name" wrote:
How? We seem to be having a similar problem. We use SHBrowseForFolder in
our main app successfully, but if we LoadLibrary a DLL that was compiled with
CLR support, the treeview is missing next time we call SHBrowseForFolder.