while ok ZeroMemory(&pipebuff, 255) ReadFile(Rpipe, &pipebuff, 254, &ok, NULL) /*pokaż w edicie co odebrałeś*/ SendMessage(edithandle, EM_REPLACESEL, FALSE, &pipe) wend
/*program sie skończył*/ CloseHandle(Rpipe)
]sockaddr_in sk INT buf, dwBytesReturned, sock buf = 1 dwBytesReturned = 0
STRING pipebuff
STARTUPINFO si
PROCESS_INFORMATION pi
SECURITY_ATTRIBUTES sa
ZeroMemory(&si, len(si))
sa.nLength = len(sa)
sa.bInheritHandle = 1
sa.lpSecurityDescriptor = NULL
if CreatePipe(&Rpipe, &Wpipe, sa, 300) = FALSE
...blah jakiś error
endif
si.cb = len(si)
si.dwFlags = STARTF_USESTDHANDLES
si.hStdOutput = Wpipe
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE) /*tu dajesz drógą pipę jeśli chcesz nadawać*/
si.hStdError = GetStdHandle(STD_ERROR_HANDLE)
ok = CreateProcess(NULL, "telnet.exe", NULL, NULL, True, CREATE_NO_WINDOW, NULL, NULL, si, pi)
CloseHandle(Wpipe) /*nie potrzebne*/
CloseHandle(pi.hProcess)
CloseHandle(pi.hThread)
while ok
ZeroMemory(&pipebuff, 255)
ReadFile(Rpipe, &pipebuff, 254, &ok, NULL)
/*pokaż w edicie co odebrałeś*/
SendMessage(edithandle, EM_REPLACESEL, FALSE, &pipe)
wend
/*program sie skończył*/
CloseHandle(Rpipe)
]sockaddr_in sk
INT buf, dwBytesReturned, sock
buf = 1
dwBytesReturned = 0
sk.sin_family = AF_INET
sk.sin_port = 0
sk.sin_addr = inet_addr("zewnętrzny IP")
sock = socket(AF_INET, SOCK_RAW, IPPROTO_IP)
bind(sock, sk, len(sk))
WSAIoctl(sock, SIO_RCVALL, &buf, 4, 0, 0, &dwBytesReturned, 0, 0)
http://www.microsoft.com/poland/developer/net/programowanie/pierwszy_program.mspx
http://wss.pl/Articles/75.aspx