vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Erstellen von dynamischen Kontextmen?s - wann immer Sie sie brauchen!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Visual-Basic Einsteiger
Also hier die Umsetzung aus C++ 
Autor: unbekannt
Datum: 20.04.02 16:39

Hi Daniel,

so mal

Der Original C-Code:

#include "sddim_dll.h"
#include <conio.h>
#include <ctype.h>
#include <stdio.h>
 
// Global Variables
SCSI_Info		mySCSI_Info[100];		// Information about 100 (who owns them?) SCSI _
  drives 
int 			amount_of_disk_devices;		// amount of SCSI Disk Devices connected to PC
 
 
// shows all present SCSI Disk Drives
void show_devices()
{
	int i,j;
	char mytext[]="0:0:0                                                      ";
 
	// show disk devices
	for (i=0;i<amount_of_disk_devices;i++)
	{
		mytext[0]=mySCSI_Info.HaId+0x30;
		mytext[2]=mySCSI_Info.Target+0x30;
		for (j=0;j<40;j++) mytext[7+j]=mySCSI_Info.Name[j];
		printf("%i) %s
",i,mytext);
	}
}
 
 
// main()
int main()
{
	BOOL loop;
 
	printf("Drive Image Maker V1.0 - Console Version
(c)2000-2002 ");
	// init WNASPI32.DLL	
	if (Init_WNASPI32()==FALSE)
		printf("WNASPI32.DLL not present or no SCSI Host Adapters found!
");
 
	// WNASPI32.DLL was successfully load now go on...
	else
	{
		int i;
 
 
		// scan SCSI Bus for Disk drives and store Disk Drive(s) information and _
  amount 
		// of Disk Drives ; 
		// also prevent medium removal for all found disk devices
		amount_of_disk_devices=Scan_SCSI_Bus(mySCSI_Info, TRUE);
 
		// If no Disk Devices were found exit.......
		if (amount_of_disk_devices==0)
			printf("No SCSI Disk Drives found!
"); 
		else
		while (loop)
		{
			char key;
			printf("please choose: 
 
m) make image
s) store image
x) exit
 
");
			key=_getch();
			switch(key)
			{
			case 'x': loop=FALSE; break;
			case 'm': 
				{
					printf("MAKE IMAGE - please choose source drive:
");
					show_devices();
					key=0;
					do key=_getch();
					while (key<'0' && key>('0'+amount_of_disk_devices));
					printf("please wait... making image 'c:\test.sdi'
");
					// hier wird die funktion "makeImage" aufgerufen!!!
					Make_Image(mySCSI_Info,key-'0', "c:\test.sdi");
					break;
				}
			case 's': 
				{
					printf("STORE IMAGE - please choose destination drive:
");
					show_devices();
					key=0;
					do key=_getch();
					while (key<'0' && key>('0'+amount_of_disk_devices));
					printf("please wait... storing image 'c:\test.sdi'
");
					// hier wird die funktion "makeImage" aufgerufen!!!
					Store_Image(mySCSI_Info,key-'0', "c:\test.sdi");
					break;
 
 
					break;
				 }
			}
		}
 
		// re-allow medium removal for all devices ....
		for (i=0; i<amount_of_disk_devices; i++) 
			SCSI_Prevent_Medium_Removal(mySCSI_Info, FALSE);			
 
	}
 
	// exit application....
	return 0;
}
Und hier die VB-Umsetzung:

' #include "sddim_dll.h"
'
Private Type SCSI_Info
    Hald As Long                                    'Host Adapter ID
    Target As Long                                 'SCSI Target
    lPtrName As String                          'Ptr auf String mit 64 Bytes
    BlockSize As Long                           'Size of one logical Block
    Amount_of_Blocks As Long          'Anzahl of logical Blocks
End Type
 
Private Declare Function InitializeDLL Lib "wnaspi32.dll" Alias _
     "Init_WNASPI32" () As Long
 
Private Declare Function ScanSCSI Lib "wnaspi32.dll" Alias _
     "Scan_SCSI_Bus" _
     (ByRef lptrSCSIInfo As Long, _
      ByVal nTrueFalse As Long) As Long
 
Private Declare Sub SCSIPrevent Lib "wnaspi32.dll" Alias _
    "SCSI_Prevent_Medium_Removeal" _
    (ByRef lptrSCSIInfo As Long, _
     ByVal nTrueFalse As Long)
 
Private Declare Function StoreImage Lib "wnaspi32.dll" Alias _
    "Store_Image" _
    (ByRef lptrSCSIInfo As Long, _
     ByVal Drive As Long, _
     ByRef sPtrFileName) As Long
 
Private Declare Function MakeImage Lib "wnaspi32.dll" Alias _
    "Make_Image" _
    (ByRef lptrSCSIInfo As Long, _
     ByVal Drive As Long, _
     ByRef sPtrFileName) As Long
 
Private Declare Sub CopyMemory Lib "kernel32" Alias _
    "RtlMoveMemory" _
    (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
 
' // Global Variables ... SCSI_Info mySCSI_Info[100];
' // Information about 100 (who owns them?) SCSI drives
 
Private mySCSI_Info(100) As SCSI_Info
Private amount_of_Disk_Devices As Long ' // amount of SCSI Disk Devices 
' connected to PC
 
Sub Main()
    Dim rVal As Long
    Dim jn As Integer
    Dim nDrive As Integer
 
    ' WNASPI32.DLL initialisieren
    rVal = InitializeDLL()
    If rVal = 0 Then
       MsgBox "WNASPI32.DLL not present or no SCSI Host Adapters found!", _
         vbCritical, "Abbruch"
       Exit Sub
    End If
 
    ' // scan SCSI Bus for Disk drives and store Disk Drive(s) information and 
    ' amoun of Disk Drives
    ' // also prevent medium removal for all found disk devices
    amount_of_Disk_Devices = ScanSCSI(mySCSI_Info, True)
 
    ' // If no Disk Devices were found exit.......
    If amount_of_Disk_Devices = 0 Then
         MsgBox "No SCSI Disk Drives found!", vbExclamation, "Abbruch"
         Exit Sub
    End If
 
    show_devices
 
    ' Im nachfolgenden wird gefragt, ob man eine Image erstellen
    ' will oder eine Image speichern will.
    jn = MsgBox("Wollen Sie eine Image erstellen oder eine Image speichern. " & _
      String(2, vbCrLf) & _
                "Drücken Sie <JA> wenn Sie eine Image erstellen wollen." & _
                vbCrLf & _
                "Drücken Sie <Nein> wenn Sie eine Image speichern wollen." & _
                vbCrLf & _
                "Drücken Sie <Abbrechen> wenn Sie die Aktion abbrechen wollen", _
                vbQuestion + vbYesNoCancel, "Frage:")
    If jn = vbCancel Then Exit Sub
 
    If jn = vbYes Then 'Image erstellen
       nDrive = InputBox("Bitte geben Sie die Nummer des Laufwerks ein:", _
         "Laufwerkauswahl")
       If nDrive < 0 Or nDrive > amount_of_Disk_Devices Then Exit Sub
 
       ' Im nachfolgenden ist ein Pfad "hardgecodet"
       MakeImage mySCSI_Info, nDrive, "C:	est.sdi"
    End If
 
    If jn = vbNo Then 'Image in Drive speichern
       nDrive = InputBox("Bitte die Nummer des Laufwerks an.", "Dateiangabe" & _
         "erwartet")
       If nDrive < 0 Or nDrive > amount_of_Disk_Devices Then Exit Sub
       StoreImage mySCSI_Info, nDrive, "C:	est.sdi"
    End If
End Sub
 
' // shows all present SCSI Disk Drives
Private Sub show_devices()
    Dim i As Long, j As Long
    Dim myText As String
    Dim a As String
 
    For i = 0 To amount_of_Disk_Devices - 1
       myText = mySCSI_Info(i).Hald + " "
       myText = myText + mySCSI_Info(i).Target + " "
       a = Space(64)
 
       ' Zeiger auf String in Var A umsetzen
       CopyMemory ByVal a, mySCSI_Info(i).lPtrName, 64
       myText = myText + Trim(a)
 
       ' Stringausgabe - wohin? mhm eine Listbox auf die Form!
       List1.AddItem myText
 
    Next
End Sub
cu
Lordchen
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
DLL aufrufen mit VB47Daniel19.04.02 18:01
Re: DLL aufrufen mit VB229unbekannt19.04.02 19:10
Re: DLL aufrufen mit VB32Daniel19.04.02 20:32
Schicke mir mal den C-Quell247unbekannt19.04.02 20:36
Re: Schicke mir mal den C-Quell31Daniel19.04.02 21:45
Hi Für einen VS-Enterpriser ...208unbekannt19.04.02 21:52
Also:234unbekannt20.04.02 12:39
DANKE !!29Daniel20.04.02 15:13
Also hier die Umsetzung aus C++240unbekannt20.04.02 16:39
Au, die UDT zeigt ja auf long ...214unbekannt20.04.02 17:27
grrr Mouse zu schnell für Lordchen 208unbekannt20.04.02 17:29
Schon wieder DANKE!!31Daniel20.04.02 17:54
Na, es kommen bestimmt Probs .. (oT)195unbekannt20.04.02 18:05
Hast recht !!27Daniel20.04.02 19:34
Re: Hast recht !!195unbekannt21.04.02 01:35
Aber schon einen Sieg zu verzeichnen 197unbekannt21.04.02 01:45
Re: Aber schon einen Sieg zu verzeichnen 38Daniel21.04.02 02:20
Mit etwas, was ich noch nicht mal testen kann? support?212unbekannt21.04.02 02:55
Wie übergibt man ein UDT-Array?279unbekannt21.04.02 12:45
Re: Wie übergibt man ein UDT-Array?45Daniel21.04.02 19:29
Re: Wie übergibt man ein UDT-Array?26Daniel21.04.02 20:26
Womit Du Recht hast,267unbekannt21.04.02 21:22
hmm61Daniel21.04.02 21:53
Ganz einfach:208unbekannt21.04.02 22:30
Re: Ganz einfach:25Daniel21.04.02 22:53
Re: Ganz einfach:24Daniel22.04.02 08:28

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel