该程序全部由C写成 没有C++ 更没用MFC
完全是自娱自乐 给需要的人一个参考
#include "stdafx.h"
冬至习俗#include <windowsx.h>
#include "resource.h"
#include "MainDlg.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
枸杞子的作用与功效HANDLE hComm;//用于获取串口打开函数的返回值(句柄或错误值)
OVERLAPPED m_ov;
COMSTAT comstat;
DWORD m_dwCommEvents;
TCHAR cRecs[200],cSends[100]; //接收字符串 发送字符串
char j=0,*cCom; //接收用统计数据大小变量 端口选择
BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog);
HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand);
HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClo);
}
return FALSE;
}
/*系统初始化函数*/
BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
平津战役HWND hwndCombo1=GetDlgItem(hwnd,IDC_COMBO1);
ComboBox_InrtString(hwndCombo1,-1,TEXT("COM1"));
ComboBox_InrtString(hwndCombo1,-1,TEXT("COM2"));
ComboBox_InrtString(hwndCombo1,-1,TEXT("COM3"));
ComboBox_InrtString(hwndCombo1,-1,TEXT("COM4"));
ComboBox_InrtString(hwndCombo1,-1,TEXT("COM5"));
ComboBox_SetCurSel(hwndCombo1,0);
我想做生意void CALLBACK TimerProc (HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime);
SetTimer(hwnd,1,1000,TimerProc);
return TRUE;
}
/*监视串口错误时使用的函数*/
bool ProcessErrorMessage(char* ErrorText)
{
char *Temp = new char[200];
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
有趣的简笔画NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
奔跑羽泉
0,
NULL
);
sprintf(Temp, "WARNING: %s Failed with the following error: \n%s\nPort: %d\n", (char*)ErrorText, lpMsgBuf, "com2");
MessageBox(NULL, Temp, "Application Error", MB_ICONSTOP);
蓬松发型
LocalFree(lpMsgBuf);
相干波delete[] Temp;
return true;