Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.04.25;
Скачать: CL | DM;

Вниз

Почему не работает?   Найти похожие ветки 

 
Vinivor   (2002-04-11 12:10) [0]

Привет всем!
Помогите чайнику плз %)

////////////////// roll.dll ///////////////////////////////
library roll;
uses
windows, Registry;
var reg:Tregistry;

function read_regedit_str(root_key:HKEY; reg_path,name_param:string):string; stdcall;
begin
Reg:=TRegistry.Create;
With Reg do
Try
Begin
RootKey:=root_key;
OpenKey(reg_path,true);
If ValueExists(name_param) then
Result:=Readstring(name_param);
CloseKey;
End;
Reg.CloseKey;
finally
Reg.Free;
end;
end;
exports read_regedit_str;

begin
end.

////////////////////////////////////////////////////////////////

////////////// use_roll.exe /////////////////////
unit Unit1;

interface

uses
Windows, Forms, registry, StdCtrls, Controls, Classes, sysutils,
ExtCtrls;

type --
TForm1 = class(TForm)
str: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
reg:tregistry;
implementation

function read_regedit_str(root:HKEY; reg_path,name_param:string):string stdcall; external "roll.dll";

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
label1.Caption:=read_regedit_str(HKEY_CURRENT_USER,"\Software\Microsoft\ Notepad","lfFaceName");
end;

end.
/////////////////////////////////////////////////////////////////

Не работает, и не пойму почему? Boolean и float работают, а string не хочет

Жду ответов :)


 
Виктор Щербаков ©   (2002-04-11 12:14) [1]

В файле проекта roll и use_roll и хоста в uses на первом месте запиши модуль ShareMem.
Но при распространении приложения придется таскать за ним bordmm.dll.


 
SVM   (2002-04-11 12:15) [2]

А кто же строки передает из DLL? Или PChar (ShortString),
или (цитата из файла проекта):

{ Important note about DLL memory management:
ShareMem must be the first unit in your library"s USES clause AND your project"s (select Project-View Source) USES clause if your DLL exports any procedures or functions that pass strings as parameters or function results.
This applies to all strings passed to and from your DLL--even those that are nested in records and classes.
ShareMem is the interface unit to the BORLNDMM.DLL shared memory manager, which must be deployed along with your DLL.
To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }



Страницы: 1 вся ветка

Текущий архив: 2002.04.25;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.01 c
3-80802
Glonia Zbanov
2002-04-05 10:58
2002.04.25
Народ! Обьясните конструкцию запроса.


14-81069
Oleg_V
2002-03-19 05:45
2002.04.25
Братья програмеры помогите, как зделать форму с неровными краями!!???


1-80893
vovan13
2002-04-14 18:17
2002.04.25
Как остановить бесконечный цикл?


14-81047
undersun
2002-03-13 17:21
2002.04.25
Как выбрать устройство через которое надо соед. по TCP/IP


3-80823
Alexandr_
2002-04-05 15:00
2002.04.25
ODAC. Проблема с чтением из BLOB