AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Problem mit dem IO-Warrior und IR

Ein Thema von rage2001 · begonnen am 15. Apr 2005 · letzter Beitrag vom 19. Apr 2005
 
Robert Marquardt
(Gast)

n/a Beiträge
 
#4

Re: Problem mit dem IO-Warrior und IR

  Alt 19. Apr 2005, 17:53
Sorry, ich habe deine Frage im CodeMercs Forum nicht gesehen.
Hier eine Beispiel DLL in Delphi:
Delphi-Quellcode:
library HIDinDLL;

uses
  Windows, Messages, SysUtils, Classes, Dialogs, Forms,
  DBT, JvHidControllerClass;

{$R *.res}

type
  // just an object to carry the methods
  TMethodObject = class(TObject)
  public
    procedure DLLDeviceChange(Sender: TObject);
    function EventPipe(var Msg: TMessage): Boolean;
  end;

var
  // the HID controller in a DLL
  HidCtl: TJvHidDeviceController;
  // an object to carry methods
  DLLHelperObject: TMethodObject;

// assigned to HidCtl.OnDeviceChange

procedure TMethodObject.DLLDeviceChange(Sender: TObject);
begin
  // just show that it works
  ShowMessage('DeviceChange happened');
end;

// this method is registered with Application.HookMainWindow and
// drives HidCtl externally

function TMethodObject.EventPipe(var Msg: TMessage): Boolean;
begin
  Result := False;
  // sort out WM_DEVICECHANGE : DBT_DEVNODES_CHANGED
  if (Msg.Msg = WM_DEVICECHANGE) and (TWMDeviceChange(Msg).Event = DBT_DEVNODES_CHANGED) then
    HidCtl.DeviceChange;
end;

procedure StartHID(hWnd: HWND); stdcall;
begin
  // assigns the Application object of the *DLL* a window to get messages from
  Application.Handle := hWnd;
  // create the HID controller
  HidCtl := TJvHidDeviceController.Create(nil);
  // create the helper object
  DLLHelperObject := TMethodObject.Create;
  // hook in the DLL
  Application.HookMainWindow(DLLHelperObject.EventPipe);
  // now the HID component works and can be used
  HidCtl.OnDeviceChange := DLLHelperObject.DLLDeviceChange;
end;

procedure StopHID; stdcall;
begin
  // clean up
  Application.UnhookMainWindow(DLLHelperObject.EventPipe);
  HidCtl.Free;
  DLLHelperObject.Free;
end;

exports
  StartHID,
  StopHID;

begin
end.
Das haengt wahrscheinlich damit zusammen das die DLL einen eigenen Memory-Manager hat.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz