主页

论坛:“主要”;
当前存档:2002.01.08;
下载:[xml.tar.bz2];
向下

戴尔 找到类似的分支


HELP ME PLZ   (2001-12-15 18:22) [0]

ПОМОГИТЕ МНЕ ПОЖАЛУЙСТА Я ПЕРВЫЙ РАЗ РАБОТАЮ С DLL КАК ВЫЗВАЬ ФУНКЦИЮ ИЗ DLL-шки



Oleg Gashev(2001-12-15 18:35) [1]

Calling DLLs

Topic group See also

Before you can call routines defined in a DLL, you must import them. This can be done in two ways: by declaring an external procedure or function, or by calling the Windows API directly. Whichever method you use, the routines are not linked to your application until runtime. This means that the DLL need not be present when you compile your program. It also means that there is no compile-time validation of attempts to import a routine.
Object Pascal does not support importing of variables from DLLs.

Static loading

The simplest way to import a procedure or function is to declare it using the external directive. For example,

procedure DoSomething; external "MYLIB.DLL";

If you include this declaration in a program, MYLIB.DLL is loaded once, when the program starts. Throughout execution of the program, the identifier DoSomething always refers to the same entry point in the same DLL.
Declarations of imported routines can be placed directly in the program or unit where they are called. To simplify maintenance, however, you can collect external declarations into a separate “import unit” that also contains any constants and types required for interfacing with the DLL. (Delphi’s Windows unit is a good example.) Other modules that use the import unit can call any routines declared in it.

For more information about external declarations, see External declarations .
Dynamic loading through Windows API calls.



Oleg Gashev(2001-12-15 18:36) [2]

-------------------------------------------------- ---------------
LoadLibrary

The LoadLibrary function maps the specified executable module into the address space of the calling process.

HINSTANCE LoadLibrary(

LPCTSTR lpLibFileName // address of filename of executable module
);


参数

lpLibFileName

Points to a null-terminated string that names the executable module (either a .DLL or .EXE file). The name specified is the filename of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.DEF) file.

If the string specifies a path but the file does not exist in the specified directory, the function fails.
If a path is not specified and the filename extension is omitted, the default library extension .DLL is appended. However, the filename string can include a trailing point character (.) to indicate that the module name has no extension. When no path is specified, the function searches for the file in the following sequence:

XNUMX. The directory from which the application loaded.
XNUMX. The current directory.
XNUMX. Windows XNUMX: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.

Windows NT: The XNUMX-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEMXNUMX.

XNUMX. Windows NT: The XNUMX-bit Windows system directory. There is no WinXNUMX function that obtains the path of this directory, but it is searched. The name of this directory is SYSTEM.
XNUMX. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
XNUMX. The directories that are listed in the PATH environment variable.



The first directory searched is the one directory containing the image file used to create the calling process (for more information, see the CreateProcess function). Doing this allows private dynamic-link library (DLL) files associated with a process to be found without adding the process"s installed directory to the PATH environment variable.
Once the function obtains a fully qualified path to a library module file, the path is compared (case independently) to the full paths of library modules currently loaded into the calling process. These libraries include those loaded when the process was starting up as well as those previously loaded by LoadLibrary but not unloaded by FreeLibrary . If the path matches the path of an already loaded module, the function just increments the reference count for the module and returns the module handle for that library.



返回值

If the function succeeds, the return value is a handle to the module.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .

备注

LoadLibrary can be used to map a DLL module and return a handle that can be used in GetProcAddress to get the address of a DLL function. LoadLibrary can also be used to map other executable modules. For example, the function can specify an .EXE file to get a handle that can be used in FindResource or LoadResource .
Module handles are not global or inheritable. A call to LoadLibrary by one process does not produce a handle that another process can use




Страницы: 1 整个分支

论坛:“主要”;
当前存档:2002.01.08;
下载:[xml.tar.bz2];

楼上

Top.Mail.Ru Yandeks.Metrika













内存:0.78 MB
时间:0.036 c
3-21942

XNUMX-XNUMX-XNUMX XNUMX:XNUMX
2002.01.08
好人帮助存储过程。


1-22151
Koks
XNUMX-XNUMX-XNUMX XNUMX:XNUMX
2002.01.08
MDI -ClientForm


14-22368
小平头
XNUMX-XNUMX-XNUMX XNUMX:XNUMX
2002.01.08
IoT


7-22435
SSSSS
XNUMX-XNUMX-XNUMX XNUMX:XNUMX
2002.01.08
MASTERYYY !!! 生命和死亡的问题!!!!


1-22008
鳄鱼
XNUMX-XNUMX-XNUMX XNUMX:XNUMX
2002.01.08
HELP!





南非荷兰语 阿尔巴尼亚人 阿拉伯语 亚美尼亚 阿塞拜疆 巴斯克 白俄罗斯 保加利亚语 加泰罗尼亚 简体中文 中国(繁体) 克罗地亚 捷克 丹麦语 荷兰人 英语 爱沙尼亚语 菲律宾人 芬兰 法文
加利亚西语 格鲁吉亚语 德语 希腊语 海地克里奥尔语 希伯来语 印地语 匈牙利 北日耳曼语 印度尼西亚人 爱尔兰语 意大利语 日语 韩语 拉脱维亚 立陶宛 马其顿 马来语 马耳他语 挪威语
波斯语 波兰语 葡萄牙语 罗马尼亚 俄语 塞尔维亚 斯洛伐克 斯洛文尼亚 西班牙语 斯瓦希里 瑞典语 泰国人 土耳其 乌克兰 乌尔都语 越南人 威尔士语 意第绪语 孟加拉 波斯尼亚
宿务 世界语 古吉拉特语 豪萨语 苗族 伊博 爪哇 卡纳达语 高棉 老挝 拉丁语 毛利 马拉 蒙古人 尼泊尔 旁遮普 索马里 泰米尔人 泰卢固语 约鲁巴语
祖鲁
英文 Французский Немецкий Итальянский Португальский 俄文 Испанский