Results 1 to 4 of 4

Thread: GetOpenFileName Lib "comdlg32.dll"

  1. #1

    Thread Starter
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    OK, I'm using this API function in Access97 to give me a standard File Open dialog box. However, when the dialog box appears, it is placed close to the top left hand corner of the screen.

    Being as aesthetically anal as I am, how can I centre this dialog box in the middle of my screen

    Thanks in advance...

  2. #2

    Thread Starter
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    In case you missed it, teh function is GetOpenFileName Lib "comdlg32.dll"

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    You're in luck I'm building a windowhandler class

    Code:
    'Here are some types and api calls:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hWnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    First find the handle of the window:
    Code:
    FindWin = FindWindow("Class", "Caption")
    Then move it with this:
    Code:
    Public Function Move(WinhWnd As Long, x As Long, y As Long, Optional width As Long, Optional height As Long)
    Dim win As RECT
    GetWindowRect WinhWnd, win
    If width = 0 Then width = win.Right - win.Left
    If height = 0 Then height = win.Bottom - win.Top
    MoveWindow WinhWnd, x, y, width, height, 1
    End Function
    Let me know if you need something!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Member
    Join Date
    Sep 2000
    Location
    Kentucky
    Posts
    56
    How do you deal with threading? The File Open Dialog box does not exist until you call the GetOpenFilename Function.
    And no code is run until the program receives the response from the Function. Am I missing something?

    I am currently using the Common Dialog API to get several filenames from the user. I want to save the changes
    that the user makes to the file display (ie List view or Detail view and Sort by column), but I can't modify the dialog
    box because I can't run any code while it exists.

    Any help would be appreciated.

    Kevin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width