Window handles?

In my upgrade application I’m calling UpdateDriverForPlugAndPlayDevices, which the DDK says needs a parameter
"
HWND hwndParent
A caller-supplied handle to the top-level window to use for any UI
related to installing device(s).
"

When I used “this->m_hWnd” from a dialog member function (OnOK) this worked. However, for a number of reasons I don’t want to do it in the dialog (e.g. silent install, so no dialogs). I have tried a few things like AfxGetMainWnd()->GetSafeHwnd(), or this->GetSafeHwnd() from an application member function or this->m_pMainWnd->hWnd and they all fall over with access violations, or debug traps.

There is obviously some magic incantation required to get the right sort of HWND. Have we any Windows API guru’s in the house, or am I asking this in the wrong place?

Thanks,
Evan


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Well, You could try creating a top-level hidden window and pass its
handle in place of the dialog handle.

  • asit

-----Original Message-----
From: xxxxx@eicon.com [mailto:xxxxx@eicon.com]
Sent: Monday, October 22, 2001 5:40 AM
To: NT Developers Interest List
Subject: [ntdev] Window handles?

In my upgrade application I’m calling UpdateDriverForPlugAndPlayDevices,
which the DDK says needs a parameter
"
HWND hwndParent
A caller-supplied handle to the top-level window to use for any UI
related to installing device(s).
"

When I used “this->m_hWnd” from a dialog member function (OnOK) this
worked. However, for a number of reasons I don’t want to do it in the
dialog (e.g. silent install, so no dialogs). I have tried a few things
like AfxGetMainWnd()->GetSafeHwnd(), or this->GetSafeHwnd() from an
application member function or this->m_pMainWnd->hWnd and they all fall
over with access violations, or debug traps.

There is obviously some magic incantation required to get the right sort
of HWND. Have we any Windows API guru’s in the house, or am I asking
this in the wrong place?

Thanks,
Evan


You are currently subscribed to ntdev as: xxxxx@greenborder.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com