📄 subject_34512.htm
字号:
<p>
序号:34512 发表者:Janus 发表日期:2003-03-30 23:24:33
<br>主题:请问各位高手有关dll的问题
<br>内容: 我在程序中调用了dll内定义的函数,并成功返回值。但不关程序再次调用这个函数就发生错误,不知如何解决。请各位高手指点一二。<BR>dll内的函数<BR>#include <afx.h><BR>#include <windows.h><BR> CString output( int s );<BR><BR> BOOL WINAPI DLLEnterPoint(HINSTANCE hDLL,DWORD dwReason,LPVOID Reserved)<BR> {<BR> switch(dwReason)<BR> {<BR> case DLL_PROCESS_ATTACH:<BR> break;<BR> case DLL_PROCESS_DETACH:<BR> break;<BR> }<BR> return true;<BR> }<BR> CString output( int s )<BR> { <BR> CString answer;<BR> switch(s)<BR> {<BR> case 0:<BR> answer="FF 01 88 00 00 00 89";<BR> break;<BR> case 1:<BR> answer="FF 01 08 00 00 00 09";<BR> break;<BR> case 2:<BR> answer="FF 02 00 04 00 20 26";<BR> break;<BR> case 3:<BR> answer="FF 02 00 00 00 00 02";<BR> break;<BR> case 4:<BR> answer="FF 0A 88 90 00 40 62";<BR> break;<BR> default:<BR> answer="FF FF FF FF FF FF FF";<BR> break;<BR> }<BR> return answer;<BR> }<BR>对话框程序调用<BR> CString m_out=output(s);
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:Janus 回复日期:2003-03-31 10:17:26
<br>内容:点解没人回答啊??<BR>是不是太简单发了啊<BR>我急需啊<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ray111 回复日期:2003-03-31 11:39:10
<br>内容:to return a MFC CSring, you need to select "MFC Extension DLL" in application Wizard for MFC dll. this maybe your problem. <BR><BR>please check attached code for dll and testing dialog. <BR><BR>have a nice day<BR><BR>zhifang
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Janus 回复日期:2003-03-31 13:07:10
<br>内容: 我使用的是动态链接的,不是静态链接的dll,你的那个程序没有装载的头文件,要改动好难啊,可能我的程度太低了,可否做一个动态的,要有装载的命令啊。请原谅一个初学者的无知,多谢了!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:ray111 回复日期:2003-03-31 20:48:59
<br>内容:Here you go. <BR><BR>have nice day!<BR><BR>zhifang
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Janus 回复日期:2003-03-31 22:07:24
<br>内容:这个文件有问题啊,能通过编译,但运行出错啊!!!当用到dll内的函数时就出错了,是不是dll内的函数返回值不能是字符串啊
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:ray111 回复日期:2003-03-31 23:37:35
<br>内容:Hi dear, <BR><BR>the project attached has been tested without any problem(VC6, W2000). a bit hint is you have to compile the "dll11" to generate the dll file before running the testing dialog program. Hope this is the problem. <BR><BR><BR>ray
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:阿蝌 回复日期:2003-04-01 09:00:11
<br>内容:CString *panswer=new CString;<BR>return panswer;<BR>CString 退出后被析构
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -