Zugriff auf CD-Laufwerk

Übersicht BlitzBasic Allgemein

Gehe zu Seite 1, 2  Weiter

Neue Antwort erstellen

littleRabbit

Betreff: Zugriff auf CD-Laufwerk

BeitragMi, Jan 28, 2004 21:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi!

Kennt jemand einen Befehl, mit dem man das CD-Laufwerk öffnen kann?
 

HOT-BIT

Gast

BeitragMi, Jan 28, 2004 22:07
Antworten mit Zitat
Hi !

Ja. Aber ich weiß nicht, ob der hilft:

Hey Alte, drück mal auf den rechten Knopf vom CD-Laufwerk !

Smile

Toni

Vertex

BeitragMi, Jan 28, 2004 22:33
Antworten mit Zitat
Benutzer-Profile anzeigen
http://blitzbasic.com/codearcs...p?code=464
vertex.dreamfall.at | GitHub
 

NForcer

BeitragMi, Jan 28, 2004 23:12
Antworten mit Zitat
Benutzer-Profile anzeigen
if Meshescollide(Finger , Handx(),Handy(),Handz(), CDlaufwerk, Compx(),Compy,Compz()) and Knopfdrück(1) = 1 then cdLaufwerköffnen = 1

if cdLaufwerköffnen = 1 then
CD laufwerk öffnet sich
end if


lol,okok is nen spamm aber trotzdem lustisch ;)

Freeman

BeitragDo, Jan 29, 2004 10:11
Antworten mit Zitat
Benutzer-Profile anzeigen
schau ma in die WinAPI fa gibt es solch einen Befehl auch, sogar zum einlesen etc.
MacBook | MacOSX 10.5 | 80GB HDD | 1GB | BlitzMax 1.28

Mattis_the_brain

BeitragDo, Jan 29, 2004 13:38
Antworten mit Zitat
Benutzer-Profile anzeigen
Ertstelle eine htmldatei mit folgendem code:
Code: [AUSKLAPPEN]

<SCRIPT language=VBScript>
<!--

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection

if colCDROMs.Count >= 1 then
   For i = 0 to colCDROMs.Count - 1
      colCDROMs.Item(i).Eject
   Next ' cdrom
End If

-->
</SCRIPT>


Die datei einfach über bb öffnen und offen ist dein laufwerk. Very Happy

ViciouS

BeitragDo, Jan 29, 2004 16:01
Antworten mit Zitat
Benutzer-Profile anzeigen
Man ham wir hier Scherzbolde und Witzkekse im Forum ^^

Da kommt ne arme Sau und stellt ne vernünftige Frage und wird gleich 2 mal verarscht Laughing
Skaten ist scheisse...
Bilanz: 3 Knochenbrüche in 4 Jahren...
und es werden mehr Laughing
 

Apocalyptic

BeitragDo, Jan 29, 2004 16:26
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
Global Bank1

CreateCDDoorBank()

CallDLL("winmm.dll","mciExecute",Bank1)

Function CreateCDDoorBank()
   CDOpen$="Set CDaudio Door Open"
   Bank1=CreateBank(Len(CDOpen$) + 1)

   For i = 1 To Len(CDOpen$)
      PokeByte Bank1,i-1,Asc(Mid$(CDOpen$,i,1))
   Next

   PokeByte Bank1,i-1,0
End Function


Müsste eigentlich funktionieren
Suum cuique

[ www.ffs-net.de.vu ] [ Raycaster ]

TheShadow

Moderator

BeitragDo, Jan 29, 2004 21:43
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn das mit VB-Script funktioniert - dann ist es nicht nur erschreckend, das ist auch KATASTROPHAL!!!! Für sowas müssen MS'ler gehängt werden... Und dann erzählen MS'ler noch was von Sicherheit
AMD64 3500+ | GeForce6600GT 128MB | 1GB DDR | WinXPsp2

Vertex

BeitragDo, Jan 29, 2004 22:26
Antworten mit Zitat
Benutzer-Profile anzeigen
Apocalyptic: Du brauchst nicht Codes doppelt posten Wink
OT:
TS: Man sollte ja auch Standartmäßig Windows Scripting Host deaktiviert haben Wink
vertex.dreamfall.at | GitHub
 

Apocalyptic

BeitragFr, Jan 30, 2004 17:38
Antworten mit Zitat
Benutzer-Profile anzeigen
@Vertex: Sorry, hab mir den Link nicht angesehen...
Suum cuique

[ www.ffs-net.de.vu ] [ Raycaster ]

littleRabbit

BeitragFr, Jan 30, 2004 19:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke, danke! Aber... gibt es auch einen "Befehl", mit dem man das Laufwerk wieder schließen kann?

Vertex

BeitragSa, Jan 31, 2004 12:06
Antworten mit Zitat
Benutzer-Profile anzeigen
Gegenteil von "open" ist ???? ... Richtig "closed"
Übrigens das ganze mal als Userlib:
Zitat:
.lib "winmm.dll"
mciExecute%(lpstrCommand$) : "mciExecute"

Code: [AUSKLAPPEN]
; öffnen
mciExecute("Set CDaudio door open")
; 2 sekunden warten und dann wieder schließen
Delay 2000
mciExecute("Set CDaudio door closed")

mfg olli
vertex.dreamfall.at | GitHub
 

judos

BeitragDi, Jul 13, 2004 8:52
Antworten mit Zitat
Benutzer-Profile anzeigen
könnte man das ganze auch noch als ein einziges programm haben?

Jan_

Ehemaliger Admin

BeitragDi, Jul 13, 2004 10:42
Antworten mit Zitat
Benutzer-Profile anzeigen
hä, noch wünsche offen?

Userlib
Code: [AUSKLAPPEN]

.lib "winmm.dll"
mciExecute%(lpstrCommand$) : "mciExecute"


Code: [AUSKLAPPEN]
Print "Bitte Orginal CD einlegen"
; öffnen
mciExecute("Set CDaudio door open")
; 2 sekunden warten und dann wieder schließen
Delay 2000
mciExecute("Set CDaudio door closed")
between angels and insects
 

judos

BeitragDi, Jul 13, 2004 11:10
Antworten mit Zitat
Benutzer-Profile anzeigen
aber "mciexecute" ist doch far kein richtiger befehl oder er ist jedenfalls nicht unter der onlinehilfe zu finden !?!?!?!?!??!

BladeRunner

Moderator

BeitragDi, Jul 13, 2004 11:13
Antworten mit Zitat
Benutzer-Profile anzeigen
Das wird ja auch erst mit der Userlib als benutzbarer Befehl verankert, Judos.
mciExecute ist ein Befehl der in der winmm.dll enthalten ist und auf den du per Userlib zugreifst.
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92
 

judos

BeitragDi, Jul 13, 2004 11:33
Antworten mit Zitat
Benutzer-Profile anzeigen
also welche codes muss ich jetzt in mein programm eintippen damit es keine fehlermeldung anzeigt (function not found) ??

BladeRunner

Moderator

BeitragDi, Jul 13, 2004 11:41
Antworten mit Zitat
Benutzer-Profile anzeigen
Du musst die userlib einbinden, dann gibt es keine Fehlermeldung mehr.
Wie das geht (englische Anleitung) steht in deinem Userlibs-Ordner der in deinem Blitzverzeichnis mit angelegt wurde.

Userlibs hat Folgendes geschrieben:
ew DLL interface spec
----------------------

There is now a directory in the root blitzpath called 'userlibs'.

By adding DLLs and '.decls' files to this directory, you can extend blitz's command set.

DLLs contain actually library code, while .decls files contain 'declarations' to be added to the
base command set. These declarations describe the functions contained in the Dll.


Format of decls files
---------------------

Decls files should always start with a '.lib' directive, followed by the quoted name of the DLL to be
loaded, eg:

.lib "mylib.dll"

Following the .lib is a list of function declarations. The syntax of these is identical to
function declarations in Blitz, with the following exceptions:

* No default parameter values are allowed.

* If no function return type is specified, the function is a 'void' function - ie: it returns nothing.

* Instead of object parameters, you can only specify 'void*' parameters using a '*' type tag. Such
parameters can be assigned ANY object or bank, so BE CAREFUL!

* A declaration may be optionally followed by a 'decorated name'. This takes the form of a ':'
followed by a quoted string denoting the decorated name, eg:

MyFunction( text$ ):"_MyFunction@4"
MessageBox%( hwnd,text$,title$,style ):"MessageBoxA"

The decorated name is the name of the function as it appears in the dll, and only needs to be
specified if it is different from the actual function name.


Writing DLLs
------------

All functions MUST use the _stdcall calling convention.

Floats are passed and returned as per standard C/C++ conventions.

Strings are passed and returned in 'C' format - ie: a pointer to a null-terminated sequence of
characters.

Returned strings must be in a 'static' memory buffer. Once the function returns, this string is
immediately copied into an internal Blitz style string, so its OK to share this buffer between
multiple functions.

Both banks and objects can be passed to functions. The value passed is the address of the first byte
of storage. No information is sent regarding the size or type of memory passed so, again, BE CAREFUL!

Neither Banks or objects can be returned from functions.

Arrays are not supported at all.

VisualC decorates symbols quite heavily! If you are coding in 'C', the necessary stdcall specifier
will cause a '_' to be prepended, and a '@' (followed by the number of bytes passed to the function
- ie: number of parameters*4) to be appended. So, something like: 'void _stdcall MyFunc( int x )'
will end up as '_MyFunc@4'. In C++, the name decoration is even messier! But you can supress it by
using the 'extern "C"' feature (see examples below) so you're just left with the 'C' stdcall mess.

Other languages such as Delphi and Purebasic don't appear to suffer from this feature, but it can be
worthwhile looking through dll symbols if you're having problems. Check out PEview at
http://www.magma.ca/~wjr Open your dll and select 'SECTION .rdata'/'EXPORT address table'
to have a look at the exported symbols your compiler has seen fit to bestow upon your dll.

Example
-------

Ok, here's a little C++ example, as it would appear in VisualC.

First, we write the DLL:

//demo.dll
//
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define BBDECL extern "C" _declspec(dllexport)
#define BBCALL _stdcall

//returns a float and has 6 float parameters
BBDECL float BBCALL VecDistance( float x1,float y1,float z1,float x2,float y2,float z2 ){
float dx=x1-x2,dy=y1-y2,dz=z1-z2;
return sqrtf( dx*dx+dy*dy+dz*dz );
}

//returns a string and has one string parameter
BBDECL const char * BBCALL ShuffleString( const char *str ){
static char *_buf;

int sz=strlen(str);

delete[] _buf;
_buf=new char[ sz+1 ];
strcpy( _buf,str );

for( int k=0;k<sz;++k ){
int n=rand()%sz;
int t=_buf[k];_buf[k]=_buf[n];_buf[n]=t;
}

return _buf;
}
After building this, the resultant 'demo.dll' should be placed in the userlibs directory.

Now, we also need to create a 'demo.decls' file, describing the functions in our dll. This file
is also placed in the userlibs directory:

.lib "demo.dll"
VecDistance#( x1#,y1#,z1#,x2#,y2#,z2# ):"_VecDistance@24"
ShuffleString$( str$ ):"_ShuffleString@4"

...Voila! The next time Blitz is started up, the new commands appear within the IDE and can be used.


Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92
 

Timo

BeitragDi, Jul 13, 2004 14:53
Antworten mit Zitat
Benutzer-Profile anzeigen
jo, nur das ich bei mir api_ vorschreiben muss, also api_mciExecute("Set CDaudio door open"), irgendwo gibts alle Befehle für die winmm.dll als .decls zum downloaden aber ich weis nicht mehr wo... glaub bei blitzcoder.com

Gehe zu Seite 1, 2  Weiter

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group