bradharding
26th November 2008 04:24 UTC
Moving nsDialogs controls?
Hi!
I was wondering if someone could please provide me with some example code that will reposition a control created using nsDialogs? I've tried using SetWindowPos and MoveWindow using the System plugin without any luck.
Any ideas?
Thanks in advance.
Brad.
kichik
27th November 2008 00:08 UTC
Something like this should do the trick:
http://nsis.sourceforge.net/Moving_i..._of_the_screen
bradharding
27th November 2008 07:09 UTC
Thanks for your help, kichik.
I've actually come across this code before, and hadn't had much luck with it. I've had another go, but am still having problems. Here's some code I've tried:
System
::Call "*(i, i, i, i) i .r1"
System::Call "User32::GetWindowRect(i, i) i (r0, r1) .r2"
System::Call "*$1(i, i, i, i) i (.r2, .r3, .r4, .r5)"
IntOp $2 $2 + 2
IntOp$3 $3 + 3
System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) b ($0, 0, $2, $3, 0, 0, ${SWP_NOOWNERZORDER}|${SWP_NOSIZE})"
$0 is the handle for the control. ${SWP_NOOWNERZORDER} and ${SWP_NOSIZE} are both defined correctly. I'm wanting the code to simply move the control 2 pixels/units to the right and 3 pixels/units down, but the control just disappears. What am I doing wrong? :confused:
Regards,
Brad.
Anders
27th November 2008 16:09 UTC
you want SWP_NOZORDER and not SWP_NOOWNERZORDER probably
bradharding
27th November 2008 20:18 UTC
Thanks for your help, Anders. But no, unfortunately, that didn't do it...
Anders
27th November 2008 20:39 UTC
are you sure you have the correct position, GetWindowRect is is screen coords, you probably want client coordinates, try calling ScreenToClient or MapWindowRect or whatever those api's are called