Server Help

Non-Subspace Related Coding - Eject and Closing CD/DVD tray. (C++)

BDwinsAlt - Tue Mar 21, 2006 5:50 pm
Post subject: Eject and Closing CD/DVD tray. (C++)
How do I go about Opening and Closing my CD and/or DVD drive.
I've looked around on google but nothing seems to work. I figured one of you guys may know how. I'll keep searching while i wait for a reply. I'm not giving up :p

Ignore the name below, i just typed in the first word i saw when i was making the project.

I get these errors:

Code: Show/Hide

c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(18): error C2447: '{' : missing function header (old-style formal list?)
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(18): error C2143: syntax error : missing ';' before '{'
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(17): error C2182: 'CDRomOpen' : illegal use of type 'void'
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(17): error C2146: syntax error : missing ')' before identifier 'bOpenDrive'
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(17): error C2065: 'BOOL' : undeclared identifier
c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\virus\virus.cpp(17): error C2059: syntax error : ')'



I'm using this code:

Code: Show/Hide

#include <iostream>
#include <cstdlib>
#include <stdio.h>

using namespace std;

main()
{
   int response;
   printf("Type '1' to continue.\n");
   cin >> response;
   if(response == 1){
     void CDRomOpen();
   }
}

void CDRomOpen(BOOL bOpenDrive, char *drive)
{
    MCI_OPEN_PARMS open;
    DWORD flags;

    ZeroMemory(&open, sizeof(MCI_OPEN_PARMS));

    open.lpstrDeviceType = (LPCSTR) MCI_DEVTYPE_CD_AUDIO;
    open.lpstrElementName = drive;

    flags = MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID;

    if (!mciSendCommand(0, MCI_OPEN, flags, (DWORD) &open))
    {
        mciSendCommand(open.wDeviceID, MCI_SET, (bOpenDrive) ?
                       MCI_SET_DOOR_OPEN : MCI_SET_DOOR_CLOSED, 0);
        mciSendCommand(open.wDeviceID, MCI_CLOSE, MCI_WAIT, 0);
    }
}

Dr Brain - Tue Mar 21, 2006 6:56 pm
Post subject:
main doesn't have a type. You need to use either void main or int main.
LearJett+ - Tue Mar 21, 2006 8:20 pm
Post subject:
Push the button.
BDwinsAlt - Wed Mar 22, 2006 12:04 am
Post subject:
Still getting the same errors.
Muskrat - Wed Mar 22, 2006 12:24 am
Post subject: Re: Eject and Closing CD/DVD tray. (C++)
BDwinsAlt wrote:

Code: Show/Hide

   if(response == 1){
     void CDRomOpen();
   }


When you call a function, dont put a return type.
CypherJF - Wed Mar 22, 2006 10:12 am
Post subject:
He really needs to take that line and bump it above the main method.
Smong - Wed Mar 22, 2006 11:17 am
Post subject:
You seem to be mixing c and c++ headers: (although that's not your problem)
Code: Show/Hide
#include <iostream>
#include <cstdlib>
#include <stdio.h>

Do a search on prototypes and what they are in the context of programming c/c++.
Mr Ekted - Wed Mar 22, 2006 1:00 pm
Post subject:
#include "windows.h"
Mr Ekted - Wed Mar 22, 2006 1:01 pm
Post subject:
Before main do:

void CDRomOpen (BOOL, char *);

And when you call a function, you need to pass it params of the type(s) that it takes. In this case, something like:

CDRomOpen(1, "d:")
Cyan~Fire - Wed Mar 22, 2006 11:00 pm
Post subject:
Mr Ekted wrote:
#include "windows.h"

<windows.h>?
Mr Ekted - Wed Mar 22, 2006 11:06 pm
Post subject:
I never use the angle brackets.
hellzlaker - Sun Apr 09, 2006 7:02 pm
Post subject:
LearJett+ wrote:
Push the button.
LMAO LMAOOOO thats funny =) and correct
wEaViL - Sun Apr 09, 2006 11:06 pm
Post subject:
I have nothing to contribute but judging from the name of the file imma take a shot in the dark and say your making one of them virus trick programs that pretends to do all that wack stuff to a comp as a prank? Just curious icon_lol.gif
Anonymous - Mon Apr 10, 2006 8:18 am
Post subject:
wEaViL wrote:
I have nothing to contribute but judging from the name of the file imma take a shot in the dark and say your making one of them virus trick programs that pretends to do all that wack stuff to a comp as a prank? Just curious icon_lol.gif


Yea, I was going to make my mom think she had a virus. I didn't want to give her a real one. Just one that makes messages pop-up and cdrom eject and all. I got the message boxes working. My mom always blames me if her pc messes up and I always use my own pc. I wanna see her blame me again icon_lol.gif
D1st0rt - Mon Apr 10, 2006 11:24 am
Post subject:
You want to see her blame you for making her computer act funny after you make her computer act funny?

Am I missing something?
Cerium - Mon Apr 10, 2006 12:05 pm
Post subject:
This is more immature than all of my 'kill yourself' comments combined.

Why go through all of the effort to make something as useless as this? Hell, why not just install VNC then open the SEEDEEROM from your computer. LOLOLOLZ! SHED BE LIKE WTF AND YOUD GO OMG LOL! AND SHED BE LIKE BDALTWINS GET DOWN HERE AND FIX0RZ MY COMPZ!

I dont see why you goddamn 15 year olds are so fuckin obsessed with making people think you made a virus. Nothing earns trust like a program that fucks with someones computer. Hey, why dont you tell your mom she can speed up her computer by adding "format C: /y" to her autoexec.bat.

God I hate you kids; grow the fuck up, or... you know... kill yourselves.
Bak - Mon Apr 10, 2006 6:14 pm
Post subject:
no way man, have fun with coding while you're young
BDwinsAlt - Mon Apr 10, 2006 6:24 pm
Post subject:
Bak wrote:
no way man, have fun with coding while you're young

I like Bak. He's cool. 8)
Cerium - Mon Apr 10, 2006 10:26 pm
Post subject:
Have fun doing what exactly? Writing malicious and useless software? Why dont you just teach him how to edit IRC trojans, setup a botnet and ddos people, all in the name of fun.
This entire project is a fucking waste of time -- especially since he didnt even write the goddamn function that actually opens or closes the CDRom, hes just calling it from his broken ass program.

Dont encourage this script kiddie bullshit. People like you and I have to deal with dumbass users who are on the receiving end of this faggots 'fun'.
Bak - Tue Apr 11, 2006 3:24 am
Post subject:
You have to chillax cerium, I doubt he's going to release his cd-rom opening program into the wild. He's just playing a prank on his parents and maybe picking up some c++ in the process.
Cerium - Tue Apr 11, 2006 10:29 am
Post subject:
Yeah, for now.
Where do you think the next step is? "Oh, well that was fun tricking my mother, I think Ill write a new compression algo now". Sorry, it wont work that way -- this is only going to escalate.
BDwinsAlt - Tue Apr 11, 2006 5:39 pm
Post subject:
I just wanted to learn gosh. I wasn't going to release anything remotely harmful to anyone. If I wanted to do evil things to people I would send them the Prorat trojan. I tried 4 anti-viruses to get rid of it. So later I used a special process manager and deleted the process then deleted all the infected files and files protecting it. I don't plan on making that happen to anyone else. I just wanted to have some fun and show my mom what I learned how to do. You freak out because I don't understand everything yet. Here's a little something, you learn little by little. You can't spell a word until you know how to write the letters. Please just help me along the way of the right path. All I ask is for a little respect, ok. I don't care how much you hate me, just show a little respect. It won't kill you, if it does then maybe it's for the best.
Cerium - Tue Apr 11, 2006 6:14 pm
Post subject:
BDwinsAlt wrote:
I just wanted to learn gosh. I wasn't going to release anything remotely harmful to anyone.


Your mother qualifies as 'anyone'.


BDwinsAlt wrote:
If I wanted to do evil things to people I would send them the Prorat trojan. I tried 4 anti-viruses to get rid of it. So later I used a special process manager and deleted the process then deleted all the infected files and files protecting it.


This only qualifies as a very loosly fitting metaphore.


BDwinsAlt wrote:
I don't plan on making that happen to anyone else. I just wanted to have some fun and show my mom what I learned how to do.


So make something useful, or you could go the ultra sissy route and make something cheesy like a mothers day popup or birthday notice. There are literally hundreds of thousands of other things you could do that (a) show off what youve 'learned' and (b) dont piss off the person youre demonstrating for. Use a little common sense.


BDwinsAlt wrote:
You freak out because I don't understand everything yet.


No, Im 'freaking out' because theres this annoying trend with you non-adult teenagers where you seem to think its l33t to take what little programming knowledge you have and use it to try to fuck with somebody. Its an awful way to advance your abilities and removes any trust people had in you.


BDwinsAlt wrote:
Here's a little something, you learn little by little. You can't spell a word until you know how to write the letters.


Youre right, you do learn little by litte, but why do you insist on taking these baby steps down the path of the script kiddie with a language you clearly dont understand yet?
The word metaphore is also as terrible as your first one. When you were learning how to read and write, how many times did the teacher have you write death threats to your parents?


BDwinsAlt wrote:
Please just help me along the way of the right path.


Ill help people when (a) Im damn sure I know what Im talking about and (b) their project doesnt have malicious intent. So far I havent seen you do anything that meets both of these qualifications.


BDwinsAlt wrote:
All I ask is for a little respect, ok. I don't care how much you hate me, just show a little respect. It won't kill you, if it does then maybe it's for the best.


Ill respect you when you do something respectable. Take a look around these forums and who I reply to. Ever notice how the only people I flame are those who are under the age of 18? Try to find a post where Im ripping into D1st0rt, Ekted or MGB. Just try.

Im sick of your halfassed attempts at justification. What youre doing is wrong, plain and simple. Theres no gray area here. If you want to learn how to program, great. There are books, tutorials, free code and people all over the internet for you to learn from. There is absolutely no reason for you to be making applications like this. If you honestly believe this is the best way for you to learn, then I ask that you stay the fuck out of my field.
D1st0rt - Tue Apr 11, 2006 11:50 pm
Post subject:
Don't be like this guy:
http://forums.minegoboom.com/viewtopic.php?t=5393
SpecShip - Wed Apr 12, 2006 2:48 am
Post subject:
I'm siding with Cerium.
BD, you're a dumbass.

Also, why goto lengths of quirky buggy virus when you can just install VNC and fuck up with her PC any way you want in real time.

Hell, you can make GOD speak to her via notepad...
Bak - Wed Apr 12, 2006 7:00 am
Post subject:
Maybe he wants to learn to code while doing something fun.
Cerium - Wed Apr 12, 2006 12:24 pm
Post subject:
Probably. But why does fun have to be synonymous with destructive? Some of my first projects were really bad attempts at making games. I remember writing a game that played worse than those really old super mario bros. wrist-watch games. Everything about it was terrible; the lack of AI, input handling sucked and the sprites were labels that had an 'x' or an 'o' on them. Even still, my friends through it was the coolest thing, and that made the project fun for me.
Cyan~Fire - Wed Apr 12, 2006 7:44 pm
Post subject:
Hehe.
Anonymous - Wed Apr 12, 2006 8:21 pm
Post subject:
Cyan~Fire wrote:
Hehe.

Great, you find where I found the code to begin with. Did you try to get it to work?
Cyan~Fire - Fri Apr 14, 2006 12:15 pm
Post subject:
Ekted already told you exactly how to work it. This is pitiful.
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group