Yes! I love this list! Thanks Anssi Joutsiniemi, Chris Martin and John Harrop for taking the time to help me out. Chris you actually hit the nail on the head without realising it - 'GetForegroundWindow' was the API function I needed to get direct access to the hwnd of the dialog window. I can use this handle as an argument to the 'GetWindowPlacement' and 'SetWindowPlacement' API functions. These functions also take an argument of type WINDOWPLACEMENT which includes a member of type RECT which, in turn has the members 'top', 'bottom', 'left' and 'right'. It's these four values which are stored and reset. I use 'GetWindowPlacement' in a handler called by the command buttons of the dialog and 'SetWindowPlacement' in a handler which is called directly after the dialog is invoked. If anyone tries this, note that the 'length' member of the WINDOWPLACEMENT type must be set to '44' (the total length of the type) in MapBasic before either function is called. Many thanks again. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 04 January 2000 13:07 To: [EMAIL PROTECTED] Subject: MI MB: How do I query dialog position (Win API?) Listers, I have a MapBasic application that presents the user with a dialog when a custom toolbutton is used. I want the user to be able to move this dialog before it is dismissed and have the dialog posted to that new position the next time the toolbutton is used. I don't think there is a way to do this with MapBasic alone because although the 'Dialog' statement has the 'position' parameter to position the dialog when its posted, there's no way of querying the current position once the user has moved it. If I'm wrong on this, please let me know! I thought of using the 'GetWindowPlacement' and 'SetWindowPlacement' API functions to get around this MB shortcoming but these functions both require the Windows Hwnd of the dialog box and I cannot find a way to get it. I've tried using the 'FindWindow' API function, passing the caption of my dialog as the second argument (and "" for the first), but it just returns zero to me. I've also tried using the 'GetTopWindow' API function like this - 'GetTopWindow(WindowInfo(WIN_MAPINFO, WIN_INFO_WND))' but that returns the Hwnd of the top document window (a map window in my case) rather than the dialog. I tried both of these from handlers invoked when the dialog command buttons are used - so the dialog is still present and (I had hoped) is the 'top' window with the focus. Can anyone suggest how I might use either of these functions successfully, or suggest an alternative method? Thanks for any help you can provide. Richard Burkmar ICL [EMAIL PROTECTED] ---------------------------------------------------------------------- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED] ---------------------------------------------------------------------- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
