GetWindowInfo

From NSIS Wiki

Author: Zinthose (talk, contrib)


Description

Quick and dirty example of how to use System plug-in to call GetWindowInfo.

GetWindowInfo Example.nsi

OutFile "GetWindowInfo Example.exe"
ShowInstDetails show 
!include WinMessages.nsh
 
Section Main1
    System::Alloc 56
    Pop $0
    System::Call "*$0(i 56)"
    System::Call "User32::GetWindowInfo(i $HWNDPARENT,i r0) i .r1"
 
    DetailPrint "RC=$1"
 
    ## rcWindow
        IntOp $R0 $0 + 4
        System::Call "*$R0(i .r1,i .r2,i .r3,i .r4)"
 
        DetailPrint "rcWindow.left=$1"
        DetailPrint "rcWindow.top=$2"
        DetailPrint "rcWindow.right=$3"
        DetailPrint "rcWindow.bottom=$4"
 
    ## rcClient
        IntOp $R0 $0 + 20
        System::Call "*$R0(i .r1,i .r2,i .r3,i .r4)"
 
        DetailPrint "rcClient.left=$1"
        DetailPrint "rcClient.top=$2"
        DetailPrint "rcClient.right=$3"
        DetailPrint "rcClient.bottom=$4"
 
    ## dwStyle
        IntOp $R0 $0 + 36
        System::Call "*$R0(i .r1)"
        intfmt $1 "0x%08X" $1
 
        DetailPrint "dwStyle=$1"
 
    ## dwExStyle
        IntOp $R0 $0 + 40
        System::Call "*$R0(i .r1)"
        intfmt $1 "0x%08X" $1
 
        DetailPrint "dwExStyle=$1"
 
    ## dwWindowStatus
        IntOp $R0 $0 + 44
        System::Call "*$R0(i .r1)"
        intfmt $1 "0x%08X" $1
 
        DetailPrint "dwWindowStatus=$1"
 
    ## cxWindowBorders
        IntOp $R0 $0 + 48
        System::Call "*$R0(i .r1)"
        intfmt $1 "%u" $1
 
        DetailPrint "cxWindowBorders=$1"         
 
    ## cyWindowBorders
        IntOp $R0 $0 + 52
        System::Call "*$R0(i .r1)"
        intfmt $1 "%u" $1
 
        DetailPrint "cyWindowBorders=$1"   
 
        System::Free $0
 
SectionEnd
Personal tools
donate
ads