#StackBounty: #c++ #windows #winapi #file-properties #shellexecuteex Missing data in Windows file properties dialog when opened by Shel…

Bounty: 200

I want to show the Windows file properties dialog for a file from my C++ code (on Windows 7, using VS 2012). I found the following code in this answer (which also contains a full MCVE). I also tried calling CoInitializeEx() first, as mentioned in the documentation of ShellExecuteEx():

// Whether I initialize COM or not doesn't seem to make a difference.


info.cbSize = sizeof info;
info.lpFile = L"D:\Test.txt";
info.nShow  = SW_SHOW;
info.lpVerb = L"properties";


This code works, i.e. the properties dialog is shown and ShellExecuteEx() returns TRUE. However, in the Details tab, the size property is wrong and the date properties are missing:

Properties window opened via my program

The rest of the properties in the Details tab (e.g. the file attributes) are correct. Strangely, the size and date properties are shown correctly in the General tab (left-most tab).

If I open the properties window via the Windows Explorer (file → right-click → Properties), then all properties in the Details tab are shown correctly:

Properties window opened via Windows Explorer

I tried it with several files and file types (e.g. txt, rtf, pdf) on different drives and on three different PCs (1x German 64-bit Windows 7, 1x English 64-bit Windows 7, 1x English 32-bit Windows 7). I always get the same result, even if I run my program as administrator. On (64-bit) Windows 8.1 the code is working for me, though.

My original program in which I discovered the problem is an MFC application, but I see the same problem if I put the above code into a console application.

What do I have to do to show the correct values in the Details tab on Windows 7? Is it even possible?

Get this bounty!!!

Leave a Reply