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ÁË£¬(*^__^*) ÎûÎû
ºÃ¿ªÐÄŶ£¬ÓÖ½â¾öÁËÒ»¸öÎÊÌâ
Ïà¹ØÎĵµ£º
º¯ÊýÒ»£º
view plaincopy to clipboardprint?
uses
Windows,
SysUtils,
Classes,
ShellAPI;
function RunAndWait(FileName: string; Visibility: Integer): THandle;&nbs ......
´ËÎÄÊʺÏDelphiÐÂÊÖÔĶÁ£¬ÌرðÊÇÁ¬½ÓÊý¾Ý¿â·½Ã滹һ¶®°ë¶®ÉõÖÁ¸ù±¾²»¶®µÄÐÂÊÖ£»
--------------------------µ«×ÜÌåÏÔµÃÓеãÂÒ-------------------------
±¾ÎÄÕÂÒÔDelphi 7ºÍSQL Server 2000ΪÀý£¬¿Ø¼þÃû¾ùΪϵͳĬÈÏ£¬ÈçUnit1,DataModule1,Edit1,ADOCommand1,ADODataS ......
Delphi µÄ×Ö·û¼°×Ö·û´®[1] - string¡¢AnsiString¡¢WideString¡¢String[n]¡¢ShortString
2008-10-17 14:57:17
//×î³£ÓÃµÄ string
var
str: string; {¶¨Òå}
begin
str := 'ÍòÒ»'; {¸³Öµ}
ShowMessage(IntToStr(Length(str))); {³¤¶ÈÊÇ: 4}
end;
//³¤×Ö·û´® AnsiString; ÔÚµ±Ç°°æ± ......
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]²úÉúÊó±êÍ϶¯Ð§¹û
ͨ¹ý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 ......