|
I have a function that takes the pidl of a folder and loops through all the files in the folder and if there is a folder i the folder it calls itself, else it adds the file to a listview control. This works ok the first time the function is run, but when i calls itself, the pBrowse->EnumObjects doesen't return NOERROR it returns -2147023673, can anyone help me? the pidl i pass in the function is a pidl gotten from the SHBrowseForFolder function, here is the function:
(ignore the text after the pre tag, something went wrong when i modfied the post.
void AddFilesFromFolder(ITEMIDLIST *pIdl)
{
if (pIdl)
{
IShellFolder *pBrowse = NULL;
LPENUMIDLIST pFolder = NULL;
LPMALLOC pMalloc = NULL;
ITEMIDLIST *pNewId = NULL;
STRRET strDispName;
LVITEM lvItem;
RECT rMain;
RECT rAdd;
char szCurrentFile[MAX_PATH+1+5];
char szFolderPath[MAX_PATH+1];
DWORD pActual = 0;
DWORD dwAttrib;
IShellFolder *CurrentFolder;
HRESULT err;
err = SHGetDesktopFolder (&CurrentFolder);
if (err == NOERROR)
{
SHGetMalloc(&pMalloc);
CurrentFolder->BindToObject(pIdl, NULL, IID_IShellFolder, (LPVOID*)&pBrowse);
pBrowse->GetDisplayNameOf(pIdl, SHGDN_INFOLDER, &strDispName);
err = pBrowse->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &pFolder);
if (err == NOERROR)
{
SHGetPathFromIDList(pIdl, szFolderPath);
lvItem.mask = LVIF_IMAGE | LVIF_TEXT;
while (pFolder->Next(1, &pNewId, &pActual) != S_FALSE)
{
dwAttrib = SFGAO_FOLDER;
pBrowse->GetAttributesOf(1, (LPCITEMIDLIST*)&pNewId, &dwAttrib);
if (!(dwAttrib & SFGAO_FOLDER))
{
pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
PathCombine(gszPath, szFolderPath, strDispName.cStr);
GetID3();
FillInfo();
ListAddItem();
}
if (dwAttrib & SFGAO_FOLDER)
{
pBrowse->GetDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
AddFilesFromFolder(pNewId);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
EndDialog(hDialog, true);
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
} etDisplayNameOf(pNewId, SHGDN_INFOLDER, &strDispName);
AddFilesFromFolder(pNewId);
}
}
pMalloc->Free(pNewId);
pMalloc->Release();
EndDialog(hDialog, true);
gbFileOpen = true;
pFolder->Release();
}
CurrentFolder->Release();
}
}
}
|
|
|
|
|
redeemer wrote:
Ignore this post something's wrong with it, i'll make another.
LOL
Okay! HTML does weird things I guess
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Yep, something's going wrong here
same for two messages above this: CFileDialog assertion error
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
You can also modify or delete a post if you are not satisfied with it.
Best regards,
Alexandru Savescu
|
|
|
|
|
i want to know where can registry free homepage account!
i need a free web space (3-10MB)
please introduce me some.... thank you.
|
|
|
|
|
You can find hundreds of free web services, did you look at google.com directory ?
|
|
|
|
|
tiaozi wrote:
need a free web space (3-10MB)
Try Yahoo-Geocities
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
www.brinkster.com
Jason Gerard
|
|
|
|
|
thanks for your advice!
|
|
|
|
|
I read that in MSDN that: "COM+ will not propagate traditional C++ exceptions as extended IErrorInfo information." Does that mean that a COM that uses IErrorInfo information will not be able to pass info to another calling COM+ application?
Should I change the original component to _com_raise_errors?
Spiros Prantalos
|
|
|
|
|
Hello there,
Does anyone out there know how to write a handwritten-like mathematical expression using MFC (just like the one in MAPLE/MATHEMATICA) ?
Thanx a lot.
MARIO ANDRETTI
|
|
|
|
|
Hi too tired to think properly
am working on a project where i get some strings from a remote database but the strings have got stuff like
"Prætorius" which i hafta convert to "Praetorius"...
wots the quick way of using CString to deal with it?
regards and thanks
bryce
|
|
|
|
|
<br />
CString str;<br />
str.Replace(_T("æ"), _T("ae"));<br />
Dylan Kenneally
London, UK
|
|
|
|
|
That looks like the remote strings are UTF-8 encoded. CString class has no direct support for UTF-8 decoding.
|
|
|
|
|
is there an easy way to convert themto their ascii equivalents without using
CString::Replace ?
bryce
|
|
|
|
|
I have a dialog-based MFC application with a static control that covers the entire surface and a smaller WebBrowser control. The problem is: when painting, the WebBrowser control is drawn before the static one and, as a result, becomes not visible.
Do you know how to establish the correct paint order?
rechi
|
|
|
|
|
You can change the Z-Order of the controls.
There is a relation between the Tab order and the Z-Order
but i dont remember if it is same order or reverse.
Just try changing the tab order and see.
|
|
|
|
|
Are you trying to paint a background image?
Handle the WM_ERASEBKGND message in order to paint a background image!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
How can I find out which code line causes the following linking error :
"
Linking...
Mainfrm.obj : error LNK2001: unresolved external symbol
"public: virtual void __thiscall SECMDIFrameWnd::FloatControlBarInMDIChild(class CControlBar *,class CPoint,unsigned long)" (?FloatControlBarInMDIChild@SECMDIFrameWnd@@UAEXPAVCControlBar@@VCPoi
nt@@K@Z)
"
thanks,
Aviv.
avivhal
|
|
|
|
|
If you look close enough at the message error, you will see the offending method SECMDIFrameWnd::FloatControlBarInMDIChild(class CControlBar *,class CPoint,unsigned long) . Probably you're not including the .cpp where it is defined. If you want to locate where the method is used, do a global search on your project files.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, after a great help by you, I successfully list installed apps like in the "Add Remove Programs" control panel application. The next step is to uninstall them. The only solution that I came up with is to split the UninstallString value - in some cases the first part is the uninstaller, the second is command line to the uninstaller. But it doesen't work with all programs. I use ShellExecuteEx to start the process.
Any ideas how to set up things working with every app -> like "Add Remove Programs" app does?
Thanks,
Deian
|
|
|
|
|
I don't know about ShellExecuteEx , but CreateProcess accepts that you pass the whole commandline (with program included and all) in lpCommandLine and leave lpApplicationName set to NULL , sparing you the parsing.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, I will tray this
|
|
|
|
|
Hi all,
On one of my dialog's I have a list box, with assocated class member of type CListBox. The list box has the following styles checked in the properties Window of the IDE: Border, Notify, Horizontal scroll, Vertical scroll & No integral height; but when the list box is used, and text spans more then the horizontal view I don't get a horizontal scroll bar (I do get the vertical one correctly though).
Any ideas why?
Dylan Kenneally
London, UK
|
|
|
|
|
Hi,
I'm using Ms Word automated from my application, and in that instance of Ms Word, I insert from my app and ActiveX control ( that I have developed with ATL).
I my application I get the dispatch of my ActiveX control....
It's possible to connect to my sink interface in the ActiveX control ? ( I mean, receive in my app, outgoing events from the ActiveX), or is it impossible ?, I have read that the implementation of the connection points in ATL is not prepared for that? Is that true ?...
A code snippet about what I want to do ( quite standard thing...):
COleVariant vClassType = "MySinkSvr.PruCon";
Word::InlineShapePtr pShp = m_pWord->GetSelection()->InlineShapes->AddOLEControl(vClassType);
Word::OLEFormatPtr pFmt = pShp->OLEFormat;
TRY {
LPDISPATCH pDispatch = pFmt->Object;
m_pCon = pFmt->Object;
m_pCliSink = new CCliSink;
LPUNKNOWN pUnkSink = m_pCliSink->GetIDispatch(FALSE);
if(AfxConnectionAdvise(pDispatch, DIID__IPruConEvents, pUnkSink,FALSE, &_dwCookie)) {
TRACE("Success !");
} else {
TRACE("Failure !");
}
}
How can I do it for different process space ?, Thanks in advance, Greetings
Braulio
|
|
|
|