WSADATA wsa;
 WSAStartup(MAKEWORD(2,2),&wsa);
 hostent *pht;
 pht=gethostbyname(“www.lingdux.com”);
 LPSTR pstr=pht->h_addr_list[0];
 struct in_addr inaddr;
 memmove(&inaddr,pstr,4);
 MessageBoxA(0,inet_ntoa(inaddr),0,0);

阅读全文

, ,

CFtpConnection *pconnection;
 CInternetSession *session=new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
 try
 {
  pconnection=session->GetFtpConnection(FtpAddress,UserName,Password);
 }
 catch(CInternetException *pEx)
 {
  WCHAR errror[1024]={0};
  if(pEx->GetErrorMessage(ERROR,1024))
   MessageBox(ERROR);
  else
   MessageBox(L”出现异常”);
 }
 if(pconnection->PutFile(L”C:\\ip.txt”,path))
  MessageBox(L”上传成功!”);
 else
  MessageBox(L”上传失败!”);
 pconnection->Close();

阅读全文

, ,

#include “windows.h”
#include “tchar.h”
WCHAR a[]=L”123″;
int WINAPI MyFonc(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
 WCHAR b[]=L”456″;
 HMODULE hmodule=LoadLibrary(L”user32.dll”);
 FARPROC addr=GetProcAddress(hmodule,”MessageBoxW”);
 __asm
 {
  push 0
  mov eax,offset a//全局用offset
  push eax
  lea eax,b//局部用lea
  push eax
  push 0
  call addr
 }
 return 0;
}

阅读全文

, ,

#ifdef NDEBUG
#pragma optimize(“gsy”,on)
//RELEASE方式编译
#pragma comment(linker,”/RELEASE”)
#ifdef _MERGE_RDATA_
//合并区段
#pragma comment(linker,”/merge:.rdata=.text”)
#endif
#pragma comment(linker,”/merge:.data=.text”)
#pragma comment(linker,”/merge:.reloc=.text”)
#if _MSC_VER>=1000
#endif
#endif

阅读全文

, ,