函数调用dll后参数问题

cultsharp 2010-10-27 09:51:25
typedef int (*pUpdateClient)(int , TCHAR* []);
int argc = 5;
TCHAR* pstr_ip = str_ip.GetBuffer(str_ip.GetLength());
TCHAR* pstr_file_type = str_file_type.GetBuffer(str_file_type.GetLength());
TCHAR* pstr_file_path = str_file_path.GetBuffer(str_file_path.GetLength());
TCHAR* pstr_modify_type = str_modify_type.GetBuffer(str_modify_type.GetLength());
TCHAR* pstr_file_name = str_file_name.GetBuffer(str_file_name.GetLength());
TCHAR* argv[] = {pstr_file_name,pstr_ip,pstr_file_type,pstr_file_path,pstr_modify_type};
str_ip.ReleaseBuffer();
...

hDll = LoadLibrary(_T("UpdateClient.dll"));
UpdateClientFunc = (pUpdateClient)GetProcAddress(hDll, "Client_main");
int ret = 0;
ret = (UpdateClientFunc)(argc,argv);

程序在_MBCS下正常,该在unicode下参数传递就失败,程序调用dll,但别人写的dll里函数为int Client_main(int argc, char *argv[]),跟踪进dll后发现传递的只是头字母,比如pstr_file_name参数应为"WEB_Device.cgi",dll里接收的是"W"。我知道应该是dll里char *argv[]问题,请问在unicode下我的主程序应该怎么修改?
...全文
106 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cultsharp 2010-10-27
  • 打赏
  • 举报
回复
[Quote=引用楼主 cultsharp 的回复:]
typedef int (*pUpdateClient)(int , TCHAR* []);
int argc = 5;
TCHAR* pstr_ip = str_ip.GetBuffer(str_ip.GetLength());
TCHAR* pstr_file_type = str_file_type.GetBuffer(str_file_type.GetLength());
TCHA……
[/Quote]
一个网关更新界面...能详细点吗
ouyh12345 2010-10-27
  • 打赏
  • 举报
回复
还有这样的dll.......

WideCharToMultiByte
MultiByteToWideChar

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧