![]() |
Umgang mit PSafeArray
versuche folgenden Code in Pascal umzusetzen
benötigte Typbilblotheken hab ich importiert Microsoft IMAPI2 Base Functionality Microsoft IMAPI2 File system Image Creator
Code:
soweit so gut
' This script examines the burn device characteristics such as
' product ID, product revision level, feature set, and profiles. ' Copyright (C) Microsoft Corp. 2006 Option Explicit ' Constants const IMAPI_FEATURE_PAGE_TYPE_DVD_DASH_WRITE = 47 WScript.Quit(Main) Function Main Dim Index ' Index to recording drive. Dim Recorder ' Recorder object Dim Path ' Directory of files to burn Dim Stream ' Data stream for burning device Index = 1 ' Second drive on the system ' Create a DiscMaster2 object to connect to CD/DVD drives. Dim g_DiscMaster Set g_DiscMaster = WScript.CreateObject("IMAPI2.MsftDiscMaster2") ' Create a DiscRecorder object for the specified burning device. Dim uniqueId set recorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2") uniqueId = g_DiscMaster.Item(Index) recorder.InitializeDiscRecorder( uniqueId ) ' *** - Formatting to display recorder info WScript.Echo "--------------------------------------------------" Wscript.Echo " ActiveRecorderId: " & recorder.ActiveDiscRecorder Wscript.Echo " Vendor Id: " & recorder.VendorId Wscript.Echo " Product Id: " & recorder.ProductId Wscript.Echo " Product Revision: " & recorder.ProductRevision Wscript.Echo " VolumeName: " & recorder.VolumeName Wscript.Echo " Can Load Media: " & recorder.DeviceCanLoadMedia Wscript.Echo " Device Number: " & recorder.LegacyDeviceNumber
Delphi-Quellcode:
Procedure TForm5.FormCreate(Sender: TObject);
Var Index, I, X: Integer; UniqueId, Temp: String; SupportedFeature: Integer; Safe, VolumePath, CurrentFeature: PSafeArray; MountPoint : Variant; Begin Index := 0; UniqueId := DiscMaster2.Item[Index]; DiscRecorder2.InitializeDiscRecorder(UniqueId); Memo1.Lines.Add('--------------------------------------------------'); Memo1.Lines.Add(' ActiveRecorderId: ' + DiscRecorder2.ActiveDiscRecorder); Memo1.Lines.Add(' Vendor Id: ' + DiscRecorder2.VendorId); Memo1.Lines.Add(' Product Id: ' + DiscRecorder2.ProductId); Memo1.Lines.Add(' Product Revision: ' + DiscRecorder2.ProductRevision); Memo1.Lines.Add(' VolumeName: ' + DiscRecorder2.VolumeName); Memo1.Lines.Add(' Can Load Media: ' + BoolToStr(DiscRecorder2.DeviceCanLoadMedia,True)); Memo1.Lines.Add(' Device Number: ' + Inttostr(DiscRecorder2.LegacyDeviceNumber)); DiscRecorder2.VolumePathNames ist ein PSafeArray
Code:
Dim mountPoint
For Each mountPoint In recorder.VolumePathNames WScript.Echo " Mount Point: " & mountPoint Next
Delphi-Quellcode:
for i := 0 to DiscRecorder2.VolumePathNames.cbElements -1 do
begin Memo1.Lines.Add(' Mount Point: ' + PChar(DiscRecorder2.VolumePathNames[i].pvData)); //Array typ erforderlich end; End; |
AW: Umgang mit PSafeArray
Wenn man mit gedrückter Strg-Taste mit der linken Maustaste auf ".pvData" klickt, wo landet man da und was steht da genau?
|
AW: Umgang mit PSafeArray
Liste der Anhänge anzeigen (Anzahl: 1)
na PSafeArray is so:
Delphi-Quellcode:
definiertPSafeArray = ^TSafeArray; {$EXTERNALSYM tagSAFEARRAY} tagSAFEARRAY = record cDims: Word; fFeatures: Word; cbElements: LongWord; cLocks: LongWord; pvData: Pointer; rgsabound: array[0..0] of TSafeArrayBound; end; TSafeArray = tagSAFEARRAY; Kann ja nicht gehen heist ja nicht umsonst PSafeArray aber
Delphi-Quellcode:
führt zuCopyMemory(@Safe,DiscRecorder2.VolumePathNames,DiscRecorder2.VolumePathNames.CbElements); For I := 0 To DiscRecorder2.VolumePathNames.CbElements - 1 Do Begin Memo1.Lines.Add(' Mount Point: ' + (Safe[I])); End; [dcc32 Fehler] Main.pas(115): E2149 Klasse besitzt keine Standardeigenschaft |
AW: Umgang mit PSafeArray
Dir ist schon klar das PSafeArray ein Zeiger auf ein record/struct ist und kein Array?
Delphi-Quellcode:
Vielleicht hilft dir das auch weiter?
PSafeArray = ^TSafeArray;
{$EXTERNALSYM tagSAFEARRAY} tagSAFEARRAY = record cDims: Word; fFeatures: Word; cbElements: LongWord; cLocks: LongWord; pvData: Pointer; rgsabound: array[0..0] of TSafeArrayBound; end; TSafeArray = tagSAFEARRAY; {$EXTERNALSYM SAFEARRAY} SAFEARRAY = TSafeArray; ![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:47 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