Sign in to follow this  
Followers 0
lsakizada

Capturing HTTP Post date

5 posts in this topic

I already posted my question on the wrong forum here but have not got helpful answer yet.

http://www.autoitscript.com/forum/index.ph...mp;#entry219155

Can some one help me to simulate little tool that can simulate 2 things:

1. Capturing the URL and the data that posted with the HTTP POST method especially(not the GET).

2. Send via small utility HTTP POST method with the url and the data above.

I welcome any help

Thanks!


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites



I already posted my question on the wrong forum here but have not got helpful answer yet.

http://www.autoitscript.com/forum/index.ph...mp;#entry219155

Can some one help me to simulate little tool that can simulate 2 things:

1. Capturing the URL and the data that posted with the HTTP POST method especially(not the GET).

2. Send via small utility HTTP POST method with the url and the data above.

I welcome any help

Thanks!

You can simulate it yourself with IE.au3 (look it up in search). If you have problems, post the code that you've at least tried and failed at, and most of us will be glad to help. If you're just looking for someone to write the code for you, try here.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well.. I do not need somone to code for me.

just help to direct me on the functions that will be usefull for me.

You mentioned IE.au3, I am looking at it but still need a simple example or direction which method will be suitable for the HTTP post method.


Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Well.. I do not need somone to code for me.

just help to direct me on the functions that will be usefull for me.

You mentioned IE.au3, I am looking at it but still need a simple example or direction which method will be suitable for the HTTP post method.

Wow, your looking at those functions, like I'm looking at you're request... both are probably greek. Post what? Where? How?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Here is what I have so far.

little explanation: This file send url to servlet with some data and variables.

The "_INetGetSource" used to capture the response but it also send the URL via the GET method.

My problem is to send request to server with POST method.

Can you point me what modification should I implement???

I included two files which are needed to run this testing utility. all otheres are included with the beta.

#include <GuiConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#Include <GuiList.au3>
#include <GuiCombo.au3>
#Include "CommonFunctions.au3"
#Include <Date.au3>
#include "IE.au3"
#include <INet.au3>

Global $control

FileDelete(@TempDir & "\au3.txt")
Opt("OnExitFunc", "endscript")
$maingui = GUICreate("CBC-Manager - HTTP Client Test." , 500, 500)
DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $maingui, "int", 1000, "long", 0x00080000);fade-in
GUISetState()
GUISetFont(9, 400, -1, "MS Sans Serif")
; Status pannel
GUICtrlCreateLabel("Status: ", 0, 485, 80, 15, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetColor(-1,0xff2200)
$vStatus =  GUICtrlCreateLabel("", 85, 485, 60, 15, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetColor(-1,0xff2200)
$Status = GUICtrlCreateLabel("", 150, 485, 345, 15, $SS_SUNKEN + $SS_LEFT)
GUICtrlSetColor(-1,0xff2200)
GUISetState()
; IP and Port boxes
GUICtrlCreateGroup('IP and Port', 3, 10, 245, 75)
;$handle = _GUICtrlCreateSysIP($maingui, 10, 30)
;$IP = _GUICtrlSysIPGetData($handle)
$hClrIPBtn = GUICtrlCreateButton("Clear IP", 140, 25, 100,17, $BS_FLAT)
$hGetClientIPBtn = GUICtrlCreateButton("Client IP", 140, 45, 100, 17, $BS_FLAT)

$IPBOX = GUICtrlCreateInput("", 10, 30, 120,19)

GUISetState()
GUICtrlCreateLabel("Port: ", 10, 55, 50, 20, $SS_SUNKEN + $SS_CENTER)
$InputPort = GUICtrlCreateInput("8080", 65, 55, 40, 20)
GUISetState()
; User and Password boxes
GUICtrlCreateGroup('Authentication', 256, 10, 222, 75)
GUICtrlCreateLabel("User: ", 260, 30, 50, 20, $SS_SUNKEN + $SS_CENTER)
GUICtrlCreateLabel("Pass: ", 260, 55, 50, 20, $SS_SUNKEN + $SS_CENTER)
$InputUser = GUICtrlCreateInput("CellTick", 320, 30, 140, 20)
$InputPassword = GUICtrlCreateInput("Celltick97",  320, 55, 140, 20, $ES_PASSWORD)
$GroupDCS = GuiCtrlCreateGroup("DCS", 10, 100, 80, 50)
$InputDCS = GuiCtrlCreateInput("2", 20, 120, 60, 20)
$GroupRepetition= GuiCtrlCreateGroup("Repetition", 100, 100, 50, 50)
$InputRepetition = GuiCtrlCreateInput("2", 110, 120, 35, 20)
$GroupMessageId = GuiCtrlCreateGroup("Last MessID", 180, 100, 70, 50)
$InputMessageId = GuiCtrlCreateInput("", 190, 120, 50, 20)
$GroupMessIdentifier = GuiCtrlCreateGroup("Mes.Ident", 260, 100, 70, 50)
$InputMessIdentifier = GuiCtrlCreateInput("100", 270, 120, 50, 20)
$GroupStations = GuiCtrlCreateGroup("Stations", 340, 100, 140, 50)
$InputStations = GuiCtrlCreateInput("station_bsc_", 350, 120, 120, 20)
$GroupText = GuiCtrlCreateGroup("Text", 10, 160, 470, 50)
$InputText = GuiCtrlCreateInput("This is an HTTP test", 20, 180, 450, 20)
$GroupStartDate = GuiCtrlCreateGroup("Start Date", 10, 210, 190, 220)
$DateStartDate = GUICtrlCreateMonthCal("Date4", 20, 230, 175, 140)
$InputStartDate = GuiCtrlCreateInput("", 20, 380, 170, 20)
$InputStartTime = GuiCtrlCreateInput("", 99, 405, 90, 20)
$GroupEndDate = GuiCtrlCreateGroup("End Date", 288, 210, 190, 220)
$DateEndDate = GUICtrlCreateMonthCal("Date6", 298, 230, 175, 140)
$InputEndDate = GuiCtrlCreateInput("", 298, 380, 170, 20)
$InputEndTime = GuiCtrlCreateInput("", 379, 405, 90, 20)
$ButtonSetDates = GuiCtrlCreateButton("Set Dates", 210, 218, 70, 20,  $BS_FLAT)
$LabelSetTime1 = GuiCtrlCreateLabel("Time: ", 20, 405, 50, 20,$SS_SUNKEN + $SS_CENTER)
$LabelSetTime2 = GuiCtrlCreateLabel("Time: ", 298, 405, 50, 20, $SS_SUNKEN + $SS_CENTER)
global $GroupActionType
$GroupActionType = GuiCtrlCreateGroup("Action Type", 10, 430, 160, 50)
$ComboActionType = GuiCtrlCreateCombo("submitMessage", 20, 450, 130, 100)
GUICtrlSetData(-1,"updateMessage|killMessage","submitMessage")
$ButtonRun = GuiCtrlCreateButton("Run", 420, 450, 60, 20, $BS_FLAT)
$Run_killIE = GuiCtrlCreateButton("Delete IE", 211, 305, 70, 20, $BS_FLAT)
$ButtonViewLog = GuiCtrlCreateButton("Response",210, 245, 70, 20, $BS_FLAT)
$ButtonViewAllLog = GuiCtrlCreateButton("All Trans.",210, 275, 70, 20,  $BS_FLAT)
$btnViewURL = GuiCtrlCreateButton("View URLs", 211, 335, 70, 20, $BS_FLAT)
$control =GUICtrlRead($ComboActionType )
onload()
while 1
$msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE ;Or $msg = $Exit_btn
            Exit
        Case $msg = $ButtonSetDates
              GUICtrlSetData ( $InputStartDate,  _DateTimeFormat( GUICtrlRead($DateStartDate), 2))
             GUICtrlSetData ( $InputEndDate,  _DateTimeFormat( GUICtrlRead($DateEndDate), 2))
         Case $msg = $ButtonViewLog
                     view("log.log")
         Case $msg = $ButtonViewAllLog
                    view("ExecutionLog.log")
        Case $msg = $btnViewURL
                    view("URLs.log")
        Case $msg = $hGetClientIPBtn
            ;_GUICtrlSysIPSetData($handle, @IPAddress1)
            
            GUICtrlSetData($IPBOX,  @IPAddress1)
        Case $msg = $hClrIPBtn
           ; _GUICtrlSysIPClear($handle)         
           
           GUICtrlSetData($IPBOX, "")
        Case $msg = $ComboActionType
                ;   EnableDiasableCtrl()
            $control =GUICtrlRead($ComboActionType )  ;keep the combo data
                EnableDiasableCtrl($control)
            Case $msg = $ButtonRun
                
                GUICtrlSetData($Status,  "")
                GUICtrlSetData($vStatus,  "")
                
             $URL = MakeURL(GUICtrlRead($ComboActionType))
             $o_IE = _IECreate ()
             $logger = _INetGetSource($URL)
            
            if $logger <> "" Then
                
                If FileExists(@ScriptDir & "\log.log") Then
                    FileDelete ( @ScriptDir & "\log.log" )
                Else
                    ; do nothing            
                EndIf
                
                _FileWriteLog(@ScriptDir & "\ExecutionLog.log",$logger)
                sleep(100)  
                _FileWriteLog(@ScriptDir & "\URLs.log",$URL)    
                sleep(100)          
                _FileWriteLog(@ScriptDir & "\log.log",$logger)
                sleep(100)
                        
                    Select 
                         Case $control =  "submitMessage"
                            GUICtrlSetData ( 22,  GetMessageID(4, @ScriptDir & "\log.log") )
                            GUICtrlSetData ( 4,  GetMessageID(12, @ScriptDir & "\log.log") )
                            GUICtrlSetData ( 5, GetDescription(13, @ScriptDir & "\log.log") )
                        Case  $control = "updateMessage"
                                           
                         GUICtrlSetData ( 5, GetDescription(7, @ScriptDir & "\log.log") )
                      Case else
                       GUICtrlSetData ( 5, GetDescription(6, @ScriptDir & "\log.log") )
                EndSelect
            else
                MsgBox(0, "Error","Please Enter Valid IP Address.")
            endif
            
        Case $msg = $Run_killIE
        
        $confirm =  MsgBox(4100, "Delete All IEExplorer.exe", "Are you sure you want to delete all IEExplorer.exe")
        if $confirm = 6 Then
            $list = ProcessList("IExplore.exe")
            for $i = 1 to $list[0][0]
                ProcessClose($list[$i][1])
            next
        if $list > 0 then
                MsgBox(262208,"Success Deletion of IEExplorer Sessions", "All IEExplorer.exe Sessions deleted.   ",2)
            endif
        endif   
        
       Case else
    EndSelect
WEnd

Func onload()
   ; _GUICtrlSysIPSetData($handle, @IPAddress1)
   GUICtrlSetData($IPBOX,  @IPAddress1)
    GUICtrlSetData ( $InputStartDate,  _DateTimeFormat( GUICtrlRead($DateStartDate), 2))
    GUICtrlSetData ( $InputEndDate,  _DateTimeFormat( GUICtrlRead($DateEndDate), 2))
    GUICtrlSetData ( $InputStartTime,  "12:00:00")
    GUICtrlSetData ( $InputEndTime,  "13:00:00")
    GUICtrlSetState ( 22, $GUI_DISABLE )
EndFunc

Func MakeURL ($act)
    Local $str
    Select
        Case $act = "submitMessage"
                    
            $str = "http://" & GUICtrlRead ($IPBOX) & ":" & GUICtrlRead($InputPort)
            $str = $str & "/MyComp/servlet/cbc?"
            $str = $str & "actType=" & GUICtrlRead($ComboActionType) & "&"
            $str = $str & "user=" & GUICtrlRead($InputUser) & "&"
            $str = $str & "password=" & GUICtrlRead($InputPassword) & "&"
            $str = $str & "dcs=" & GUICtrlRead($InputDCS) & "&"
            $str = $str & "repetitionRate=" & GUICtrlRead($InputRepetition) & "&"
            ;$str = $str & "messageId=" & GUICtrlRead($InputMessageId) & "&"
            $str = $str & "messageIdetifier=" & GUICtrlRead($InputMessIdentifier) & "&"
            $str = $str & "stations=" & GUICtrlRead($InputStations) & "&"
            $str = $str & "startTime=" & GUICtrlRead($InputStartDate) & Chr(32) & GUICtrlRead($InputStartTime) & "&"
            $str = $str & "endTime=" & GUICtrlRead( $InputEndDate) & Chr(32) &GUICtrlRead($InputEndTime) & "&"
            $str = $str & "text=" & GUICtrlRead($InputText)
        
    Case $act = "updateMessage"
                    
            $str = "http://" & GUICtrlRead ($IPBOX) & ":" & GUICtrlRead($InputPort)
            $str = $str & "/celltick/servlet/cbc?"
            $str = $str & "actType=" & GUICtrlRead($ComboActionType) & "&"
            $str = $str & "user=" & GUICtrlRead($InputUser) & "&"
            $str = $str & "password=" & GUICtrlRead($InputPassword) & "&"
            ;$str = $str & "dcs=" & GUICtrlRead($InputDCS) & "&"
            ;$str = $str & "repetitionRate=" & GUICtrlRead($InputRepetition) & "&"
            $str = $str & "messageId=" & GUICtrlRead($InputMessageId) & "&"
            ;$str = $str & "messageIdetifier=" & GUICtrlRead($InputMessIdentifier) & "&"
            ;$str = $str & "stations=" & GUICtrlRead($InputStations) & "&"
            ;$str = $str & "startTime=" & GUICtrlRead($InputStartDate) & Chr(32) & GUICtrlRead($InputStartTime) & "&"
            ;$str = $str & "endTime=" & GUICtrlRead( $InputEndDate) & Chr(32) &GUICtrlRead($InputEndTime) & "&"
            $str = $str & "text=" & GUICtrlRead($InputText)
        
        Case $act = "killMessage"
        ;   $str = "http://" & _GUICtrlSysIPGetData($handle) & ":" & GUICtrlRead($InputPort)
            
            $str = "http://" & GUICtrlRead ($IPBOX) & ":" & GUICtrlRead($InputPort)
            
            
            $str = $str & "/celltick/servlet/cbc?"
            $str = $str & "actType=" & GUICtrlRead($ComboActionType) & "&"
            $str = $str & "user=" & GUICtrlRead($InputUser) & "&"
            $str = $str & "password=" & GUICtrlRead($InputPassword) & "&"
            ;$str = $str & "dcs=" & GUICtrlRead($InputDCS) & "&"
            ;$str = $str & "repetitionRate=" & GUICtrlRead($InputRepetition) & "&"
            $str = $str & "messageId=" & GUICtrlRead($InputMessageId) ;& "&"
            ;$str = $str & "messageIdetifier=" & GUICtrlRead($InputMessIdentifier) & "&"
            ;$str = $str & "stations=" & GUICtrlRead($InputStations) & "&"
            ;$str = $str & "startTime=" & GUICtrlRead($InputStartDate) & Chr(32) & GUICtrlRead($InputStartTime) & "&"
            ;$str = $str & "endTime=" & GUICtrlRead( $InputEndDate) & Chr(32) &GUICtrlRead($InputEndTime) & "&"
            ;$str = $str & "text=" & GUICtrlRead($InputText)
            Case Else
    EndSelect
    
    return $str
EndFunc

func GetMessageID ($linenumber, $LogName)
    dim $asResult
    Dim $aRecords
    If Not _FileReadToArray($LogName,$aRecords) Then
       MsgBox(4096,"Error", " Error reading from log file!    error :" & @error)
       Exit
    EndIf

    If @error == 0 Then
        ;MsgBox(0, "SRE Example 5 Result", $asResult[0])
         $asResult = StringRegExp($aRecords[$linenumber], '([0-9]{1,8})', 1)
        return $asResult[0]   
    Else
        MsgBox(0, "Error", "error :" & @error)
    EndIf
endfunc

func GetDescription ($linenumber, $LogName)
    dim $asResult
    Dim $aRecords
    If Not _FileReadToArray($LogName,$aRecords) Then
       MsgBox(4096,"Error", " Error reading from log file!    error :" & @error)
       Exit
    EndIf

    If @error == 0 Then
        ;MsgBox(0, "SRE Example 5 Result", $asResult[0])
         $asResult = $aRecords[$linenumber]
    return $asResult
    Else
        MsgBox(0, "Error", "error :" & @error)
    EndIf
endfunc

func EnableDiasableCtrl($control)
    Select
        Case $control="submitMessage"
            GUICtrlSetState (22, $GUI_DISABLE )
            GUICtrlSetState (18, $GUI_ENABLE )
            GUICtrlSetState (20, $GUI_ENABLE )
            GUICtrlSetState (22 ,$GUI_ENABLE )
            GUICtrlSetState (24, $GUI_ENABLE )
            GUICtrlSetState (26, $GUI_ENABLE )
            GUICtrlSetState (28, $GUI_ENABLE )
            GUICtrlSetState (31, $GUI_ENABLE )
            GUICtrlSetState (32, $GUI_ENABLE )
            GUICtrlSetState (35, $GUI_ENABLE )
            GUICtrlSetState (36, $GUI_ENABLE )
            
        Case $control="updateMessage"
            GUICtrlSetState (22, $GUI_ENABLE )
            GUICtrlSetState (28, $GUI_ENABLE )
            GUICtrlSetState (18, $GUI_DISABLE )
            GUICtrlSetState (20, $GUI_DISABLE )
            GUICtrlSetState (24, $GUI_DISABLE )
            GUICtrlSetState (26, $GUI_DISABLE )
            GUICtrlSetState (31, $GUI_DISABLE )
            GUICtrlSetState (32, $GUI_DISABLE )
            GUICtrlSetState (35, $GUI_DISABLE )
            GUICtrlSetState (36, $GUI_DISABLE )

        Case $control="killMessage"
            GUICtrlSetState (22, $GUI_ENABLE )
            GUICtrlSetState (28, $GUI_DISABLE )
            GUICtrlSetState (18, $GUI_DISABLE )
            GUICtrlSetState (20, $GUI_DISABLE )
            GUICtrlSetState (24, $GUI_DISABLE )
            GUICtrlSetState (26, $GUI_DISABLE )
            GUICtrlSetState (31, $GUI_DISABLE )
            GUICtrlSetState (32, $GUI_DISABLE )
            GUICtrlSetState (35, $GUI_DISABLE )
            GUICtrlSetState (36, $GUI_DISABLE )
        Case else
    endselect
endfunc

Func view($FileName)
   
    Run("notepad.exe " & $FileName)
    WinWaitActive("")
    
EndFunc

The Commonn functions are:

#include-once
dim $IPhost , $ccase , $PUTTYPID

;func WinOnTop()
;   WinSetOnTop("Celltick - Test Script Manager", "", 1)
;;WinSetTrans ( "Celltick - Test Script Manager", "", 200)

;endfunc
func SetPutty(ByRef $PUTTYPID)
    $PUTTYPID = Run("putty" & " " & $IPhost)
    WinWait( $IPhost & " - " & "PuTTY","")
    If Not WinActive( $IPhost & " - " & "PuTTY","") Then WinActivate( $IPhost & " - " & "PuTTY","")
    WinWaitActive( $IPhost & " - " & "PuTTY","")
    return $PUTTYPID
Endfunc

func SetUserPassParam()
    Global $Password =_ReadLoginIniFile( $IPhost, "password")
    Global $UserName =_ReadLoginIniFile( $IPhost, "username")
Endfunc

func GetCommLineParam(ByRef $IPhost,ByRef $ccase)
;dim $IPhost , $ccase
;dim $NumCmdLineParams = $CmdLine[0]
    $IPhost= $CmdLine[1]; "172.17.253.61"
    $ccase= $CmdLine[2]; set the command option number
endfunc

Func _ReadLoginIniFile( $IPhostname , $data)
    Local $IniFile = @ScriptDir & "\server.ini"
    Select
        Case $data = "username"
            return IniRead ( $IniFile, $IPhostname, "username", "" )
          Case $data = "password"
            return IniRead ( $IniFile, $IPhostname, "password", "" )
    Case Else
        MsgBox(0, "", "Error Occured!")
    EndSelect
EndFunc

;===============================================================================
;
; Description:    Set valid range to given field
; Parameter(s):  Control handle, field index (1...4), lower bound, upper bound
; Return Value(s):  1 if successfull, zero otherwise
;
;===============================================================================
Func _GUICtrlSysIPSetRange($hControl, $nField, $nLower, $nUpper)
    Local $IPM_SETRANGE = 0x400 + 103
    Local $nRange = $nLower + BitShift($nUpper, -8)
    Local $ret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hControl, _
                                                "int", $IPM_SETRANGE, _
                                                "int", $nField - 1, _
                                                "int", $nRange)
    If @error or not $ret[0] Then Return 0
    Return 1
EndFunc
;===============================================================================
;
; Description:    Set focus to given field
; Parameter(s):  Control handle, field index (1...4)
;
;===============================================================================
Func _GUICtrlSysIPSetFocus($hControl, $nField = 1)
    Local $IPM_SETFOCUS = 0x400 + 104
    DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hControl, _
                                                "int", $IPM_SETFOCUS, _
                                                "int", $nField - 1, _
                                                "int", 0)
EndFunc
;===============================================================================
;
; Description:    Clear control
; Parameter(s):  Control handle
;
;===============================================================================
Func _GUICtrlSysIPClear($hControl)
    Local $IPM_CLEARADDRESS = 0x400 + 100
    DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hControl, _
                                                "int", $IPM_CLEARADDRESS, _
                                                "int", 0, _
                                                "int", 0)
EndFunc

;===============================================================================
;
; Description:    Set data to control
; Parameter(s):  Control handle, string like 127.0.0.1
; Return Value(s):  1 if successfull, zero otherwise
;
;===============================================================================
Func _GUICtrlSysIPSetData($hControl, $sData)
    Local $nIP = 0, $IPM_SETADDRESS = 0x400 + 101
    $sData = StringSplit($sData, ".")
    If UBound($sData) <> 5 Then Return 0
    For $i = 0 To 3
        $nIP = $nIP + BitShift($sData[4 - $i], -(8 * $i))
    Next
    DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hControl, _
                                                "int", $IPM_SETADDRESS, _
                                                "int", 0, _
                                                "ptr", $nIP)
    If @error Then Return 0
    Return 1
EndFunc
;===============================================================================
;
; Description:    Read data from control
; Parameter(s):  Control handle
; Return Value(s):  If successfull - string with IP, empty string otherwise
; Error(s) set:  If DllStruct or DllCall fail
;
;===============================================================================
Func _GUICtrlSysIPGetData($hControl)
    Local $IPM_GETADDRESS = 0x400 + 102
    $dwIP = DllStructCreate("ubyte;ubyte;ubyte;ubyte")
    If @error Then
        SetError(1)
        Return("")
    Endif
    DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hControl, _
                                                "int", $IPM_GETADDRESS, _
                                                "int", 0, _
                                                "ptr", DllStructGetPtr($dwIP))
    If @error Then
        SetError(2)
        Return("")
    Endif
    $ret = StringFormat("%d.%d.%d.%d", DllStructGetData($dwIP, 4), _
                                       DllStructGetData($dwIP, 3), _
                                       DllStructGetData($dwIP, 2), _
                                       DllStructGetData($dwIP, 1))
 ;DllStructDelete($dwIP)
    Return $ret
EndFunc
;===============================================================================
;
; Description:    Create  control
; Parameter(s):  Parent GUI handle, left and top coordinates, width and height
; Return Value(s):  If successfull - control handle, zero otherwise
; Error(s) set:  If DllCall fail
;
;===============================================================================
;Global  $IP            =   "0.0.0.0"
Func _GUICtrlCreateSysIP($hGUI, $nLeft, $nTop, $nWidth = 120, $nHeight = 20)
    Local $GWL_HINSTANCE = -6, $WM_SETFONT = 0x30, $DEFAULT_GUI_FONT = 0x11
    Local $hInst = DLLCall("user32.dll","long","GetWindowLong","hwnd", $hGUI, "int", $GWL_HINSTANCE)
    Local $ret = DllCall("user32.dll", "hwnd", "CreateWindowEx", _
                                       "long", 0, _
                                       "str", "SysIPAddress32", _
                                       "str", "", _
                                       "long", BitOr(0x40000000, 0x10000000), _
                                       "int", $nLeft, _
                                       "int", $nTop, _
                                       "int", $nWidth, _ 
                                       "int", $nHeight, _
                                       "hwnd", $hGUI, _
                                       "hwnd", 0, _
                                       "int", $hInst[0], _
                                       "ptr", "")
    Local $hControl = $ret[0]
    If @error Then
        SetError(1)
        Return(0)
    Endif

    $ret = DllCall("gdi32", "long", "GetStockObject", "long", $DEFAULT_GUI_FONT)
    DllCall("user32.dll", "int", "SendMessage", "hwnd", $hControl, _
                                                "int",  $WM_SETFONT, _
                                                "int",  $ret[0], _
                                                "ptr",  0)
    Return $hControl
Endfunc
Edited by lsakizada

Be Green Now or Never (BGNN)!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0