这个DLL有错??

fourway 2000-07-11 11:00:00
我用VC写的一个选择目录的DLL,如下
_declspec(dllexport) BOOL selectdir(HWND hWinHandle,LPSTR lpDisplayName,LPCSTR lpTitle,LPSTR DirPath)
{
BROWSEINFO lpbi;
LPCITEMIDLIST idlRoot;
lpbi.hwndOwner=hWinHandle;
lpbi.pidlRoot=NULL;
lpbi.pszDisplayName=lpDisplayName;
lpbi.lpszTitle=lpTitle;
lpbi.ulFlags=BIF_RETURNONLYFSDIRS;
lpbi.lpfn=NULL;
idlRoot=SHBrowseForFolder(&lpbi);
// if (idlRoot=NULL )
// return FALSE;
/* if (SHGetPathFromIDList(idlRoot,DirPath))
{
MessageBox(hWinHandle,DirPath,"34",64);*/
return TRUE;
//}
//else return FALSE;

}

在PB中如下调用:
string ls_dirname,tt='343'
ulong l_handle
l_handle=handle(this)
ls_dirname = space(255)
if selectdir(l_handle,tt,tt,ls_dirname) then
messagebox("dsaf","ok")
end if
运行时能弹出选择目录对话框,可一确定,就出:


Specified argument type differs from required argument type at
runtime in DLL function selectdir

我百思不得其解!WHY?
...全文
114 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wolcy 2000-07-12
  • 打赏
  • 举报
回复
我给你一个选择目录的用户对象吧,在PB下Import成用户对象后调用就行了
$PBExportHeader$nvo_dir.sru
$PBExportComments$调用windows选择目录对话框
forward
global type nvo_dir from nonvisualobject
end type
end forward

type s_browseinfo from structure
long hwndowner
long pidlroot
string pszdisplayname
string lpsztitle
long ulflags
long lpfncallback
long lparam
long iimage
end type

global type nvo_dir from nonvisualobject
end type
global nvo_dir nvo_dir

type prototypes
FUNCTION long SHBrowseForFolder(s_BrowseInfo lpbi) LIBRARY "SHELL32.DLL"
FUNCTION long SHGetPathFromIDList(long pidList,REF string lpBuffer) LIBRARY "SHELL32.DLL"
SUBROUTINE CoTaskMemFree(long hMem) LIBRARY "OLE32.DLL"
end prototypes

forward prototypes
public function string uf_browseforfolder (string as_title)
end prototypes

public function string uf_browseforfolder (string as_title);long lpIDList,ll_result
string ls_path
s_browseinfo s_1
s_1.hWndOwner=handle(this)
s_1.lpszTitle=as_title
s_1.ulFlags=1
lpIdList=SHBrowseForFolder(s_1)
ls_path=space(100)
ll_result=SHGetPathFromIDList(lpIdList,ls_path)
CoTaskMemFree(lpIDList)
return ls_path
end function

on nvo_dir.create
TriggerEvent( this, "constructor" )
end on

on nvo_dir.destroy
TriggerEvent( this, "destructor" )
end on

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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