![]() |
Problem mit CD/DVD Notification
Hat jemand eine Idee warum das unter Vista & Delphi 2006
nicht funktioniert. Erst wenn ich das Program schließe kommt die Message WM_DEVICECHANGE! type TOnDeviceArrived = procedure(Sender: TObject; Drive: Char) of object; TOnDeviceQueryRemove = procedure(Sender: TObject; Drive: Char; var CanRemove: Boolean) of object; TJvDeviceChanged = class(TJvComponent) private FHandle: THandle; FOnDeviceArrived: TOnDeviceArrived; FOnDeviceRemoveCompleted: TOnDeviceArrived; function GetFirstDriveLetter(UnitMask: Longint): Char; procedure WndProc(var Msg: TMessage); public procedure WMDeviceChange(var Msg: TWMDeviceChange); constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property OnDeviceArrived: TOnDeviceArrived read FOnDeviceArrived write FOnDeviceArrived; property OnDeviceRemoveCompleted: TOnDeviceArrived read FOnDeviceRemoveCompleted write FOnDeviceRemoveCompleted; end; procedure Register; implementation uses JvJVCLUtils; // (rom) change to RegisterWndProcHook mechanism? constructor TJvDeviceChanged.Create(AOwner: TComponent); begin inherited Create(AOwner); FHandle := AllocateHWndEx(WndProc); end; destructor TJvDeviceChanged.Destroy; begin DeallocateHWndEx(FHandle); inherited Destroy; end; procedure TJvDeviceChanged.WndProc(var Msg: TMessage); begin sendMessage(HWND_BROADCAST,WM_USER + 7,0,0); if Msg.Msg = WM_DEVICECHANGE then WMDeviceChange(TWMDeviceChange(Msg)) else Msg.Result := DefWindowProc(FHandle, Msg.Msg, Msg.wParam, Msg.lParam); end; |
Re: Problem mit CD/DVD Notification
Benutz bitte die Delphi Tags. Dann kann man den Source auch besser lesen
|
Re: Problem mit CD/DVD Notification
Die Komponente wurde aber nicht in einem Thread erstellt?
|
Re: Problem mit CD/DVD Notification
Zitat:
Delphi-Quellcode:
protected
procedure WMDeviceChange(var Msg: TMessage); dynamic; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:11 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