Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Windows 7 causing issues
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Windows 7 causing issues

 Post Reply Post Reply
Author
Message
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Topic: Windows 7 causing issues
    Posted: 25 March 2009 at 9:06am

The following code gives an error on Windows 7, but works fine on Windows Vista and below.  Any ideas would be appreciated :(, there is more code to this but we broke it down to bare minimum so others can try to help us.

CComPtr<IMalloc> spIMalloc;
HRESULT hResult = ::SHGetMalloc(&spIMalloc);
LPITEMIDLIST progFolder = NULL;
hResult = ::SHGetSpecialFolderLocation(NULL, CSIDL_PRINTERS, &progFolder );
CComPtr<IShellFolder> spIShellFolder;
CComPtr<IShellFolder> spFolderProgram;
hResult = ::SHGetDesktopFolder(&spIShellFolder);
hResult = spIShellFolder->BindToObject(progFolder, NULL, IID_IShellFolder, (void **)&spFolderProgram );
CComPtr<IEnumIDList> spIEnumIDList;
hResult = spFolderProgram->EnumObjects(NULL, SHCONTF_NONFOLDERS, &spIEnumIDList );
ULONG ulCount = 0;
LPITEMIDLIST listNoFolder = NULL;
hResult = spIEnumIDList->Next(1, &listNoFolder, &ulCount ); // hResult shows an error
spIMalloc->Free(progFolder);
 
Any help much appreciated
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2009 at 2:05am
Hi,
 
Maybe Windows7 wants first parameter to EnumObjects - some window handle. Check if our Explorer sample works with Windows 7.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2009 at 5:02am
But strange thing is other CSIDL, eg. CSIDL_PROGRAMS works fine on Windows 7, it is just CSIDL_PRINTERS which is very strange.  Could be a bug with Windows 7, as our code works on all OS's except this one.  And the code as I said works fine with other CSIDL's just not the printer one.
 
See Windows 7 has changed the way printers are stored by the looks of it, as it now has Devices and Printers instead of the old Printers
 
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
terrym View Drop Down
Senior Member
Senior Member


Joined: 13 April 2007
Status: Offline
Points: 836
Post Options Post Options   Thanks (0) Thanks(0)   Quote terrym Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2009 at 5:35am
Also tried with first param still same issue, but as I said only with CSIDL_PRINTERS
Thank you,
Terry Mancey

email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.