stdNetApi.h
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:3k
- //File Name : stdNetApi.h.
- //Standard Net Library API common header file that writen by Devia.
- //This code is free all, you can distribute it.
- //Author : Devia Li(devia@sina.com)
- //DateTime : 2004-04-02
- #ifndef _STDNETAPI_H
- #define _STDNETAPI_H
- #pragma warning(disable:4786)
- //###Include header files...
- #include <vector>
- #include <list>
- #include <string>
- #include <map>
- #include <errno.h>
- #include <assert.h>
- #include <iostream>
- #include <fstream>
- #include <process.h>
- #include <typeinfo.h>
- //windows header file.
- #include <windows.h>
- //COM base objects header file.
- #include <objbase.h>
- //windows socket v2.0 header file.
- #include <winsock2.h>
- #pragma comment(lib, "ws2_32.lib")
- using namespace std;
- //###Windows message define here.
- #define UWM_SOCK_MESSAGE WM_APP + 100
- #define UWM_SVR_UPDATE_CLIENT_COUNTS UWM_SOCK_MESSAGE + 1
- #define UWM_SNDER_UPDATE_REGISTER_TOSVR UWM_SOCK_MESSAGE + 2
- #define UWM_SNDER_UPDATE_SNDING_START UWM_SOCK_MESSAGE + 3
- #define UWM_SNDER_UPDATE_SNDING_PROGRESS UWM_SOCK_MESSAGE + 4
- #define UWM_SNDER_UPDATE_ONEFILESEND_OK UWM_SOCK_MESSAGE + 5
- #define UWM_RECVOR_UPDATE_RECVING_START UWM_SOCK_MESSAGE + 6
- #define UWM_RECVOR_UPDATE_RECVING_PROGRESS UWM_SOCK_MESSAGE + 7
- #define UWM_RECVOR_UPDATE_ONEFILERECV_OK UWM_SOCK_MESSAGE + 8
- //###NetLib constant define here.
- #define MAX_SIZE_CLSID 64
- #define MAX_FALSE_TIMES 32
- #define STR_END_CHAR ' '
- //###Type define
- typedef unsigned int uint;
- typedef unsigned long ulong;
- typedef unsigned short ushort;
- typedef __int64 longlong;
- //###Macro define here
- #define _DELETE(p) {
- if (p) delete p;
- p = NULL;
- }
- #if defined _AFXDLL
- #define NETLIBDLLEXPORT AFX_EXT_CLASS
- #define DLLEXPORTS __declspec(dllexport)
- #define DLLIMPORTS __declspec(dllimport)
- #else
- #define NETLIBDLLEXPORT
- #pragma message("Static")
- #define DLLEXPORTS
- #define DLLIMPORTS
- #endif
- //net exception header file.
- #include "NetException.h"
- #if defined _AFXDLL
- extern "C"{
- #endif
- //initialize and unInitialize the windows socket library.
- bool DLLEXPORTS Initialize(WORD wVersion = MAKEWORD(2, 0));
- bool DLLEXPORTS UnInitialize();
- //allocate the window from the window's message procedure.
- HWND DLLEXPORTS AllocateHWnd(WNDPROC wpMethod, long lData);
- //destroy the window
- void DLLEXPORTS DeallocateHWnd(HWND hWnd);
- //get someone CLSID id string text.
- bool DLLEXPORTS GenerateCLSID(char *szCLSID, const nMaxSize);
- //#############################################
- //get the file path string.
- void DLLEXPORTS ExtractFilePath(const char* lpzFileFullName,
- char* lpFilePath,
- ushort wBufSize);
- //get the file name string ...
- void DLLEXPORTS ExtractFileName(const char* lpzFileFullName,
- char* lpFileName,
- ushort wBufSize);
- //determine the file / directory whether or not exists.
- bool DLLEXPORTS FileExists(const char *lpszFileName);
- //
- bool DLLEXPORTS DirectoryExists(const char *lpszDirectoryName);
- //create the multi levels directories...
- bool DLLEXPORTS CreateDirectorys(const char *lpszDirectoryName);
- //get the file attributes.
- bool DLLEXPORTS GetFileInfo(const char *lpszFileName,
- BY_HANDLE_FILE_INFORMATION *pfileinfo);
- //set the file attributes.
- void DLLEXPORTS SetFileInfo(const char *lpszFileName,
- BY_HANDLE_FILE_INFORMATION &fileinfo);
- //delete someone character from string buf.
- void DLLEXPORTS DeleteCharFromString(char *lpString, const char ch);
- #if defined _AFXDLL
- }
- #endif
- #endif //_STDNETAPI_H