+ Post New Thread
Results 1 to 2 of 2
Office Software Thread, Moving an access 2007 form using win api in Technical; I have a sub form which I want to place in a precise place on the desktop using the mouse ...
  1. #1
    tinmanjo's Avatar
    Join Date
    Mar 2010
    Posts
    16
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Moving an access 2007 form using win api

    I have a sub form which I want to place in a precise place on the desktop using the mouse coordinates but the form ends up in the wrong place, basically i want to place the subform near the mouse when i double click on a list item.

    here is the subform code, the problem is it ends up loading in the wrong place, i think it may be that access stores the mouse position differently

    Code:
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
       POINTAPI) As Long
    
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    Dim a As POINTAPI
    Dim b As Long
    Dim c As Long
    
    
    Private Sub Form_Close()
    Form_frmMain.List0.Requery
    End Sub
    
    Private Sub Form_Load()
    
    ret = GetCursorPos(a)
    With Me
    
    .Move a.x, a.y
    
    End With
    
    End Sub
    /edit: hmm i think i know what i might be, the coords need to be converted to twips/pix instead of pixels ?
    Last edited by tinmanjo; 18th March 2010 at 04:15 PM.

  2. #2

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,563
    Thank Post
    1,470
    Thanked 1,222 Times in 831 Posts
    Rep Power
    752
    Is the form modal? Because the units are relative to the Access window rather than absolute values for modal forms...

    Try the method at this site to convert pixels to twips:
    http://bytes.com/topic/access/answer...position-mouse
    Last edited by LosOjos; 18th March 2010 at 04:28 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 15th October 2009, 02:50 PM
  2. MOSS 2007 Form based Authentication
    By wesleyw in forum Windows
    Replies: 0
    Last Post: 27th November 2008, 12:11 PM
  3. moving form access to sql server
    By RabbieBurns in forum Office Software
    Replies: 3
    Last Post: 27th August 2008, 03:20 PM
  4. Migrating form RM CC3 to vanilla win 2K3 & XP?
    By nicholab in forum Network and Classroom Management
    Replies: 9
    Last Post: 22nd February 2007, 11:38 AM
  5. Moving Exchange form one server to another
    By tosca925 in forum Windows
    Replies: 10
    Last Post: 22nd November 2006, 01:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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