Delphi调用VC++6.0编写的Dll
用VC++6.0编写了一个简单的dll,里面包含一个减法函数subtract(int a,int b),Dll命名为ff.Dll
代码如下:
1.ff.cpp:
// ff.cpp : Defines the entry point for the DLL application.
//
#include "StdAfx.h"
#include "ff.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported variable
FF_API int nFf=0;
// This is an example of an exported function.
FF_API int fnFf(void)
{
return 42;
}
// This is the constructor of a class that has been exported.
// see ff.h for the class definition
CFf::CFf()
{
return;
}
FF_API int subtract(int a,int b)
{
return (a-b);
}
2.StdAfx.cpp:
// stdafx.cpp : source file that includes just the standard includes
// ff.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#ifdef FF_EXPORTS
#define FF_API __declspec(dllexport)
#else
#define FF_API __declspec(dllimport)
#endif
// This class is exported from the ff.dll
class FF_API CFf {
public:
CFf(void);
// TODO: add your methods here.
};
extern FF_API int nFf;
FF_API int fnFf(void);
extern "C" FF_API int subtract(int a,int b);
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
3.ff.h:
// The following ifdef block is the standard way of creating macros which make ex
相关文档:
转载自:http://www.cnblogs.com/jdmei520/archive/2009/06/17/1505053.html
Webservice技术的出现将各种开发技术和语言完全的融合了,下面就这种融合在C#和delphi之间的交互做一次全面的体现
1.使用C#创建一个Webservice服务。
使用vs2005的模板创建C#的webservice非常容易。原文件如下:
[WebService(Namespace  ......
function ExpCalc(exp: string): string;
var
vScript: Variant;
begin
vScript := CreateOleObject('ScriptControl');
vScript.Language := 'VBScript';
Result := vScript.Eval(exp);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
s:=ExpCalc('100 *4.17/0.5*(55. ......
VC++与Java
Visual C++ 6.0是微软非常经典的调试工具,本人非常喜欢。不知不觉学了MFC,花了不少时间与银子,感觉MFC真的是博大精深,就像一种非常高深的武功,就像太极,入门难。java像武当。Visual C++需要比较深厚的内功才能修炼好,不过java学好了也不错,不管学哪个,最终的境界都是刚柔相济。武功如此,编程语言开发 ......
//定义全局变量
public
{ Public declarations }
outlook,MailItem,Recipient:variant;
OutlookNameSpace:variant;
OutlookFolder:variant;
OutlookAttachment:variant;
//创建打开outlook
procedure TForm1.CreateOutLook;
begin
try
outlook:=CreateOleObject('OutLook.app ......