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

Вниз

ошибка при подключении dll   Найти похожие ветки 

 
babayka ©   (2005-02-18 18:33) [0]

Добрго времени суток !!!
Проблемочка вот в чем :
нашел в инете dll которая вызывает диалог выбора цвета с возможностью выбора разных систем координат...colorPicker.dll звется....вот я ее хочу вызвать диалог этот самый по нажатию кнопочки
unit UbuttonRGB;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 StdCtrls;

type
 TForm1 = class(TForm)
   Button1: TButton;
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;
 TRGBRec = record
    b, g, r, a : byte;
 end;
 PRGBRec = ^TRGBRec;
 TPickColorFunc = function(pParent : HWND; var colText, colBack :  TRGBRec) : cardinal; stdcall;

var
 Form1: TForm1;

 
implementation

{$R *.DFM}

var
 hModule : THandle;
 func : TPickColorFunc;
 ret : cardinal;
 colText, colBack : TRGBRec;

procedure TForm1.Button1Click(Sender: TObject);
begin

 func := TPickColorFunc(GetProcAddress(hModule, "PickColor"));
 if (not Assigned(func)) then
 begin
   FreeLibrary(hModule);
   Exit;
 end;

 ret := func(0, colText, colBack);
end;
initialization
  hModule := LoadLibrary("ColorPicker.dll");
 if (HModule = 0) then Exit;
end.



диалог открывается я выбираю цвет но при закрытии диалога постоянно выскакивает ошибка
Projeect PRbuttonRGB.exe raised exception class EFccess Violation with massage Access Violation at address 00000000 .Read of address 00000000.Process stopped.Use Step to Run to continue.


 
Poirot ©   (2005-02-18 18:43) [1]

Просто интересно - а гед ты делаешь FreeLibrary если у тя всё сработало хорошо?:) И вообще что-то у тя всё радикально в Exit:)


 
Набережных С. ©   (2005-02-18 18:45) [2]

Во-первых, вероятнее всего TRGBRec должен быть packed record. Во-вторых, уверен ли ты в правильности декларации функции? Ну и в-третьих, лучше спросить у авторов этой библиотеки.


 
babayka ©   (2005-02-18 19:04) [3]

попробовал вот такой код
unit UbuttonRGB;

interface

uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 StdCtrls;

type
 TForm1 = class(TForm)
   Button1: TButton;
   procedure Button1Click(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;
 TRGBRec = packed record
    b, g, r, a : byte;
 end;
 PRGBRec = ^TRGBRec;
 TPickColorFunc = function(pParent : HWND; var colText, colBack :  TRGBRec) : cardinal; stdcall;

var
 Form1: TForm1;

implementation

{$R *.DFM}
var
 hModule : THandle;
 func : TPickColorFunc;
 ret : cardinal;
 colText, colBack : TRGBRec;



procedure TForm1.Button1Click(Sender: TObject);
begin
 hModule := LoadLibrary("ColorPicker.dll");
 if (HModule = 0) then Exit;
 func := TPickColorFunc(GetProcAddress(hModule, "PickColor"));
 if (not Assigned(func)) then
 begin
   FreeLibrary(hModule);
   Exit;
 end;

 ret := func(0, colText, colBack);

end;

end.
результат к сожалению тот же...............


 
GuAV ©   (2005-02-18 22:06) [4]

Как функция описана в доке к DLL ?

Точно что stdcall ? возможно cdecl...



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

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

Наверх




Память: 0.47 MB
Время: 0.027 c
3-1107715766
Dionnis
2005-02-06 21:49
2005.03.06
Синхронизация структуры БД


1-1109225593
Screamer
2005-02-24 09:13
2005.03.06
Длина символа


1-1108671311
ASM
2005-02-17 23:15
2005.03.06
AutoLoad


6-1103738559
ancara
2004-12-22 21:02
2005.03.06
Как закрыть сеанс?


1-1108348081
first_aid
2005-02-14 05:28
2005.03.06
Скрытие показ колонок TListView?