vb或vc写的dll能被bcb调用吗?

alexsum 2002-11-19 12:32:58
我手头上有一个dll,以前公司曾有人用它和vb做了一个应用。我对vb不甚了解,但现在的应用还需要该dll,想用c++builder来实现我的应用。我只知道dll是用vb或vc写的,在以前vb应用的申明和调用的例子如下:

申明:
Declare Function WTEKeyHandle Lib "xxx.dll" Alias "KeyProc" (ByVal i As Integer, ByVal KeyCode As Long, ByVal Shift As Long, WinVars As WindowVars, ScreenData As CharDataPos, ScreenAttrib As Attrib, ByVal PushButtonChar As String) As Integer

其中WindowVars,CharDataPos,Attrib都是vb里面的type,如:
Type WindowVars '/* General features */
CursorType As Integer
WinLines As Integer ' /* Lines per window */
WinColumn As Integer
MenuID As Integer '
FontHeight As Integer ' /* Height of normal font */
FontWidth As Integer ' /* Width of normal font */
ReDraw As Integer ' /* Height of zoom font */
BellFlag As Integer ' /* indicate bell */
ActChildID As Integer ' /* Active child window ID */

XMITType As String * 1 ' /* X origin */
Focus As String * 1
LogCount As Integer ' /* Y origin */
Width As Integer ' /* Window width */
Height As Integer ' /* Window height */
ForeColor As Long ' /* Foreground color */
BackColor As Long ' /* Background color */
row As Integer ' /* Row cursor position */
col As Integer ' /* Col cursor position */
OFF As Integer ' /* Offset into the buffer */
Ins As Integer ' /* Insert status (ON/OFF) */
ShiftKeyPressed As Integer '
DDEServerID As Integer ' /* Zoom status (ON/OFF) */
RID As String * 1
SID As String * 1
DID As String * 1
FirstCol(1 To 24) As Integer
End Type

调用的例子:
i = WTEKeyHandle(NRC_KEYDOWN, code_long, shift_long, WinVars(Id), _
ScreenData(Id), ScreenAttrib(Id), PushButtonChar)

请问我有什么办法知道函数的原型,以及可能在c++builder中调用它吗?谢谢。
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nxyc_twz 2002-11-21
  • 打赏
  • 举报
回复
要想调用,需要修改一下相关头文件中数据类型的声明!
SuperSuperLéon 2002-11-20
  • 打赏
  • 举报
回复
我简单给你转换了一下:

好久没用vb了,忘了不少。String的那种我不熟。可能

转换错了,权做借鉴。

高人快来指点。


typedef
struct
_WindowVars{
int CursorType;
int WinLines; /* Lines per window */
int WinColumn;
int MenuID;
int FontHeight; /* Height of normal font */
int FontWidth; /* Width of normal font */
int ReDraw; /* Height of zoom font */
int BellFlag; /* indicate bell */
int ActChildID; /* Active child window ID */
char *XMITType; /* X origin */
char *Focus;

int LogCount; /* Y origin */
int Width; /* Window width */
int Height; /* Window height */
long ForeColor; /* Foreground color */
long BackColor; /* Background color */
int row; /* Row cursor position */
int col; /* Col cursor position */
int OFF; /* Offset into the buffer */
int Ins; /* Insert status (ON/OFF) */
int ShiftKeyPressed;
int DDEServerID; /* Zoom status (ON/OFF) */
char *RID;
char *SID;
char *DID;
int FirstCol[24];
}WINDOWVARS,*PWINDOWVARS;

typdefef
int
( WINAPI *CharDataPos)
_CharDataPos
typedef
struct{
int i;
int j;

)CHAEDARAPOS,*PCHAEDARAPOS;
rikky 2002-11-19
  • 打赏
  • 举报
回复
当然可以,你只要把运行一下C++ BUILDER自带的工具implib.exe,将.dll生成.lib,再include "*.lib",就可以使用你.dll里面的函数了。

implib.exe路径:.\borland\cbuilder5\bin\
implib.exe使用: 进入该目录:\>implib *.lib *.dll将在该目录下生成.lib文件,copy to 你的程序路径下

1,222

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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