Commondialog Positioning

How can I position the Commondialog Control on the screen?Becuase there are no properties by which i can move it at some particular position..
Also if we use MoveWindow API call then it requires hwnd as one of its parameter...

So please help me out
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Here is a code snippest that will do the job for you. It is from planet-source-code.
     ' Name: Control position of common dialogs!
     ' Description:A way to control where any of the common dialogs (p
     '     rint setup) windows are displayed from visual basic. (Randy Birch
     '     ,
     ' By: Newsgroup Posting
     ' Inputs:None
     ' Returns:None
     'Assumes:A dialog aligns itself to the form on
     which the control is drawn. If you add to your project a new form and
     place the common dialog control on it, and in the Form_Load for that form
     add code to resize the form to 1x1, the dialog will appear wherever you
     ultimately move (reposition in code) the form to.
     This will centre a file open dialog on the screen.....
     'Side Effects:None
     'Code provided by Planet Source Code(tm) (http://www.PlanetSource
     ' 'as is', without warranties as to performance, fitness,
     '     merchantability,and any other warranty (whether expressed or impl
     '     ied).

     'Form1 is the main app with a command button to call the dialog w
     '     ith
     'Form2 is the form containing only the common dialog control.

Form1 code:

     Private Sub Command1_Click()
         Load Form2

         Form2.CommonDialog1.Flags = cdlOFNHideReadOnly

             Form2.CommonDialog1.Filter = "All Files (*.*)|*.*|"

                 Form2.CommonDialog1.FilterIndex = 2

                         Print Form2.CommonDialog1.filename
                         'do this last
                         Unload Form2
      End Sub

Form2 code:

     Private Sub Form_Load()

         Me.Move Screen.Width / 4, Screen.Height / 4, 1, 1

     End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Did it work fine?
Good idea, kamall, but a slightly cheaper option is to place the common dialog on a container, for example a picture box. Set the picture box's border style to None, and its height and width to 0. Also make sure it has no tab stop, otherwise the user could tab into it, and their cursor will "dissappear". No major deal but annoying.

Apart from that the idea is the same. Position the picture box to the desired location before showing the common dialog.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Although I didn't test your solution, it seems pretty though.
Happy new year.
HNY (&M)!
please drag and keep the dialog box to the position where u want it , on its first execution .then it will be placed there...
That's a great suggestion if you want to display the common dialog in the same position all of the time, but totally useless if you want to implement a more dynamic positioning. Which is, quite obviously, what vipin intended to do all along.

Which reminds me..

vipin, what's up buddy? Kamall put in some effort to answer your question. He deserves at least the courtesy of a response. Don't be an arsehole. Thank you.
thanks for your kind comment.
Best regards.

It didn't help though.

I have some further bad news for you. Just check vipin's record:

Last 10 Grade(s) Given:
D C C C C C C C C C  
You can draw your own conclusions from this. I'm sure everyone gets a less than satisfactory answer sometimes, but it can't be as bad as this all the time..

Question Grading Record:
13 / 17
This speaks volumes. At least four of vipin's questions were answered and vipin never bothered to acknowledge the answers, let alone grade them.

Lesson of the day: before you answer any questions, check the asker's profile and make a point of never helping someone like this.

It's not easy though. As you can see, I commented too. I forget to check.

And that's how people like vipin can keep getting away with it.

What can *we* do?

Keep a link to this URL. Whenever you spot another question by vipin, post a comment to warn other experts and to ask them NOT to answer the question. And post this URL so they can read why.

I will.
Thanks caraf_g.
You are absolutely right.

Please, go ahead and and answer the q.
kamall, some people have no decency and no shame. vipin obviously is one of these people. I think you'll be waiting in vain for vipin to grade this question.
"I told you so"....

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.