Enumerating list of files under NSE fails second time after NSE device removed/inserted back

Enumerating list of files under NSE fails second time after NSE device removed/inserted back

Post by V V » Sat, 28 Dec 2002 04:27:57

Hi All,

I am writing application, which gets list of image files under a particular
directory/Camera namespace NSE and displays image thumbnails. Recently I
added code to refresh my Tree control view, when devices are dynamically
added/removed. I implemented this code by listening for WM_DEVICECHANGE

Here are the steps
- Camera is connected to Computer
- First time App runs, I could display images from Camera namespace device.
- I remove the camera by removing USB connection.
- Treeview updates and doesn't display NSE.
- I insert the Camera back . Tree view displays NSE.
- I click NSE. I try to get list of files. Here it FAILS. I tried updating
Shell Cache on MyComputer/Desktop Nodes.

- I could get properties AND attributes of NSE device.

The call "spEnumIDList->Next(1, &lpRelPIDL, &ulPIDLsFetched ))" returns

Any ideas why. TIA.

Here is code snippet to get list of files.

CComPtr<IEnumIDList> spEnumIDList;
 CComPtr<IShellFolder> spShellDesktop;
 CComPtr<IShellFolder> spShellFolder;
 ULONG ulPIDLsFetched =0;
 CString temp;

 hr = ::SHGetMalloc(&spMalloc);
 if (FAILED(hr))
  return FALSE;

    hr = ::SHGetDesktopFolder(&spShellDesktop);
 if (FAILED(hr))
     return FALSE;

 // Now, get the IShellFolder interface for this
 hr = spShellDesktop->BindToObject(m_lpParentFolderPIDL, 0,
IID_IShellFolder, (void**)&spShellFolder);
 if (FAILED(hr))
          return FALSE;

 // Enumerate the objects underneath it.
 hr = spShellFolder->EnumObjects(NULL, SHCONTF_NONFOLDERS, &spEnumIDList);
 if (FAILED(hr))
     return FALSE;

// SECOND Time , spEnumIDList returns FALSE.
 while(S_OK == spEnumIDList->Next(1, &lpRelPIDL, &ulPIDLsFetched ))
     // Get PIDLS, Open file , Read it.





1. Insert in 2 tables - Second insert fails then first, then second, then first...

Hi there,

I'm currently trying to run two Insert queries, one after the other
into a MySQL database via DBI. The first inserts into table poheader,
the second into table pocontent

What's happening, though, is that I'm getting consecutive successes
and failures with each attempt.

As in, if I get a successful insert into POHeader, POContent remains
empty, and vice versa. Even though both queries return a rowsaffected
value of 1.

Initially, I had them set up as simply

$query1 = QueryCode1;
$query2 = QueryCode2;

with consecutive do statements,


However, I thought perhaps there was something in the concurrent
connection causing the problem so I split it up into two separate
connections and prepare and execute methods but, still to no avail.

The two tables in question are in a one to many relationship with a
code from one being inserted in the other but I'm inserting the record
for the 1 side of the relationship first, so that shouldn't be an
issue, and, anyway, the second query is executing without a relevant
key being in the parent table.

Some code for those who wish to get a clearer picture

my $insertheader = qq{INSERT INTO poheader (AutoID, ...) VALUES

my $insertcontent = qq{INSERT INTO pocontent (AutoID, ...) VALUES
(NULL, ...)};

my $poheadrows = $dbh->prepare ($insertheader);
$poheadrows->execute() or warn "Warning: Could not insert data into PO
Header table. \n\n";

# Now close the connection


my $dbh2 = DBI->connect ($dsn, $user_name, $password);

my $sth = $dbh2->prepare($insertcontent);

$sth->execute() or warn "Warning: Could not insert data into PO
Content table. \n\n";


Anyone have any ideas why this might be happening? Is there some cache
I have to flush - it's as if it's only ever inserting the last one
that didn't get inserted. Would really appreciate any pointers.


2. So I don't clog this group with questions...

3. Enumerating files under namespace device fails

4. Help;Please check out these tools,etc.

5. Detect NSE Device Insertion/Removal dynamically

6. NW4.1 Printer error message 'out of paper'

7. Help : Live Real Time NSE Cash quotes directly into xls sheet

8. delete files in NSE made with SHCreateShellFolderView and CDefFolderMenu_Create2

9. drag files to frame of NSE?

10. How forbid dragging file to address bar in NSE?

11. manifest file for a NSE

12. Question: How to support Drag and Drop onto NSE from file in WinXP ZIP folder