Article View: borland.public.cppbuilder.nativeapi
Article #9975Re: invoke "file properties window"
From: Mortz
Date: Tue, 01 Jun 2004 21:13
Date: Tue, 01 Jun 2004 21:13
63 lines
2963 bytes
2963 bytes
I'm sorry for not showing the actual code in my prevoius post, but here it
is.
This code is based on the reference posted by Timothy H. Buchman...
I tried both ways but nothing happens, I mean is like if the system was
ignoring the call...
//======================================
//Possible Object types
#define OPF_PRINTERNAME 0x01
#define OPF_PATHNAME 0x02
typedef void (__stdcall *pSHObjectProperties)(HWND, UINT, LPCWSTR, LPCWSTR);
//Before this method is called there is a validation tu assert that the
dataPtr->SystemString() does refer to a Document with its whole path
void __fastcall TMainForm::Properties1Click(TObject *Sender)
{
NodeInfo *dataPtr; //pointer of a structure to hold a TTreeNode Data
property
THitTests HT;
TTreeNode *pItem;
HT = TreeView1->GetHitTestInfoAt(tvX, tvY);
if (HT.Contains(htOnItem) || HT.Contains(htOnIcon))
{
pItem = TreeView1->GetNodeAt(tvX, tvY);
if((dataPtr=(NodeInfo *)pItem->Data)!=NULL)
{
//ShellExecute(Handle,"properties",dataPtr->SystemString().c_str(),NULL,NULL
,SW_SHOW);
if(!DisplayFileProperties(Handle,dataPtr->SystemString()))
ShowMessage("Eror loading \"Shell32.dll\", file
properties cannot be displayed");
}
}
}
//======================================
bool DisplayFileProperties(HWND hwnd, AnsiString file)
{
HINSTANCE hInstance;
pSHObjectProperties SHObjectProperties;
hInstance=LoadLibrary("SHELL32.DLL");
if(!hInstance)
return false;
SHObjectProperties=(pSHObjectProperties)GetProcAddress(hInstance,(char
*)178);
SHObjectProperties(hwnd,OPF_PATHNAME,(wchar_t *)file.c_str(),NULL);
//perhaps the proble is the casting?
FreeLibrary(hInstance);
return true;
}
//======================================
Thank you in advance for any help you may provide
My best regards...
<MortZ>.
Technical Details
Message-ID:
<40bcf046@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40bb54a2$1@newsgroups.borland.com> <40bb600f@newsgroups.borland.com> <40bca1c2$1@newsgroups.borland.com> <40bcbf5b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,1de9d7beecb3f3a1 X-Google-Attributes: gid10cc67,public Reply-To: "Mortz" <rmorteo@hotmail.com> From: "Mortz" <rmorteo@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <40bb54a2$1@newsgroups.borland.com> <40bb600f@newsgroups.borland.com> <40bca1c2$1@newsgroups.borland.com> <40bcbf5b$1@newsgroups.borland.com> Subject: Re: invoke "file properties window" Date: Tue, 1 Jun 2004 14:13:14 -0700 Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 200.38.16.98 Message-ID: <40bcf046@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1086124102 200.38.16.98 (1 Jun 2004 14:08:22 -0700) Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail