Skip to content
⌘ NSIS Forum Archive

Get X/Y coordinates of install screen

5 posts

scubanarc#

Get X/Y coordinates of install screen

Hey Guys,

I've been searching for a couple of days on how to do this and have finally gave in and am asking for help.

I need to get the top-left or bottom-left x/y coordinates of the currently shown NSIS window. I'm supposed to pass these values through the registry to another application that is going to pop up at install-time and I want it to pop at the exact same location.

Any thoughts here?

- jason
MSG#
You need to call GetWindowRect using the system plugin.
Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.


Example: http://forums.winamp.com/showthread....75#post2688175
scubanarc#
Hey MSG, thanks for the reply. This helps a lot. If you could help me understand the mechanics of this a little bit I'd appreciate it.

Originally Posted by MSG View Post
        nxs::getWindow /NOUNLOAD
        Pop $1  ;(now contains the HWND of the nxs window)
        System::Alloc 16
        Pop $2
        System::Call "user32::GetWindowRect(i r1, i r2)"
        System::Call "*$2(i .r3, i .r4, i, i)"
        System::Free $2
        IntOp $4 $4 + 20
        System::Call 'User32::SetWindowPos(i $1, i $1, i $3, i $4, i 0, i 0, i 5)' 
I understand everything up to this line:

        System::Call "*$2(i .r3, i .r4, i, i)" 
What does *$2 mean and what does that line accomplish?

Also, I get that the lpRECT structure contains the values I want, but I don't understand how to get those values out.

- jason
Anders#
* means struct syntax, *$2 means access struct at memory address stored in $2 and i.r# (type input output, . (dot) means no input) extracts the first two INT32 fields in the RECT struct...
scubanarc#
Thank you very much for your help. I was able to get the values and use them with this example.

- jason