FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


FRoMeGame's C++ Questions





fromegame
Hiya,

I'm trying to learn C++ a bit. So please be gentle, I'm new in this Wink..

Well, my problem: I'm trying to make something, that if the cd-drive closes, a popup comes to ask if I want to run the game, that's on the disc. How can I check if the cd-drive is closed. Well, not if it's closed, but at the moment it closes.

What I have now:

Code:

#include "stdafx.h"
#include <iostream>
#include <Windows.h>

using namespace std;

int main() {
   int Result;
   Result = MessageBox(NULL,L"Do you wanna start xxx?",L"Confirm",MB_YESNO|MB_ICONQUESTION );
   switch(Result) {
      case IDYES:
         cout << "Starting xxx.................\n";
         WinExec("C:\\%programfiles%\\xxx", SW_MAXIMIZE);
         break;
      case IDNO:
         cout << "Aborting program.................\n";
         break;
   }
   return 0;
}


Another option is the autorun from Windows. But I don't know how I can get my program in the autorun from Windows.

I need help with this.

Thanks in advance!

PS: I'm using Microsoft Visual Studio 2005
Nyizsa
fromegame wrote:
Another option is the autorun from Windows. But I don't know how I can get my program in the autorun from Windows.


Create a file called autorun.inf on the CD, containing
Code:
[autorun]
OPEN=xxx.exe

You can also add
Code:
ICON=xxx.ico

if you want file managers to display an icon instead of the standard CD icon.

Creating an other autorun function in C++ is an overkill, or at least reinventing the wheel.
fromegame
Ok ty..

Well, I got another problem now.. my application works on my computer. But it doesn't work on other computers.

It says: System.IO.FileLoadException

Is it possible this has to do something that I make these programs under Windows Vista?
I want to make my programs work on other computers too...
(The type I'm using is: Visual C++ Windows Forms Application.

Thanks in advance. Wink
catscratches
I don't know about Visual C++ , but I recommend Dev-C++ from Bloodshed.
Nyizsa
fromegame wrote:
Ok ty..

Well, I got another problem now.. my application works on my computer. But it doesn't work on other computers.

It says: System.IO.FileLoadException

Is it possible this has to do something that I make these programs under Windows Vista?

Do you link to any specific library?

fromegame wrote:
I want to make my programs work on other computers too...
(The type I'm using is: Visual C++ Windows Forms Application.

Or does this program link to one without your knowledge?
fromegame
Never mind, C++ is something too hard for me, I'll start with VB Wink

PS: This can be locked.
Indi
fromegame wrote:
Never mind, C++ is something too hard for me, I'll start with VB Wink

PS: This can be locked.

You're just using the wrong tools. Visual Studio is awful for beginners. It's so bloated and over complex that half the time you don't even know whether or not you're actually compiling a C++ program. Case in point:
fromegame wrote:
Well, I got another problem now.. my application works on my computer. But it doesn't work on other computers.

It says: System.IO.FileLoadException

That format looks more like Java or C#.

It's quite possible you were building a CLI application, not a native C++ application. If the other computer didn't have the CLI (aka, .NET) libs, it wouldn't run. Or... any one of a number of other things. Hard to say. i've been programming for over a decade, and i can't figure half of the crap in Visual Studio out.

If you really want to learn C++, get rid of Visual Studio (or get someone to teach you how to actually use it, which is a task in itself... better just to get rid of it). Get something simpler like Dev-C++.
fromegame
Thanks, I'll try that Smile
abhinavm24
the error probably is because the file you compiled is probably not found to run on other devices,
OR may be the c# dependencies on windows version makes it non compatible for ceertain pc(s).
just try loading compiled file and autorun.inf both on the disk.
Then it shoud work correctly,Also try using C++ as its more of and free language added to it use dev C++ IDE by bloodshed.
I am using it and it fairly simple and intutive. Very Happy
Related topics
C#,Visual Basic.NET,Visual Studio.NET Videos
To Moderators: Should C++ questions be in "scripting&am
Embarrassing newbie php/SQL questions
Good HTML tutorials
[C#] Safe place to store information
C/C++
Applying for C# .NET Developer Position
Satre, Russel, Ayer Philosophy questions
C# or 3Ds max or FL studio teaching needed 500Frih$
Greetings!
Learn C/C++ to make free software?
C++ Program Basics
C++ Discusssion Group
Make c++ script more efficient?
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.