阅读:1180回复:4
??help me
请问
我在OnInitDialog()中加createfile()执行打开文件,编译通过,但为什么生成的.EXE文件不能正常执行?提示(我程序中有Messagebox)不能打开文件。但是再编译过程中程序和结果均执行正常. |
|
|
沙发#
发布于:2001-11-08 07:37
谢谢
经过调试我已解决问题 是CLOSEHANDLE 的缘故 |
|
|
板凳#
发布于:2001-11-08 01:25
[QUOTE]原本由 ycxu 发表
[B]请问 我在OnInitDialog()中加createfile()执行打开文件,编译通过,但为什么生成的.EXE文件不能正常执行?提示(我程序中有Messagebox)不能打开文件。但是再编译过程中程序和结果均执行正常. [/B][/QUOTE] 用GetLastError可以得到错误码,可以查出错的原因。 |
|
|
地板#
发布于:2001-11-03 11:07
先把下面的看一遍,然后把MSDN里有关CreateFile()的内容再读三遍,你就会有所启发。
HANDLE CreateFile( LPCTSTR lpFileName, // file name DWORD dwDesiredAccess, // access mode DWORD dwShareMode, // share mode LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD DWORD dwCreationDisposition, // how to create DWORD dwFlagsAndAttributes, // file attributes HANDLE hTemplateFile // handle to template file ); --[Communications Resources] The CreateFile function can create a handle to a communications resource, such as the serial port COM1. For communications resources, the dwCreationDisposition parameter must be OPEN_EXISTING, and the hTemplate parameter must be NULL. Read, write, or read/write access can be specified, and the handle can be opened for overlapped I/O. For more information about communications, see Communications. |
|
地下室#
发布于:2001-11-02 12:53
来错了地方,去
http://www.vckbase.com/bbs 问 |
|
|