Главная страница
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.012 c
1-80863
Chainik
2002-04-13 15:15
2002.04.25
Функциональные клавиши


1-80875
Gayrus
2002-04-13 06:59
2002.04.25
A : Array of array of String


3-80835
MixVictor
2002-03-31 21:19
2002.04.25
Установка фильтра


1-80998
Андрей Сенченко
2002-04-12 13:22
2002.04.25
Хочу порисовать на форме :)


3-80806
B_A_V
2002-04-05 12:07
2002.04.25
Правое контекстное меню