Discussion:
Creating a shell extension to run on a 64bit OS.
(too old to reply)
Anthony Hunter
2010-04-21 12:17:01 UTC
Permalink
Raw Message
I am creating a shell extension for the file properties dialog. Since
Win7/2008 no longer show custom version fields, and the SpecialBuild and
PrivateBuild fields arent' displayed either, I am creating my own tab to
display this information for our binaries.

I have my shell extension working on all 32bit OS's (XP/2003/7), but when I
run it on a 64bit machine that page does not get added. I have compiled it as
a 64bit so that it will run properly, but it always fails trying to create
the page.

Here is a code snipit of where it is failing.

PROPSHEETPAGE psp;
// Set up the PROPSHEETPAGE struct.
ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );

psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE | PSP_DEFAULT |
PSP_USEICONID | PSP_USECALLBACK;
psp.hInstance = _Module.GetResourceInstance();
psp.pszTemplate = MAKEINTRESOURCE(IDD_MY_PROPPAGE);
psp.pszIcon = MAKEINTRESOURCE(IDI_MYICON);
psp.pszTitle = "MyCompany\0";
psp.pfnDlgProc = (DLGPROC) PropPageDlgProc;
psp.lParam = (LPARAM) szFile;
psp.pfnCallback = PropPageCallbackProc;
psp.pcRefParent = (UINT*) &_Module.m_nLockCnt;

// Create the page & get a handle.
MessageBox( NULL, "creating page", "Shell Extension", MB_OK );
HPROPSHEETPAGE hPage = CreatePropertySheetPage( &psp );

if ( NULL != hPage )
{
// Call the shell's callback function, so it adds the page to
// the property sheet.
MessageBox( NULL, "adding page", "Shell Extension", MB_OK );
if ( !lpfnAddPageProc ( hPage, lParam ))
{
DestroyPropertySheetPage ( hPage );
MessageBox( NULL, "page destroyed", "Shell Extension", MB_OK );
}
else
{
MessageBox( NULL, "page added", "Shell Extension", MB_OK );
}
}
else
{
MessageBox( NULL, "hPage = NULL", "Shell Extension", MB_OK );
}


When I bring up the properties dialog, my dll always displays the last
message, "hPage = NULL". So CreatePropertySheetPage() seems to not work on a
64bit machine. Does something else need to be called? Or is one of my
settings in PROPSHEETPAGE psp not set correctly?




Thanks,
Anthony
David Lowndes
2010-04-21 14:19:02 UTC
Permalink
Raw Message
Anthony,

I have very similar code in a property page shell extension that works
fine under Win64.

Does GetLastError give you any hint as to why it's failed?

If you run it under the debugger, can you see anything happening in
the output pane on that line of code?

Dave
Anthony Hunter
2010-04-21 16:15:02 UTC
Permalink
Raw Message
GetLastError returns 193 - not a valid Win32 application.

I currently can't debug on that machine but will set it up and give it a try.


Anthony
Anthony Hunter
2010-04-27 12:31:01 UTC
Permalink
Raw Message
I have been able to debug it, and nothing happens in the output pane.

Any ideas why this isn't working?



Anthony
David Lowndes
2010-04-27 13:04:09 UTC
Permalink
Raw Message
Post by Anthony Hunter
I have been able to debug it, and nothing happens in the output pane.
Any ideas why this isn't working?
Is there anything in particular on the property page that may be
causing the problem? Try removing all the controls and see if that
makes any difference.

Dave
Anthony Hunter
2010-04-27 13:17:02 UTC
Permalink
Raw Message
I have been able to figure this out. My project included a manifest that had
a dependency for the comctl32.dll that was at the wrong version. Once I
removed the dependency entry from the manifest the dll started to work.



Anthony
shailesh pendurkar
2011-05-20 14:27:49 UTC
Permalink
Raw Message
Hi Anthony,

I am trying to add property sheet to have my own screen saver settings at display applet. THis is on windows 7. I have compiled my dll in x64. Initialize function is being called properly, but addpages function isn't getting called. I have put messagebox as a very first line in addpages function.

Can you please help to find out what could be the reason?

Thanks.
Post by Anthony Hunter
I am creating a shell extension for the file properties dialog. Since
Win7/2008 no longer show custom version fields, and the SpecialBuild and
PrivateBuild fields arent' displayed either, I am creating my own tab to
display this information for our binaries.
I have my shell extension working on all 32bit OS's (XP/2003/7), but when I
run it on a 64bit machine that page does not get added. I have compiled it as
a 64bit so that it will run properly, but it always fails trying to create
the page.
Here is a code snipit of where it is failing.
PROPSHEETPAGE psp;
// Set up the PROPSHEETPAGE struct.
ZeroMemory ( &psp, sizeof(PROPSHEETPAGE) );
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_USEREFPARENT | PSP_USETITLE | PSP_DEFAULT |
PSP_USEICONID | PSP_USECALLBACK;
psp.hInstance = _Module.GetResourceInstance();
psp.pszTemplate = MAKEINTRESOURCE(IDD_MY_PROPPAGE);
psp.pszIcon = MAKEINTRESOURCE(IDI_MYICON);
psp.pszTitle = "MyCompany\0";
psp.pfnDlgProc = (DLGPROC) PropPageDlgProc;
psp.lParam = (LPARAM) szFile;
psp.pfnCallback = PropPageCallbackProc;
psp.pcRefParent = (UINT*) &_Module.m_nLockCnt;
// Create the page & get a handle.
MessageBox( NULL, "creating page", "Shell Extension", MB_OK );
HPROPSHEETPAGE hPage = CreatePropertySheetPage( &psp );
if ( NULL != hPage )
{
// Call the shell's callback function, so it adds the page to
// the property sheet.
MessageBox( NULL, "adding page", "Shell Extension", MB_OK );
if ( !lpfnAddPageProc ( hPage, lParam ))
{
DestroyPropertySheetPage ( hPage );
MessageBox( NULL, "page destroyed", "Shell Extension", MB_OK );
}
else
{
MessageBox( NULL, "page added", "Shell Extension", MB_OK );
}
}
else
{
MessageBox( NULL, "hPage = NULL", "Shell Extension", MB_OK );
}
When I bring up the properties dialog, my dll always displays the last
message, "hPage = NULL". So CreatePropertySheetPage() seems to not work on a
64bit machine. Does something else need to be called? Or is one of my
settings in PROPSHEETPAGE psp not set correctly?
Thanks,
Anthony
Post by David Lowndes
Anthony,
I have very similar code in a property page shell extension that works
fine under Win64.
Does GetLastError give you any hint as to why it is failed?
If you run it under the debugger, can you see anything happening in
the output pane on that line of code?
Dave
Post by Anthony Hunter
GetLastError returns 193 - not a valid Win32 application.
I currently cannot debug on that machine but will set it up and give it a try.
Anthony
Post by Anthony Hunter
I have been able to debug it, and nothing happens in the output pane.
Any ideas why this is not working?
Anthony
Post by David Lowndes
Is there anything in particular on the property page that may be
causing the problem? Try removing all the controls and see if that
makes any difference.
Dave
Post by Anthony Hunter
I have been able to figure this out. My project included a manifest that had
a dependency for the comctl32.dll that was at the wrong version. Once I
removed the dependency entry from the manifest the dll started to work.
Anthony
Loading...