コメント一覧

まえへ つぎへ
69 投稿者:名無しさん 2019/12/16 10:07:54



70 投稿者:名無しさん 2019/12/16 10:11:13

#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN #define MY_MSG (WM_USER + 1) #define MAX_RECORD 64 * 1024
#include <windows.h> #include <windowsx.h> #include <winsock2.h> #include "resource.h"
BOOL CALLBACK MYClient Proc(HWND, VINT, WPARAM, LPARAM); char szAppName[] = "5547/ "; BOOL bSocket = FALSE; //DDV HINSTANCE hinst;
int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst, LPSTR IpsCmdLine, int nCmdShow)
WSADATA wsaData;
hinst = hCurInst;
if (WSAStartup (MAKEWORD(1, 1), &wsaData) != 0) {
MessageBox(NULL, TEXT("75- 7 748"), szAppName, MB_OK);
return -1;
DialogBox(hCur Inst, TEXT("CLIENT”), NULL, (DLGPROC)MyClient Proc); if (WSACleanup() != 0) {
MessageBox(NULL, TEXT("51-7 86"), szAppName, MB_OK);
return -2;
return 0;
//ダイアログボックスのプロシージャ BOOL CALLBACK MYClient Proc(HWND hDlg, UINT msg, WPARAM wp, LPARAM Ip)
static SOCKET S; u_short port; unsigned int address; char szServer[64]; HOSTENT *|pHost Ent; BOOL bSuccess; static SOCKADDR_IN addr; int ntn, nError, nEvent; int addrlen; char szBuf [1024], szTemp[1024]; static char szAT I Buf [MAX_RECORD], szName[64]; static BOOL bFirst = TRUE; HICDN hlcon; static BOOL bSanka = FALSE;
1 COHOL TI3D2
switch (msg) { case WM_INITDIALOG:
hlcon = (HICON) LoadImage(hInst, TEXT("MYICON"), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_SHARED); SendMessage(HD18, WM_SETICON, (WPARAM) ICON_BIG, (LPARAM)hIcon); EnableWindow(GetDigItem(hD18, IDC_SENDBTN), FALSE); SendMessage(Get DigItem(hDls, IDC_INFO), EM LIMITTEXT, (WPARAM) MAX_RECORD, 0); SendMessage(GetDI&Item(hDlg, IDC_SEND), EM LIMITTEXT, (WPARAM)1024,0); return TRUE;
case MY_MSG:
nEvent = WSAGETSELECTEVENT(IP); switch (nEvent) {
case FD_READ:
addrlen = (int) sizeof (addr); nRtn = recyfrom(s, szBuf, (int)sizeof (szBuf) - 1, 0, (SOCKADDR *)&addr, &addrlen); if (nRtn == SOCKET_ERROR) {
MessageBox(hD18, TEXT("RII5-"), szAppName, MB_OK);
return TRUE;
szBuf [nRtn] = '\0'; if (strcmp(szBuf, "A 7 1054 analt=") == 0) {
bSanka = TRUE;
wsprintf(szTemp, TEXT("%s\r\n"), szBuf); strcat_s(SZALIBuf, szTemp); Set DigItemText (hD1g, IDC_INFO, SZAllBuf);
SendMessage(GetDigItem(hD1g, IDC_INFO), EMLLINESCROLL, 0, Edit_GetLineCount (GetDigItem(hDig, IDC_INFO))); if ((int)strlen(SZAI IBuf) > MAX_RECORD -1024)
MessageBox(hDlg, TEXT("/ 776UTLET"), szAppName, MB_OK); strcpy_s(szAI IBuf, ""); Set WindowText (GetDigItem(hDls, IDC_INFO), SZALIBuf);
if (strcmp(szBuf, " -/-TA1473 ") == 0) {
MessageBox(hDlg, TEXT("* $3-014 til"), SZAppName, MB_OK); EnableWindow(GetDI&Item(hDig, IDC_SENDBTN), FALSE); EnableWindow(GetDigItem(hDig, IDC_START), TRUE); SendMessage(GetDigItem(hD1g, IDC_PORT), EM_SETREADONLY, (WPARAM) FALSE, 0); SendMessage(GetDigItem(hDlg, IDC_SERVER), EM_SETREADONLY, (WPARAM)FALSE, 0); SendMessage(GetDigItem(hDlg, IDC_NAME), EM_SETREADONLY, (WPARAM) FALSE,
0);
SetFocus(GetDigItem(hD1g, IDC_START));
bFirst = TRUE;
return TRUE;
break;
return TRUE; case WM_COMMAND:
switch (LOWORD (wp)) {
case IDOK:
case IDCANCEL:
nRtn = MessageBox(hDig, TEXT("X71T+£3L11CT1"), szAppName, MB_OKCANCEL | MB_ICONQUESTION); if (nRtn == IDCANCEL) {
return TRUE;
if (bSocket) { if (bSanka) {
wsprintf(szBuf, TEXT("#%s"), szName); addrlen = (int) sizeof (addr); sendto(s, szBuf, (int)strlen(szBuf), 0, (SOCKADDR *)&addr, addrlen); bSanka = FALSE;
if (closesocket (s) != 0) {
MessageBox(hD18, TEXT("VTTO20-ZAR"), szAppName, MB_OK);
1
EndDialog(hDig, IDOK);
return TRUE;
case IDC_SENDBTN:
Get DigItemText (hDig, IDC_SEND, szBuf, sizeof (szBuf)); if (strcmp(szBuf, "") == 0) {
MessageBox(hDig, TEXT("f052anthith"), szAppName, MB_OK); return TRUE;
if (bFirst) {
wsprintf(szTemp, TEXT("!%s+%s"), szName, szBuf); strcpy_s(szBuf, szTemp);
bFirst = FALSE; } else {
wsprintf(szTemp, TEXT("%s:%s"), szName, szBuf); strcpy_s(szBuf, szTemp);
addrlen = (int) sizeof(addr);
nRtn = sendto(s, szBuf, (int)strlen(szBuf), 0, (SOCKADDR *)&addr, addrlen);
if (nRtn == SOCKET_ERROR) {
MessageBox(hDIĘ, TEXT(31E*BCT"), szAppName, MB_OK); return TRUE;
SetDigItemText (hD1g, IDC_SEND, ""); SetFocus(GetDigItem(hDig, IDC_SEND));
return TRUE;
case IDC_START:
port - (u_short)GetDigItem Int (hDlg, IDC_PORT, &Success, FALSE); if (port == 0) {
MessageBox(HD18, TEXT("fi- *EDTECT"), szAppName, MB_OK);
return TRUE; } GetDI&ItemText (hD1g, IDC_SERVER, szServer, (int)sizeof (szServer)); if (strcmp(szServer, "") == 0) {
MessageBox (hDig, TEXT("#-)1-BOTECT"), szAppName, MB_OK); return TRUE;
GetDigItemText (hDig, IDC_NAME, szName, (int)sizeof (szName)); if (strcmp(szName, "") == 0) {
MessageBox(hD18, TEXT("IDÍTETT"), szAppName, MB_OK);
return TRUE;
IpHost Ent = gethostbyname(szServer); if (IpHost Ent == NULL) {
address = inet_addr(szServer); IpHostEnt = gethostbyaddr((char *)&address, 4, AF_INET);
if (IpHostEnt == NULL) {
MessageBox(hD1g, TEXT("#-/&T
t h'), szAppName, MB_OK);
return TRUE;
memset (&addr, 0, sizeof (addr)); addr.sin port = htons(port); addr.sin family - AF_INET; addr.sin_addr.s_addr = *((unsigned long *) IpHost Ent->h_addr); S = socket (AF_INET, SOCK_DGRAM, 0);
if (s == INVALID_SOCKET) {
MessageBox(hDls, TEXT("VT+*-7712th"), szappName, MB_OK);
return TRUE;
bSocket = TRUE; notn - WSAAsyncSelect (s, hDig, MY_MSG, FD_READ | FD_WRITE);
if (nRtn == SOCKET_ERROR)
nError = WSAGet Last ErrorO;
if (nError != WSAEWOULDBLOCK) {
MessageBox (hDig, TEXT("IO closesocket(s); bSocket = FALSE;
LA"), szAppName, MB_OK);
EnableWindow(GetDigItem(hDig, IDC_START), FALSE); EnableWindow(GetDigItem(hD1g, IDC_SENDBTN), TRUE); SendMessage(GetDigItem(hDlg, IDC_PORT), EM SETREADONLY, (WPARAM) TRUE, 0); SendMessage(GetDigItem(hDig, IDC_SERVER), EM_SETREADONLY, (WPARAM) TRUE, 0); SendMessage(GetDigItem(hDig, IDC_NAME), EM_SETREADONLY, (WPARAM) TRUE, 0); Set Focus(GetDigItem(hD1g, IDC_SEND));
return TRUE;
return FALSE;
return FALSE;



71 投稿者:名無しさん 2019/12/16 16:36:08



72 投稿者:名無しさん 2019/12/16 16:36:26



73 投稿者:名無しさん 2019/12/16 16:36:42



74 投稿者:名無しさん 2019/12/16 16:37:05



75 投稿者:名無しさん 2019/12/16 16:37:22



76 投稿者:名無しさん 2019/12/16 16:37:41



77 投稿者:名無しさん 2019/12/16 16:38:02
ここで


78 投稿者:名無しさん 2019/12/16 16:38:08
一句





パスワード:


私は(カタカナで)ロボットではありません