Solved

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

Posted on 2014-12-15
3
253 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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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
Comment Utility
See my comment
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now