// TODO: 鍦ㄦ娣誨姞棰濆鐨勫垵濮嬪寲浠g爜
CRect rect;
m_cListCtrl.GetClientRect(&rect);
int nColInterval = rect.Width()/3;
m_cListCtrl.InsertColumn(0, _T("鏃ユ湡"), LVCFMT_CENTER, nColInterval);
m_cListCtrl.InsertColumn(1, _T("鎸囨暟"), LVCFMT_CENTER, nColInterval);
m_cListCtrl.InsertColumn(2, _T("鍩烘暟鐐?), LVCFMT_CENTER, nColInterval);
// Use the LV_ITEM structure to insert the items
LVITEM lvi;
CString strItem;
// Insert the first item
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
strItem = "1990.12.19";
lvi.iItem = 0;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
//lvi.iImage = i%8; // There are 8 images in the image list
m_cListCtrl.InsertItem(&lvi);
// Set subitem 1
strItem.Format(_T("%.2f"), 95.79);
lvi.iSubItem =1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_cListCtrl.SetItem(&lvi);
// Set subitem 2
strItem.Format(_T("%d"),2);
lvi.iSubItem =2;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_cListCtrl.SetItem(&lvi);
//絎簩涓暟鎹?br>lvi.mask = LVIF_IMAGE | LVIF_TEXT;
strItem = "1993.2.16";
lvi.iItem = 1;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
//lvi.iImage = i%8; // There are 8 images in the image list
m_cListCtrl.InsertItem(&lvi);
// Set subitem 1
strItem.Format(_T("%.2f"), 1558.98);
lvi.iSubItem =1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_cListCtrl.SetItem(&lvi);
// Set subitem 2
strItem.Format(_T("%d"),550);
lvi.iSubItem =2;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_cListCtrl.SetItem(&lvi);
鍩烘湰鍔熻兘閮藉叏浜? 鍙戜笂鏉ュ叡浜笅.
紼嬪簭浣跨敤ACE.
ACE鐨勭畝浠?
http://www.cs.wustl.edu/~schmidt/ACE-overview.html
udp嫻嬭瘯宸ュ叿:
鍔熻兘鎻忚堪
1.綰彂閫佸姛鑳?br>udp 192.168.1.22:9000 c:\bootbak.ini 灝嗘枃浠禼:\bootbak.ini鍙戦佸埌192.168.1.22
2.綰帴鏀跺姛鑳?br>udp 9000 鎺ユ敹9000绔彛udp鏁版嵁
3.杞彂鍔熻兘
udp 9000 192.168.1.22:9000 forward 鏈湴绔彛9000鎺ユ敹,鍙戝線192.168.1.22:900绔彛
4.瑕佷繚瀛樻枃浠跺彧闇瑕佸湪鍛戒護(hù)琛屽悗鍔?> result.txt鍗沖彲.
鍙墽琛屾枃浠跺拰婧愮爜. /Files/alantop/udp.rar
鍐嶆斁涓涓佺増鏈?win32 sdk鐗堟湰鐨剈dp
2. 濡備綍浠庡煙鍚嶈幏鍙朓P鍦板潃
3. 濡備綍浠巗truct in_addr鍜宻truct hostent緇撴瀯涓幏鍙朓P鍦板潃
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return FALSE;
}
/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup( );
return FALSE;
}
char hostname[255];
struct hostent *hst = gethostbyname(www.126.com) ;
struct in_addr ia;
if(hst != NULL)
{
memcpy(&ia.s_addr,hst->h_addr_list[0],sizeof(ia.s_addr));
int iIpLength = strlen(inet_ntoa(ia)) + 1;
char* lpcIp = new char[iIpLength];
ZeroMemory(lpcIp,iIpLength);
strcpy(lpcIp,inet_ntoa(ia));
delete []lpclp;
}
int i = gethostname(hostname, 255);
WSACleanup( );