Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Form's Position In Relation To The Screen


I actually have two questions for you brilliant minds to ponder on...

1) How can I capture a mouse click anywhere on the screen?
2) How can I find the location of a form (or any other window) in realation to the screen. For instance, it's left most edge and it's upper most edge.

Thank you for your help,
Squirrelly1




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Mouse Position With API In Relation To Form
I am in need of a solution that will return the current x, y values for the mouse position on the form, not on my screen...

Tracking Position Of Text Box In Relation To The Form
hi ,

on my form i have a few text boxs and want to track the postion ie the X & Y coordinates as i tab through the text boxs.



ie the first textbox X coor=??? Y= coordin=??? and so on

Form Screen Position
I am wanting to detect (ie. fire an event) when a user has finished moving a form around the screen. I want the user to be able to click on the capiton bar, move the form and then when the form has finished moving output the new form co-ordinates in a message box or debug window. I can gather the co-oridinates before but getting them after is the problem. Any ideas?

Position Form To The Top Right Of The Screen??
how can I position a form to the top right of the screen, independent of the screen resolution??

And keep in count the form width ?

Thanks.

Position Form At Top Centre Of Screen.
Subject says it all. Any suggestions?

My project starts up as maximized but when I press the "normal" button (the one between the maximize and minimize) the form is located in the centre of the screen.

Loading Form's Screen Position
while i'm waiting on the webbrowser to load some stuff..i know how to make my form appear..but how do i make it appear on top of my webbrowser control..in the center..and stick there?

Finding Position Of Mouse Pointer..in Relation To The Scale Size
this is what i am using

------------------------------------------------------------------------------------
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long

Private Type POINTAPI
x As Integer
y As Integer
End Type

Dim MousePoint As POINTAPI
------------------------------------------------------------------------------------
GetCursorPos MousePoint
ScreenToClient Picture1.hwnd, MousePoint
------------------------------------------------------------------------------------


this is to get the mouse pointers position within a picture1 box

but my problem is that I have scaled the picture box like this

Board.Scale (0, 0)-(6, 6)

but the mouse position outputted from the code above gives only in pixels, not in the scale that i have set
does anyone know how to fix this? or is there another method?

basically i want to be able to move a mousepointer around some tiles and everytime the pointer is in a tile to beable to detect which tile it is in.

Form Screen Position - Monitor Size
How would I set the form position to the the bottom right of the screen area.. I am basically thinking of the different sizes of monitor's and resolutions...

The Left and Top properties can be set of course, but...

Thanks in advance

Screen Position To Form Control Math.... HELP!
I am using the

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


API to read the position of the mouse.
Now I need my form to use twips since I dynamically am adjusting position of all form controls on form resize and I tried pixels and it was a mess.

Now I use the mouse position in conjunction with Microsoft HTML Object library pointing to the currently loaded page in the webbrowser control.

Say a link is on the page. I use the mouse X,Y to check if it is over a link.
BUT
The API returns positions that to not work with the browser.
I will be like 30 pixels above a link and it thinks I am on it.
I tried adjusting it and it still didn't work.

Is there some math solution to get the returned X and Y to be X and Y for the browser control? Wouldn't it have to account for different screen resolutions and form sizes?

The code attached is in VB 5.


Thank you for any help

Mike

VB's Relation To An Access Form
I am comfortable in Access, and was curious if I could create a button on a VB form to open an Access Form for input...

One that I have secured for Admin only...to add inventory, keep it updated, note when reorders are necessary etc...OR what would be easier...to create a VB form since I'm creating the project in VB, and create my fields for Inventory control, and have it write to an Access Database Table? (I have Sales clerks that use the VB form as well, and they will not be allowed the password to the inventory control form in access)...

IF It is possible to use a VB form to input data and write it to an access database...

Is it hard to Password protect a VB command button, so that only Admin could access the VB form to enter data which would be backed up to an Access table? As they use the password on the VB command button to access the Access Secured Form, I intend to place a password button where the user will have to enter a second password to enter into the inventory once there.
Does this sound to outragious? Could anyone give me a few solutions to the best route to take on this?

MDI Form . Relation Between Parent And Child
hi
I would like to create a form that will present main data in the parent window and some records of detial in the child form.
1)How do I create the forms?
2) How do I set the relation between them.?


For example:
Tthe main form will present an order information with customer name and order id .
The child form will present some line, each is a record with part name.
(All data is from acess table)

Sizing & Moving Form In Relation To Taskbar
I cleaned up this code last night... basically it allows you to have a form take up all the visible screen area 1) without being maximized, 2) without being cut off by the taskbar.

It may not be the easiest way to accomplish this, but I'm happy with it since I did it on my own

If you can improve on this code, or suggest something different, please do


Code:
'---------------------------------------------------------------------------------------
' Procedure : basPositionForm
' DateTime : 2004-05-23 22:03
' Author : PSD DevTeam (that's me, hehe)
' Purpose : To size and position a form relative to the size and position of the
' : system task bar, enabling the form to occupy all available screen area
' : without getting cut off screen.
'---------------------------------------------------------------------------------------
Option Explicit

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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Enum tbPOSITION
Error_Taskbar_Not_Found ' If the handle of the taskbar cannot be found
' this may mean that the user is running an
' alternative shell program (such as LiteStep)
' or the operating system's taskbar has a different
' class name and the code needs to be modified to
' add a new classname.

Error_Position_Not_Determined ' If for some reason the position of the taskbar
' cannot be determined, let's set the error.

Top ' The taskbar is at the top of the screen.
Bottom ' The taskbar is at the bottom of the screen
Left ' The taskbar is on the left of the screen.
Right ' The taskbar is on the right of the screen.
End Enum


Private Position As tbPOSITION
Private Dimensions As RECT

'---------------------------------------------------------------------------------------
' Procedure : GethWnd
' Purpose : Get the handle to the taskbar and determin it's position.
'---------------------------------------------------------------------------------------
Private Function GethWnd() As Boolean
Dim rct As RECT
Dim ScreenWidth As Integer
Dim ScreenHeight As Integer
Dim hWnd As Long
hWnd = FindWindow("Shell_TrayWnd", vbNullString)
' Shell_TrayWnd is the class name of the system tray for Windows XP.
' I do not know if it is the same for Windows 2000, or Windows 2003.
' Other operating systems, Windows 95/98/NT4/ME may be different as well.

If hWnd = 0 Then GoTo NotFound

GetWindowRect hWnd, rct

Dimensions.Bottom = rct.Bottom
Dimensions.Left = rct.Left
Dimensions.Right = rct.Right
Dimensions.Top = rct.Top

ScreenWidth = Screen.Width / Screen.TwipsPerPixelX ' Resolution in pixels
ScreenHeight = Screen.Height / Screen.TwipsPerPixelY ' Resolution in pixels

' This set of If/ElseIf clauses determins on which side of
' the screen the taskbar is placed. The values used in
' the equations (like the -2, +2) were determined from using
' a Spy type of program, that told me the position of the taskbar
' is actually placed -2/+2 pixels/points off the screen.

If rct.Left = -2 And rct.Right = (ScreenWidth + 2) And rct.Bottom = (ScreenHeight + 2) Then
Position = Bottom
ElseIf rct.Left = -2 And rct.Top = -2 And rct.Right = (ScreenWidth + 2) Then
Position = Top
ElseIf rct.Left <> -2 Then
Position = Right
ElseIf rct.Right <> (ScreenWidth + 2) Then
Position = Left
Else
' The position could not be determined for some reason,
' possibly could mean the operating system is different
' and does not place the taskbar at the -2/+2 locations.

' The taskbar could be set to Auto Hide also.

Position = Error_Position_Not_Determined
GethWnd = False
Exit Function
End If

GethWnd = True

Exit Function

NotFound:
Position = Error_Taskbar_Not_Found
GethWnd = False
End Function


'---------------------------------------------------------------------------------------
' Procedure : PositionForm
' Purpose : Size and move the form to it's proper location.
'---------------------------------------------------------------------------------------
Public Sub PositionForm(frm As Form)
If GethWnd = False Then GoTo errhWnd

frm.Width = Screen.Width
frm.Height = Screen.Height

If Position = Bottom Then
frm.Height = frm.Height - ((Dimensions.Bottom - Dimensions.Top) * Screen.TwipsPerPixelY)
frm.Move 0, 0
ElseIf Position = Top Then
frm.Height = frm.Height - (Dimensions.Bottom * Screen.TwipsPerPixelY)
frm.Move 0, Dimensions.Bottom * Screen.TwipsPerPixelY
ElseIf Position = Left Then
frm.Width = frm.Width - (Dimensions.Right * Screen.TwipsPerPixelX)
frm.Move Dimensions.Right * Screen.TwipsPerPixelX, 0
ElseIf Position = Right Then
frm.Width = Dimensions.Left * Screen.TwipsPerPixelX
frm.Move 0, 0
End If

Exit Sub

errhWnd:
If Position = Error_Taskbar_Not_Found Or Position = Error_Position_Not_Determined Then
' Couldn't do this properly, so let's just center the form.
frm.Left = (Screen.Width / 2) - (frm.Width / 2)
frm.Top = (Screen.Height / 2) - (frm.Height / 2)
Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, App.Title
End If
Err.Clear
End Sub

How Would I Position My Form At The Current Caret Position (like The Menu For Inserting Stuff In Msv
How would i position my form at the current caret position (like the menu for inserting stuff in msvb6)

Screen Position?
Hi..
How i can retain the position of my application on screen.. like whenever i open up my application (like MSN Messenger), and move it into the screen across screen... on desktop... then i exit it.. if i open a program again, how i can open it to a same place in desktop it was closed?

Position On Screen
Hi,

When the user selects any cell in column #2 in my Data Grid control I want a combo box to be placed in the exact position of that cell (same left, top, height, width as the cell clicked).

I already know how to make the combo box appear at the same left, height, and width, but I cant figure out how to make it appear at the right top (y-axis position).

How do you find out the top position of the current row the user is currently in???

Thanx

Screen Position
I have compiled a program every time it starts up it is in the bottom right hand corner of the screen.
Is there a way of making it start into a full screen every time ?

Last One I Promise - Screen Position
Didnt know if this was "graphics" or not - so i stuck it in here..

I want an object (textbox, picture, whatever) displayed at the top right corner of my form (in fullscreen). My problem is that I am using a large monitor. If a user has a smaller monitor, it cuts off part of the picture, or doesnt show it at all. How can I code it to position itself at the top right corner????

How do I also make it display center screen?

Starting Screen Position
When I run my VB Program the bottom is cut off by the monitor and I have to move it up. Is there any way to set the program to automatically open at the top of the screen instead of the middle?

Get The Screen Position Of The Cursor
Hi

I am trying to find a way to make the mouse cursor move to the keyboard cursor position in an application. For example, I use an application called Enterprise Guide, and I control this application using Dragon naturally speaking as I have a disability that makes using the keyboard quite difficult.

I often have to say the name of an object to make to be the active or highlighted object. However to do something such as drag and drop in Dragon NaturallySpeaking , I need to have the mouse at the same position that I want to drag from.

I know there are functions such as GetCursorPos - but this appears only to work in terms of the mouse position. What I would like to do is to find the coordinates of the current active highlighted object. An example of this could be, in windows explorer, if your mouse position is on the right-hand side of your screen, but you have a folder highlighted in the left pane. How could you move the mouse cursor to the location where the highlighted object is?

I would appreciate any suggestions, or any links to any sites that may assist me.

Thank you for your help

Doug

How To Position The VB Exe At The Center Of The Screen Always?
Dear All,

When I double click an VB exe, I want the form EXE should always appear at the center of the screen rather than randomly appear each time when I click the exe to lauch the application.
I 've tried form layout window to position the screen center. But first few times it looks ok, if I close and open the same exe for a couple of times, its postition started moving diagnally down little bit and starting from left top again.

Please advise me for the above issue.

Regrads
N.Surendran

Screen Position Of The InputBox
I'm using VB6 Prof. When you call the InputBox it appears centered in the screen but it covers part of my Control Array of Check Boxes, making it difficult for the user to see just what to select. Is there any way to move this InputBox Down into the lower right hand section of the screen? If I could changel the "Top" and "Left" properties it would do it. Thanks in advance for any help. JungleJim.

Control Position On Screen
Any fast way to find a controls screen position other then getting the Left value of each parent all the way down to the form?

I want to replace the pixels in my picture box with the pixels of the DesktopDC but i gotta figure out the pixel position.

Mouse Position In Screen
(1) I need to detect mouse position on the screen.

(2) I also need to find out whether you are dragging the mouse.

I guess you need to use a API function for that.

Can u tell me how this is done……

Janaka.

HELP! Check For A Programs Position On Screen
how can i run a check as my main form is moved to see if it is within 50 pixels away from the left side of the screen and as you move it if it is, then make it jump or dock to the left side?

i also need it to dock to the top and right of the screen but i think i can figure those out once i learn how to check while i'm moving th form.

the only way i can think of is by using a timer but is there any other way?

Get Screen Coords Of Caret Position In RTB
Looks like they don't have that (GetCaretPos) API there anymore...
Do you have another link?

Get Screen Coords Of Caret Position In RTB
Hi all,

Does anyone know how to do this.. I'm not talking about the screen coordinates of the mouse in the RTB, thats easy.. but the current screen coordinates of the caret where the user is typing..

Thanks,

FreakOz.

Change Msgbox Screen Position?
app x has a messagebox which pops up from items in an array, each time. user then locates the entity, and modified it, then hit's ok in msgbox, which goes to the next entity, and so on. well the user, has to move the message box, to work on the creen- is there a way to position a message box on show, like you position a form?

Saving A Forms Screen Position
Hi again...

I would like to save my forms position after the user has re-positioned it and then to have it load next time my program is run.

I have tried saving the forms position in Form_terminate as a .dat file
but the position that keeps getting written to the file is the forms top and left as stated at design time in the form properties.

is there a 'form move' event that i can code ??

Any help will be muchos appreciated..

TIA.
Osk.

Detecting Mouse Position On The Screen
I would like to show my form if the mouse moves to the top corner of the screen. Is this possible? If so How? Thanks for any replies

Common Dialogue Screen Position
I am using the API method as described by John Percival on the vb-search site. I want to position the common dialogue box in the center of the screen as opposed to the top left corner of the screen. Does anyone know of a parameter to allow me to accomplish this goal? How can I control where the box appears on the screen?

Thanks,
Brian

Window Position Vs Screen Size
I'm using the SetWindowPos API to open an instance of Word exactly the same size as a control on my form and in exactly the same place as that control (don't ask me why - odd users...). Problem is, I have to apply different factors depending on the screen resolution. For example, this factor of 12 works with my resolution of 1280*1024 and large fonts:

VB Code:
Option Explicit Private Declare Function SetWindowPos Lib "user32" _    (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _        ByVal x As Long, ByVal y As Long, ByVal cx As Long, _        ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" _    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub cmdWord_Click()        Dim blnAlreadyOpen As Boolean    Dim lngHWnd As Long    Dim appWord As Word.Application        Const klngHwndTopmost = -1    Const klngHwndNoTopmost = -2    Const klngSwpNoActivate = &H10    Const klngSwpShowWindow = &H40    Const klngLEFT_ADJUST As Long = 50    Const klngTOP_ADJUST As Long = 335    Const klngFACTOR As Long = 12        '# If Word is already open, refer to it; otherwise open it    blnAlreadyOpen = (FindWindow("OpusApp", vbNullString) <> 0)    If blnAlreadyOpen Then        Set appWord = GetObject(, "Word.Application")    Else        Set appWord = CreateObject("Word.Application")    End If        '# Get the handle of the Word instance    lngHWnd = FindWindow("OpusApp", vbNullString)        '# Set the position and activate it    SetWindowPos lngHWnd, klngHwndNoTopmost, _        (Me.Left + txtSizeTest.Left + klngLEFT_ADJUST) / klngFACTOR, _        (Me.Top + txtSizeTest.Top + klngTOP_ADJUST) / klngFACTOR, _        txtSizeTest.Width / klngFACTOR, txtSizeTest.Height / klngFACTOR, _        klngSwpNoActivate Or klngSwpShowWindow    appWord.Visible = True    appWord.Activate End Sub
... but it doesn't work when I reduce it to 800*600 with small fonts - Word is too large when it opens.

Any idea how to find out the resolution and adjust for it?

Thanks...

How To Arrange Position Windows In The Screen?
i have to arrange a lot of .exe files in the screen so as to send mouse click..how do i accomplish it..plus its a redistributable program that i am building..now i want it to work with every screen size..is there a way to do it ?

Change Screen Position Of Msgbox
hi, the subject says it all:

i would like to be able to specify where on the screen a msgbox will appear (namely top centre)

thanks

How To Got A X &amp; Y Position At The Screen And S309PictureBox Question???
Could anyone help me, cause I am losing to much time to finding a solution to got a X and Y position on th pocket PC screen.
And how can I put another object(ex: icon) on the frontground of the S309picturebox, because no matter what I put it's always stay behind/background of the picture, so I can not see the icon or textbox.

Thank u

Position Of Picture Box In A Windows Screen
Help me friends,
i have a problem, how to get coordinate X & Y in pixel scale of our object controls such as form or picture box. I want to know where top & left properties of picture box in our windows screen.
Our screen can be in different resolution.

Calender View Control Position On Screen
Hi All

I click a number of buttons to open a calender view

Can anyone tell me how to get my calender view to always open next to the button i pressed to open it

thanks

Gibbo

Returning Screen Position Of Objects In Pixels...
how do i return the position of an object in pixels instead of twips?

'click' On Button Based On Screen Position
is there vb code where after setting the focus on a window i can then 'click' on an X/Y screen coordinate position?

Resetting Image Position When It Reaches End Of The Screen?
I was wondering how I would reset the images position to 0 when it reaches the edge of the screen. I tried this:

VB Code:
If bomb_yellow.Left = 3480 Thenbomb_yellow.Left = 0End If

3840 is the furthest position on the screen. Am I on the right track even?

Initial Startup Screen Size/position?
hi,

I've been running into this problem every once in awhile with my end-users.

The problem has to do with the screen size of my application the first time they launch it. I do save the last screen size and location upon exiting the program, but when they run the program for the first time, it obviously runs with the settings that were saved when I compiled the program.

I am using a 21" monitor with a 1024x768 resolution. I usually just make the main window small enough to view everything and keep it in the center of my screen when I compile it. But I guess customers with smaller screens or lower resolution are saying that my program is off to the far right of their screen when they first start it up.

So I guess my question is, what is the standard/accepted practice for the window size and position when you compile your programs?

Any help would be appreciated..

Dan

How To Use VB6.0 To Make A Tray (the Position At The Screen Right Botton)
I want to make its ico in the tray.
how can i do?
please help me.

How Can I Obtain The Screen Position Of A Webbrowser Element?
I have one element of the webbrowser document, an I need to draw the border of this element in the screen so I need know its position. How can I do in Visual Basic?

Thanks

Finding All Links Absolute Position X,Y Relatively To The Screen In VB6 WebBrowser
Finding all links absolute position X,Y relatively to the screen in VB6 WebBrowser
There is a Visual Basic 6 application with WebBrowser in it.
This application is about statistical information on what html tags were loaded, where they are being located - it's position X,Y

For example I want to find Document.getelementsbytagname("a") link and anchor position on the screen, how do I do it?
There is example in JS, that I could inject into webpage by scriptcontrol but could I do in in VB6 itself?
function getElementPosition(elemId)
{
var elem = document.getElementById(elemId);

var w = elem.offsetWidth;
var h = elem.offsetHeight;

var l = 0;
var t = 0;

while (elem)
{
l += elem.offsetLeft;
t += elem.offsetTop;
elem = elem.offsetParent;
}

return {"left":l, "top":t, "width": w, "height":h};
}

Trying by vb6 in webbrowser

Dim WithEvents doc As HTMLDocument
Dim elem As IHTMLElement
Set doc = ie.document

For x = 0 To doc.getElementsByTagName("a").length - 1

Set elem = doc.getElementsByTagName("a")(x)


I want convert this nonsense
'"-PParent=" & elem.offsetParent.offsetParent.tagName & "=" & elem.offsetParent.offsetParent.id & _
'"-3Parent=" & elem.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.id

To while loop, but I can't figure it out how

While (TypeOf elem Is IHTMLElement)
parentall = "-Parent Tag=" & elem.offsetParent.tagName & _
elem.id & ",l=" & elem.offsetLeft & ";t=" & elem.offsetTop & _
Set elem = elem.offsetParent
Wend

Next x

Finding All Links Absolute Position X,Y Relatively To The Screen In VB6 WebBrowser
Finding all links absolute position X,Y relatively to the screen in VB6 WebBrowser
There is a Visual Basic 6 application with WebBrowser in it.
This application is about statistical information on what html tags were loaded, where they are being located - it's position X,Y

For example I want to find Document.getelementsbytagname("a") link and anchor position on the screen, how do I do it?
There is example in JS, that I could inject into webpage by scriptcontrol but could I do in in VB6 itself?
function getElementPosition(elemId)
{
var elem = document.getElementById(elemId);

var w = elem.offsetWidth;
var h = elem.offsetHeight;

var l = 0;
var t = 0;

while (elem)
{
l += elem.offsetLeft;
t += elem.offsetTop;
elem = elem.offsetParent;
}

return {"left":l, "top":t, "width": w, "height":h};
}

Trying by vb6 in webbrowser

Dim WithEvents doc As HTMLDocument
Dim elem As IHTMLElement
Set doc = ie.document

For x = 0 To doc.getElementsByTagName("a").length - 1

Set elem = doc.getElementsByTagName("a")(x)


I want convert this nonsense
'"-PParent=" & elem.offsetParent.offsetParent.tagName & "=" & elem.offsetParent.offsetParent.id & _
'"-3Parent=" & elem.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.id

To while loop, but I can't figure it out how

While (TypeOf elem Is IHTMLElement)
parentall = "-Parent Tag=" & elem.offsetParent.tagName & _
elem.id & ",l=" & elem.offsetLeft & ";t=" & elem.offsetTop & _
Set elem = elem.offsetParent
Wend

Next x

Finding All Links Absolute Position X,Y Relatively To The Screen In VB6 WebBrowser
Finding all links absolute position X,Y relatively to the screen in VB6 WebBrowser
There is a Visual Basic 6 application with WebBrowser in it.
This application is about statistical information on what html tags were loaded, where they are being located - it's position X,Y

For example I want to find Document.getelementsbytagname("a") link and anchor position on the screen, how do I do it?
There is example in JS, that I could inject into webpage by scriptcontrol but could I do in in VB6 itself?
function getElementPosition(elemId)
{
    var elem = document.getElementById(elemId);
    
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
    
    var l = 0;
    var t = 0;
    
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return {"left":l, "top":t, "width": w, "height":h};
}

Trying by vb6 in webbrowser

Dim WithEvents doc As HTMLDocument
Dim elem As IHTMLElement
Set doc = ie.document

For x = 0 To doc.getElementsByTagName("a").length - 1

Set elem = doc.getElementsByTagName("a")(x)


I want convert this nonsense
'"-PParent=" & elem.offsetParent.offsetParent.tagName & "=" & elem.offsetParent.offsetParent.id & _
'"-3Parent=" & elem.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.tagName & _
'"-4Parent=" & elem.offsetParent.offsetParent.offsetParent.offsetParent.id

To while loop, but I can't figure it out how

While (TypeOf elem Is IHTMLElement)
parentall = "-Parent Tag=" & elem.offsetParent.tagName & _
elem.id & ",l=" & elem.offsetLeft & ";t=" & elem.offsetTop & _
Set elem = elem.offsetParent
Wend

Next x

Dock Form To Screen, Reserve Screen Space
Dear all,

I've searched and searched all over the Internet. I've posted messages in newsgroups and only gotten responses that basically tell me how to do the opposite of what I want while also suggesting that I should want to do it their way instead of mine.

This is what I want:

I want my application to "dock" to the top of the screen. It should become reserved space so that all other windows, when maximized, will only reach the bottom of my application.

I do NOT want it to "auto-hide"
I do NOT want the user to be able to "move" or "relocate" it to a different side of the screen.
I do NOT want the user to be able to "undock" it

Every sample or answer I can find is a way to do it with all the things I said I DON'T want, and all the code I have to pick through has been confusing me. I cannot find what I need to just dock the application upon loading and leave it there until exit.

I've been playing around with the sample application called "AppBar" which I think came from MSDN or from somewhere on the Internet, but that application starts off floating and you have to dock it yourself. I cannot manage to pick out the functionality of just docking it and leaving it there.

Help, please!
Thanks.
Dan

Form Position To Registry On Form Minimize
My app was saving the form position to the registry when you closed the form, but what I also wanted to have was the form position saved to the registry when it gets minimized, so that when you click the icon in the system tray, it gets put back right where it was before it was sent to the tray.

Because I don't know of a way to capture the minimize button being clicked, my solution was to stick the code saving form size and position in both the Form_Resize and the Form_MouseUp events.

It works, but I don't like the thought of constantly saving to the hard drive the whole time the form is being moved or resized.

Is there a better way (can I just save it before the minimize happens) or am I just being way too obsessive?

Position Form Over Another Form At Precise Location
I have 2 forms -

Form1 calls the second form, Form2
I'm trying to position the second form at the exact location of the caret. I already have that position using GetCaretPos api. Only problem is that the form does not position itself at the location I have given. Any ideas why?

partial code below:


VB Code:
' here is the caret position retreived    GetCaretPos pt    XPos = pt.x    YPos = pt.y      ' call this first   SetParent Form2.hwnd, Form1.hwnd    ' tell the form where to move   Form2.Move XPos, YPos    ' telling form that Main form is the parent   Form2.Show vbModal, Form1


FYI -

It seems if I make a call to SetParent api - it works as expected...

How? Intercept Output To Screen From 3rd Party Apps Or Find "real" Cursor Position
I am trying to automate a process (with 3rd party app) using VB 5.0.

I would like to be able to determine either:

The location of the cursor in the app window (not the mouse position!)

or

scrape the app screen text for a particular value. Any Ideas?

Any help would be greatly appreciated

Noel Devost
Senior Programmer/Systems Analyst
Sudbury Regional Hospital Corp
ndevost@hrsrh.on.ca

Copyright © 2005-08 www.BigResource.com, All rights reserved