Software Archive
Read-only legacy content
17060 Discussions

hwndOwner argument in GetOpenFilename

Intel_C_Intel
Employee
615 Views
Hi,
I've written a dll which includes a routine that is a do-all file input routine, that accepts command-line arguments, converts wildcards for multiple files and finally prompts if necessary, using the system32 routine GetOpenFilename. I patterned my GetOpenFilename attempt after the example in the samples folders. I assign a null to the argument hwndOwner.
My problem is that this .dll routine can be called by quickwin applications. It has been my experience that in this case, the window manager gets confused after the GetOpenFilename dialog box is closed. Window focus seems to be lost in never-never land. As the comment text indicates in the example, I've tried using :
For QuickWin
! and Standard Graphics projects,
! use GETHWNDQQ(QWIN$FRAMEWINDOW)
Unfortunately, my routine being in a dll and called by a quickwin application seems to prevent me from using the GETHWNDQQ subroutine successfully. It always returns a zero value. I've experimented with putting the entire GetOpenFilename routine into the quickwin application, with success. However, I'd really like to write the routines into a dll library for efficiency reasons. How can I determine the proper hwindOwner to pass to the system routine from within a dll being called by a quickwin application?
Thanks in advance for your help on this subject,
Jack M. O'Leary
0 Kudos
2 Replies
Intel_C_Intel
Employee
615 Views
I seem to have stumbled across a solution to my problem. After trying unsucessfully to call GetFocus and GetActiveWindow (they returned a zero) I finally have found GetForegroundWindow works. It passes me the handle of a window that I can supply to the hwndOwner member of OPENFILENAME, which is required by GetOpenFilename. After the user closes the GetOpenFilename dialog box, focus returns normally to the "console" window.
Jack
0 Kudos
Steven_L_Intel1
Employee
615 Views
Neat solution! I'll update our examples to use it. Thanks!

Steve
0 Kudos
Reply