易截截图软件、单文件、免安装、纯绿色、仅160KB

DELPHI调用VC编写的DLL 函数参数为LPTSTR

注意点:LPTSTR 对应的是PAnsiChar 或者PWideChar 你问问他的编译选项,要是定义了unicode就是PWideChar 否则是PAnsiChar
这里我是用UNICODE编程的,所以用到的是PWideChar
在VC写的A.dll里添加一个函数为
extern "C" __declspec(dllexport) LPTSTR WINAPI Do(LPTSTR i)
{
return i;
}
在DELPHI调用为
type
TDoFunc=function(str:PWideChar) :PWideChar;stdcall;
var
Th:Thandle;
TDo:TDoFunc;
Tp:TFarProc;
str:PWideChar;
strA,strB:PWideChar;
begin
Th:=LoadLibrary('A.dll'); {装载DLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,PChar('_Do@4'));
if Tp<>nil
then begin
TDo:=TDoFunc(Tp);
strA:='bread';
str:=TDo(strA);
ShowMessage(str);
end
else
ShowMessage('没有找到函数');
finally
FreeLibrary(Th); {释放DLL}
end
else
ShowMessage('dll文件没找到');
end;
这样就OK了,(*^__^*) 嘻嘻
好开心哦,又解决了一个问题


相关文档:

Delphi 7高效数据库程序设计

内容简介
    dbExpress是Borland公司下一代数据访问技术。本书不仅详细介绍了dbExpress的基本功能、使用技巧以及Delphi/Kylix的DataSnap技术,还详细讨论了dbExpress的实现原理以及dbExpress的未来发展趋势。本书结构清晰,讲解透彻,实例丰富。作者李维是Borland公司著名技术专家,曾著有多部Delphi名 ......

delphi中使用透明控件的几种方法

有时需要使用透明控件用于捕获鼠标消息
1.调用Windows2000,xp新的API函数实现这一功能的过程。使用SetLayeredWindowAttributes
2.直接设置控件的alphablend,alphablendvalue,间接调用上述api.
3.使用TStaticText控件
procedure WMCtrlColor(var Message: TWMCtlColor); message WM_CTLCOLOR;
procedure TForm3.WMCtr ......

Delphi写网页安全控件(dll,ocx)


Unt_Machine_WebDll.pas
BODY {background: #FFFFFF}
A:link { color: #0000FF}
A:visited { color: #0000FF}
A:Active { color: #0000FF}
.bold {font-weight: bold}
.italic {font-style: italic}
.underline {text-decoration: underline}
unit Unt_Machine_WebDll;
{$WARN SYMBOL_PLATFORM OF ......

Delphi常用代码汇总

◇[DELPHI]产生鼠标拖动效果
通过MouseMove事件、DragOver事件、EndDrag事件实现,例如在PANEL上的LABEL:
var xpanel,ypanel,xlabel,ylabel:integer;
PANEL的MouseMove事件:xpanel:=x;ypanel:=y;
PANEL的DragOver事件:xpanel:=x;ypanel:=y;
LABEL的MouseMove事件:xlabel:=x;ylabel:=y;
LABEL的EndDrag事件:label ......

delphi string类型转integer时出错的检测

procedure TForm1.Button1Click(Sender: TObject);
Var
  Num: Integer;
Begin
  Try
    Num:=StrToInt(Edit1.Text);
    Edit2.Text:=IntToStr(Num*Num);
  Except
    On EConvertError Do   ShowMessage(Edit1.Text+'无法转成整数!'); ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号