Solved

How to position windows common dialog in vb6 when using comdlg32 GetOpenFilename?

Posted on 2014-12-15
3
322 Views
Last Modified: 2015-01-10
If I use GetOpenFilename of comdlg32 the common dialog box is placed somewhere onto the left top edge - always the same position. The parameter list of GetOpenFilename has no variables for the positioning of the dialog box. So how can I best move the dialog to the wanted position (before showing up resp. before the user begins to react)?
Does this work also for message boxes?
Ok, I am only interessted in solutions for VB6!

Sincerly
Josef
0
Comment
Question by:joschramm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Martin Liss
ID: 40500824
The GetOpenFilename window will open wherever it was the last time. In other words if you see it and then move it, it will open the next time at the new position. That says to me that the position must be stored in the Registry and so if you can find the entry you can set it ahead of time via code. (Sorry for my being lazy here and not finding it for you.)
0
 

Accepted Solution

by:
joschramm earned 0 total points
ID: 40531716
Hi Martin Liss, unfortunately I did not find any appropriate entry in the Registry. Nevertheless I found a code snippet that solved my problem.
It is to be admired at http://www.freevbcode.com/ShowCode.asp?ID=685.
It uses GetWindowRect and MoveWindow to move the common dialoge window around. To use these functions an AdressOf operator is needed (to fetch the adress of a hook function). Therefore I had to modify my code somewhat as my code runs as class.
If you are interessted (or someone else) I can send more details.
Sincerly, Josef
0
 

Author Closing Comment

by:joschramm
ID: 40541772
See my comment
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question