|
我想用下面函数在wince下获取 串口打开失败 错误信息:
1^9j'h!@,m1l-q0Cvoid __fastcall TSerialPort::ProcessErrorMessage(char* ErrorText)
9?9L9F5B,f!f:^!ftech.techweb.com.cn{
)h6r-j0\)b&x;F9w%qtech.techweb.com.cnchar ErrorMsg[400];
(@/Y:^%r(M5N;X(hLPVOID lpMsgBuf; tech.techweb.com.cn-P'q*Q7s [9n#p
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER ¦ //自动分配消息缓冲区
5L+J3U(P;V,P.V:`6L6S'KFORMAT_MESSAGE_FROM_SYSTEM, //从系统获取信息
4|6~;W#t6i.g4stech.techweb.com.cnNULL,GetLastError(), //获取错误信息标识 $L1q2x;e'~
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),//使用系统缺省语言
:Q,p)c$p)k(LPTSTR)&lpMsgBuf, //消息缓冲区
#d6K+a }#o7g9T!s0, 程序开发,操作系统,服务器,源码下载,Linux,Unix,BSD,PHP,Apach,asp,下载,源码,黑客,安全,技术社区,技术论坛7J"R%h0M$\
NULL); &K!~"W;X.p!K
sprintf(ErrorMsg, ""%s" 由于以下错误而失败: %s",ErrorText,lpMsgBuf);
3k6^ _*w$R7w7I#~0Y#k$[tech.techweb.com.cnApplication->MessageBox(ErrorMsg, "错误", MB_ICONSTOP);//弹出错误提示框
4e3h0O3N2gLocalFree(lpMsgBuf); #v-I6y5x.|3c
}
9U1X!i0B8\#~(b!}&`+s0N2vTechWeb-技术社区但却出现错误:
7D#o/i'V:p(c9T+{8l({tech.techweb.com.cnerror C2653: 'TSerialPort' : is not a class or namespace name
%V&f3c5q([error C2065: 'Application' : undeclared identifier tech.techweb.com.cn0],p$k)O%S)\'T
error C2227: left of '->MessageBoxW' must point to class/struct/union 3F9e(f0q/j;~"N-k
由于我是个新手,还请哪位高手指点一下: tech.techweb.com.cn/e.d#K3p,i,b/P(N(s
TSerialPort和Application指的是什么意思?用上面的函数检查错误是不是要用到什么头文件? 1V)V ~(U3O3e
小弟先谢谢了!!
|