Marco,
One side affect of your last code is that when you attempt to resize the window/dialog it minimizes. This is unexpected to the user.
James
#include "fivewin.ch"
function main()
local oWnd
define window oWnd from -100,-100 to -99,-99
activate window oWnd on init Start()
return nil
function Start()
local oDlg
wndMain():hide()
define dialog oDlg
activate dialog oDlg center
wndMain():end()
return nil
oWnd:hide()
METHOD New( nPort, oWnd ) CLASS TSocket
DEFAULT oWnd := WndMain(), ::aSockets := {}
if Len( ::aSockets ) == 0
if WSAStartup() != 0
MsgAlert( "WSAStartup error" )
endif
endif
if ( ::nSocket := Socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) == 0
MsgAlert( "Socket creation error: " + Str( WsaGetLastError() ) )
endif
::cIPAddr = GetHostByName( GetHostName() )
::aBuffer = {}
::lSending = .f.
::lDebug = .f.
if nPort != nil
::nPort = nPort
BindToPort( ::nSocket, nPort ) // Bind is not needed for connect sockets
endif
AAdd( ::aSockets, Self )
if oWnd != nil
oWnd:bSocket = { | nSocket, nLParam | ::HandleEvent( nSocket,;
nLoWord( nLParam ), nHiWord( nLParam ) ) }
WSAAsyncSelect( ::nSocket, oWnd:hWnd, WM_ASYNCSELECT,;
nOr( FD_ACCEPT, FD_OOB, FD_READ, FD_CLOSE, FD_CONNECT, FD_WRITE ) )
else
MsgAlert( "You must create a main window in order to use a TSocket object" )
endif
return Self
//----------------------------------------------------------------------------//
It is better to ACTIVATE WINDOW oWnd HIDDEN. The window does not even flash.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 40 guests