Solved

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

Posted on 2014-12-15
3
282 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
  • 2
3 Comments
 
LVL 46

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

770 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