VCµ÷ÓÃDELPHI DLLÂÒÂë
Delphi(Pascal) code:
library HealthDocDll;
uses
SysUtils,
Classes,
Forms,
Dialogs,
Windows,
HealthDoc in 'HealthDoc.pas' {frmHealthDoc},
pub in 'pub.pas';
{$R *.res}
procedure ShowForm(DoctorName,UserName:string);
begin
sDoctorName:=DoctorName;
sUserName:=UserName;
showmessage(sdoctorname);
showmessage(susername);
end;
exports
ShowForm;
begin
C/C++ code:
HINSTANCE hDll;
hDll=LoadLibrary( _T("HealthDocDLL.DLL") );
typedef int(*func)(const char*,const char*);
func SmartWord= (func)GetProcAddress( hDll , "ShowForm" );
SmartWord( "aaaaaa" , "b" );
show³öÀ´µÄΪʲôÊÇÂÒÂ룿
thiscallÊÇɶ£¿
Õâ²»»¹ÊÇÄǸöÎÊÌâÂð£¬Äã°ÑÁ½±ß¶¼¸Ä³É stdcall,ÌýÎÒµÄ
¸Õ²Å´ò´íÁË£¬
stdcall³ö´í
delphi²à:
procedure ShowForm(DoctorName,UserName:string);stdcall;
vc²à:
typedef int(_stdcall *func)(const char*,const char*);
ÒÀÈ»³ö´í£¬ÒÀÈ»ÂÒÂë
¿ÉÒÔÁË£¬Ð»Ð»£¬¸öÈË·¸µÄ´íÎó£¬ÀÍ·³´ó¼ÒÁË
ÄÜ°ÑÄãµÄdll·¢µ½ÎÒÓÊÏäÂð£¬lxqiang123321@163.com
Ïà¹ØÎÊ´ð£º
VC ¿ØÖÆ̨³ÌÐò:
#include <iostream>
using namespace std;
int main()
{
const int def_buffer = 1024 * 4;
DWORD t;
BYTE b[def_buffer];
memset(b, 0, sizeof(b));
PBYTE p;
t = GetTickC ......
Ò»Ö±ÏëʹÓÃdll£¬µ«delphiµÄdll×Ó´°Ìå¾³£Óи÷ÖÖÎÊÌ⣬±ÈÈçÖ÷´°¿ÚÓëdll×Ó´°¿ÚµÄ½¹µãÎÊÌ⣬×Ó´°¿ÚÖпؼþµÄtab¼ü¡¢Èȼü¡¢enter¼üµÈµÄÎÊÌ⣬×Ó´°¿ÚÍ˳öµÄÎÊÌ⡢ƽÃæ°´Å¥ÎÊÌâµÈµÈ£¬ÍøÕ¾ÉϽøÐÐÁËËÑË÷£¬Ã»ÓбȽÏÍêÃÀµÄ½â¾ö· ......
xml := CreateOleObject('Microsoft.XMLHTTP');
xml.Open('GET','http://www.google.com', False);
xml.Send;
xml.responseText;
ʹÓÃxml.responseText¿ÉÒÔ»ñÈ¡ÍøÒ³Ô´Âë,µ«ÊÇÔÙ´Î ......
1¡¢ÎÒÄÜ·ñÔÚdelphiÀïµ÷ÓÃÁíÍâÒ»¸öºǫ́³ÌÐò£¬µ«ÊÇÎÒ²»ÐèÒªµÈ´ýÕâ¸öºǫ́³ÌÐòÖ´ÐÐÍê³É£¬»¹¿ÉÒÔ¼ÌÐøÖ´ÐбðµÄ³ÌÐò¡£ÇëÎʾßÌåÔõôÑù²ÅÄÜʵÏÖ¡£
2¡¢ÎÒÄÜ·ñÔÚdelphiÉÏÖ´ÐÐÒ»¸ö¿ì½Ý¼ü£¬Ê¹delphi´°¿Ú³ÌÐòÄܹ»Ë¢ÐÂһϡ£[/size ......
Ö÷´°Ìå:
Delphi(Pascal) code:
procedure TfrmMain.btnResumeClick(Sender: TObject);
begin
myThread := TClientThread.Create(LeftPart(cbbServer.Text, ':'), StrToInt(RightPart(cbbServer.Text, ':')) ......