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://book.77169.com/data/web5302/20050228/20050228__3692503.html
ActiveX 和 Web
在Windows 操作系统下,有一个重要的机制,就是OLE ,就是可以让某
个应用程序(OLE Controller)访问其它应用程序(OLE Server)所提供的
功能,这样做的好处是,如果已经有了完成某项功能的程序,你就不必再为
某项功能编写特定 ......
1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx
++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&l ......
用Delphi开发数据库应用,一般会涉及到闪屏(Splash)、登录窗口、主数据模块(或主数据库连接)以及主窗口。通常在项目文件中,splash窗口显示过,一些需要加载的资源、窗口加载过后,Application.Run之前,进行用户登录。
//测试CSDN博客对DELPHI代码的支持
program TEST;
uses
Forms,
Windows,
MainF in 'Ma ......
C、传统 C++
#include <stdio.h> //定义输入/输出函数
#include <stdlib.h> //定义杂项函数及内存分配函数
#include <string.h> //字符串处理
#include <assert.h> //设定插入点
#include <ctype.h> //字符处理
#include <errno.h&g ......
32位Delphi程序中可利用TRegistry对象来存取注册表文件中的信息。
一、创建和释放TRegistry对象
1.创建TRegistry对象。为了操作注册表,要创建一个TRegistry对象:ARegistry := TRegistry.Create;
2.释放TRegistry对象。对注册表操作结束后,应释放TRegistry对象所占内存:ARegistry.Destroy。
二 ......