
工作代码
Lasuerte
这个作者很懒,什么都没留下…
展开
-
CHttpFile下载文件小例子
利用MFC类里CHttpFile CInternetSession CFile 等实现网络下载功能原创 2017-10-30 13:38:47 · 1850 阅读 · 0 评论 -
加入多线程的文件下载程序
download.h#pragma once#include "stdafx.h"#define BLen 8192using namespace std;unsigned int __stdcall Fun(void *pPM);DWORD SyncWaitForMultipleObjs(HANDLE * handles, int count);HANDLE g_hThread原创 2017-11-01 11:17:35 · 279 阅读 · 0 评论 -
配置Libmodbus库总结
1.在github上下载libmodbus资源点击打开链接。2.我直接编译这个出现了很多错误,我就去官网查找了源码官网。3.下载到3.1.4版本源码后发现里面没有sln文件,我直接把新的官网下载到的源码复制粘贴替换掉了github下载的资源,即src下的代码替换掉。再编译发现提示没有config.h文件。结果libmodbus-master\src\win32目录下有一个config.h....原创 2018-06-04 10:57:38 · 3595 阅读 · 3 评论 -
网络传输粘包解包处理
有时候发送的数据过长,接收的时候只接收了一部分,会出现错误。这里以客户端接收服务端消息为例,讲解一种解包的方法,作为备忘(总是忘没办法)1.客户端有一段缓冲区char m_szAnalysisBuf[51200] 成员变量,用于存放接收数据,在回调函数收到数据后,判断缓冲区是否满了(一般不会满),未满的话将新接收的数据加入到缓冲区中,并更新缓冲区长度。如果缓冲区满了,则舍弃掉原缓冲区的数据,将...原创 2018-09-12 11:05:57 · 833 阅读 · 0 评论 -
Windows转linux 常见数据类型宏定义
//---------------------------------------------------------#ifndef WIN32typedef unsigned char UCHAR;typedef unsigned char* PBYTE;typedef char* LPTSTR;typedef...原创 2018-09-12 11:17:59 · 624 阅读 · 0 评论 -
常用工作函数代码
1.产生从 nStart到nEnd的连续不重复随机数#include <time.h> // time(0)#include<stdlib.h> // rand srand#include <process.h> // getpidint randNum(__in int nStart, __in int nEnd, __...原创 2018-10-18 11:40:25 · 277 阅读 · 0 评论 -
获取程序自身窗口句柄(cmd)
HWND GetConsoleHwnd(void){#define MY_BUFSIZE 1024 // Buffer size for console window titles. HWND hwndFound; // This is what is returned to the caller. char pszNewWindowTitle[MY_BUFS...转载 2018-11-08 11:00:31 · 2742 阅读 · 1 评论