Re: dde stuff & winsock.e

new topic     » topic index » view thread      » older message » newer message

> Asunto: Re: dde stuff & winsock.e
> If there is, no matter how complicated, i'd *really* appreciate it.

It should be really *easy*...

Add tracing to the code below.

Run the program: Should open a window with a SLE control.
Key in 127.0.0.1 and follow the program.
You will see that winsock does respond as "localhost" (if you have it
defined at the "hosts" file, or if you have a DNS on the net).
Hope this help.
Jesus.
>-----------------------------------------------8x--------------------------
----------------------------------------------------< cut here
--
-- HostInfo
--
with trace

include winsock.ew

integer response
sequence Okay, ProgName
atom errorRtn

constant
    Win     = create( Window, "Host Info", 0, Default, Default, 400, 200,
0 ),
    Sle1    = create( EditText, "", Win, 10, 40, 120, 20, 0 ),
    HostButton = create( PushButton, "Check Host...", Win, 10,100, 120, 20,
0 ),
    List1 = create( List, "", Win, 140, 10, 220, 140, 0 )

    Okay = "Everything in Wsock32 Ok."
    ProgName = "HostInfo.exw"
    SocketTrace = 0 -- Play with 0 or 1

procedure onClick_Button( integer mouseX, integer mouseY )
    integer result
    sequence HostName, IPAddress, HostDescription, Host
        Host = getText(Sle1)
    HostDescription = WsockHostInfo(Host)
--    trace(1)
        addItem(List1,HostDescription[1]&"-"&HostDescription[2])
end procedure

procedure onOpen_Win()

         integer rgbColor

        errorRtn = WsockInit()
        if errorRtn != 0 then
                Say("Error initializing Winsock.",ProgName)
                abort(1)
        end if

    -- get the button face color
    rgbColor = getSysColor( COLOR_BTNFACE )

    -- change the window color
    setWindowBackColor( Win, rgbColor )

end procedure

procedure onUnload_win()
        errorRtn = WsockRelease()
        if errorRtn != 0 then
                Say("Error releasing Winsock.",ProgName)
                abort(1)
        end if
end procedure

onClick[ HostButton ] = routine_id("onClick_Button")
onLoad[ Win ] = routine_id( "onOpen_Win" )
onUnload[ Win ] = routine_id("onUnload_Win")

WinMain( Win )
>-----------------------------------------------8x--------------------------
----------------------------------------------------< cut here

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu