如何在ActivexForm里调用DLL?(100分)

  • 主题发起人 主题发起人 yaan
  • 开始时间 开始时间
Y

yaan

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在ActivexForm里调用DLL?
 
跟在应用里面以样调吧!
 
1。如果是类库直接导入
2。普通的动态连接库也和应用程序一样
例如:
procedure GetDLLFData(var ss:String);StdCall External 'ShareLib.dll';
 
你要调谁的?
服务器的还是终端机上的?
如果是终端机上已存在并注册过的你可以按楼上的方法,
如果你要自己把服务器上DLL下载到终端并调用,我想不
出你怎么把此DLL在终端机上注册?
 
打个cab包,将所需的dll打进cab包,编辑相应inf的文件
inf例子
[version]
signature="$CHICAGO$"
AdvancedINF=2.0

[Add.Code]
Pdt1100.ocx=Pdt1100.ocx
IT3EW32D.DLL=IT3EW32D.DLL
ZPLPRINT.dll=ZPLPRINT.dll
PalmReceive.ocx=PalmReceive.ocx
mfc42.dll=mfc42.dll
msvcrt.dll=msvcrt.dll

[PDT1100.ocx]
file-win32-x86=thiscab
FileVersion=1,0,0,1
DestDir=11
RegisterServer=yes

[PalmReceive.ocx]
file-win32-x86=thiscab
FileVersion=1,0,0,1
DestDir=11
RegisterServer=yes

[ZPLPRINT.dll]
file-win32-x86=thiscab
FileVersion=1,0,0,1
DestDir=11
RegisterServer=yes
 
谢谢YXZ123:
能不能说说INF后缀的文件在WIINDOWS中起个什么作用,如果可能的话请告知
其编写格式,最好有官方文档。

下面是我摘的一段WORDPAD.INF

WORDPAD.INF
;

This is the Setup information file to install WordPad

as an Optional Component.
;

Copyright (c) 1993-1997 Microsoft Corporation
;

[version]
signature="$CHICAGO$"
ClassGUID={00000000-0000-0000-0000-000000000000}
LayoutFile=layout.inf

[DestinationDirs]
WordPadCopyFiles = 16422,%ACCESSOR%
DIRID_PROGRAM_FILES/Program Files/Windows NT/Accessories
WordPadCopyFiles_HELP = 18
LDID_HELP
WordPadFilesOld = 16422,%ACCESSOR%
DIRID_PROGRAM_FILES/Program Files/Windows NT/Accessories
WriteCopyFiles = 11 LDID_SYSTEM
WriteFilesOld = 11 LDID_SYSTEM

[Optional Components]
MSWordPad

[MSWordPad]
OptionDesc = %MSWORDPADOPT_DESC%
Tip = %MSWORDPADOPT_TIP%
IconIndex = 39 Windows Logo mini-icon for dialogs
Parent = AccessTop
CopyFiles = WordPadCopyFiles, WordPadCopyFiles_HELP, WriteCopyFiles
DelFiles = WordPadFilesOld, WriteFilesOld
AddReg = WordPadReg
ProfileItems = WordpadInstallItems, WordpadUninstallItems
Uninstall = MSWordPadUninstall
Modes = 0,1,2,3
SizeApproximation = 294912


[MSWordPadUninstall]
DelFiles = WordPadCopyFiles, WordPadCopyFiles_HELP, WordPadFilesOld, WriteCopyFiles
UpdateInis = WordPadInis.remove
ProfileItems = WordpadUninstallItems,WordpadUninstallCommonItems
DelReg = WordPadReg

[DefaultInstall]
AddReg = WordPad.install.reg, WordPadReg

[WordPadCopyFiles]
wordpad.exe

[WordPadCopyFiles_HELP]
wordpad.chm
wordpad.hlp

[WordPadFilesOld]
mfc40u.dll
msvcrt40.dll

[WriteCopyFiles]
;copy stub program that launches wordpad.exe (for compat. reasons):
write.exe

[WriteFilesOld]
write.cnt
write.hlp

[WordpadInstallItems]
Name = %WORDPAD_LINK%
CmdLine = 16422, %ACCESSOR%, wordpad.exe
SubDir = %APPS_DESC%
InfoTip = %Wordpad_Infotip%

[WordpadUninstallItems]
Name = %WORDPAD_LINK%,0x00000003
Subdir = %APPS_DESC%

[WordpadUninstallCommonItems]
Name = %WORDPAD_LINK%,0x00000002
Subdir = %APPS_DESC%

。。。。。。。。。。。。。。

看了一会也不明白,感觉象INI可又不是,那些标中括号的标题为什么那么写,
下面的子项又照什么写,以及象WORDPAD这样的程序为什么也存在这样的INF文件?
 
下面是摘抄的一段可以参考一下:
Sample INF file for POLYGON.DLL
[version]

version signature (same for both NT and Win95) do not remove
signature="$CHICAGO$"
AdvancedINF=2.0

[Add.Code]
polygon.dll=polygon.dll
atl.dll=atl.dll


needed DLL
[atl.dll]
file-win32-x86=thiscab
FileVersion=2,00,0,7024
DestDir=11
RegisterServer=yes

[polygon.dll]
file-win32-x86=thiscab
clsid={4CBBC676-507F-11D0-B98B-000000000000}
FileVersion=1,0,0,1
RegisterServer=yes

end of INF file

  该INF指定了系统需要安装特定版本的ATL.DLL。如果系统中还没有该文件,
则需要从和该INF一起创建的CAB文件下载。
"thiscab" 是一个关键字,意指包含该INF的CAB文件。
您也可以从网上下载所需要的DLL文件,只要指定一个HTTP 网址即可,绝对路径或者相对路径都可以,比如:

  file-win32-x86=http://www.mysite.com/mydir/NEEDED.DLL

  关键字"file-win32-x86" 指定平台是 x86。

  得到一个文件的版本号的过程是:在Windows NT或者Windows 95 Explorer中右键点击该文件;
从弹出列表中选择Properties,然后在接着弹出的对话框中选择版本标签。有时,您可能需要在文
件版本中插入一个额外的0 。比如,对话框中显示ATL.DLL的版本号是2.00.7024,在INF文件中则变为2,00,0,7024 。

  "DestDir"指的是装载目录或者文件的地址: 11 指定为系统目录 WINDOWS/SYSTEM 或者 WINNT/SYSTEM32

10 规定为窗口目录、WINDOWS或者WINNT。如果没有指定DestDir(典型情况),则代码从固定的OCCACHE目录装载。

  "clsid" 指的是要安装控件的CLSID。
 
后退
顶部