Article View: borland.public.cppbuilder.nativeapi
Article #3649Re: Using a window handle
From: Malcolm Smith
Date: Thu, 11 May 2006 11:13
Date: Thu, 11 May 2006 11:13
66 lines
2784 bytes
2784 bytes
Oh, thanks. I didn't even realize their was a ParentWindow property.
I've noted the additional exception handling as well. I had a TODO on that
(to look up common E_ return values).
Thanks again.
--
Malcolm Smith
MJ Freelancing
http://www.mjfreelancing.com
Associate Editor
C++Builder Developers Journal
http://www.bcbjournal.com
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:446260ad$1@newsgroups.borland.com...
>
> "Malcolm Smith" <mjfreelancing@optusnet.com.au> wrote in message
> news:446259de@newsgroups.borland.com...
>
>> The HWND is coming into my DLL from the Cleanup Manager, not going out.
>
> Exactly. You have to use the HWND that is passed into ShowProperties() as
> the parent window for any windows that ShowProperties() displays.
>
>> we are caching the form in case the user shows it more than once
>
> You need to change the form's ParentWindow property, ie:
>
> HRESULT STDMETHODCALLTYPE TDevCleanCtrlImpl::ShowProperties(HWND hwnd)
> {
> try
> {
> if( !frmFileDetails )
> frmFileDetails = new TfrmFileDetails( NULL, FVolume,
> FFileSearch, FFileStates );
> }
> catch(const Exception &)
> {
> return E_OUTOFMEMORY;
> }
>
> try
> {
> frmFileDetails->ParentWindow = hwnd;
> try {
> frmFileDetails->ShowModal();
> }
> __finally {
> frmFileDetails->ParentWindow = NULL;
> }
> }
> catch(const Exception &)
> {
> return E_UNEXPECTED;
> }
>
> return S_OK;
> }
>
>
> Gambit
>
>
Technical Details
Message-ID:
<44631c4f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4461e528@newsgroups.borland.com> <44621e0c$1@newsgroups.borland.com> <446259de@newsgroups.borland.com> <446260ad$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,85bceed53b519705 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Malcolm Smith" <mjfreelancing@optusnet.com.au> From: "Malcolm Smith" <mjfreelancing@optusnet.com.au> Newsgroups: borland.public.cppbuilder.nativeapi References: <4461e528@newsgroups.borland.com> <44621e0c$1@newsgroups.borland.com> <446259de@newsgroups.borland.com> <446260ad$1@newsgroups.borland.com> Subject: Re: Using a window handle Date: Thu, 11 May 2006 21:13:15 +1000 Lines: 68 Organization: MJ Freelancing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 211.30.161.48 Message-ID: <44631c4f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1147345999 211.30.161.48 (11 May 2006 04:13:19 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail