Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


First question with C++
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 3:55 pm    Post subject: First question with C++ Reply with quote

Edit: Fixed Rolling Eyes
_________________


Last edited by AndrewMan on Tue Jul 01, 2008 11:00 am; edited 1 time in total
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Jun 29, 2008 4:10 pm    Post subject: Reply with quote

What are you trying to do?
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 4:22 pm    Post subject: Reply with quote

samuri25404 wrote:
What are you trying to do?


Just a simple Form, with a button, click the button and it shows "hello world!"

_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Jun 29, 2008 4:27 pm    Post subject: Reply with quote

You'll probably want to start off with a console application.

It's not nearly as easy as VB.NET, and no where similar to it either.

Look up some tutorials on it.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 4:29 pm    Post subject: Reply with quote

samuri25404 wrote:
You'll probably want to start off with a console application.

It's not nearly as easy as VB.NET, and no where similar to it either.

Look up some tutorials on it.


I got it to work with a console app. I can't find any tuts for like what it would be called a "message box" in .Net

_________________
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sun Jun 29, 2008 4:34 pm    Post subject: Reply with quote

that would be MessageBox
http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

_________________
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 4:43 pm    Post subject: Reply with quote

HalfPrime wrote:
that would be MessageBox
http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx


Oh man this C++ is intense, so much different than .Net

If I make a form, than put a button on it, I don't get where I put this code? Keeps giving me "Link" Errors.

Code:
int DisplayResourceNAMessageBox()
{
    int msgboxID = MessageBox(
        NULL,
        (LPCWSTR)L"Resource not available\nDo you want to try again?",
        (LPCWSTR)L"Account Details",
        MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2
    );

    switch (msgboxID)
    {
    case IDCANCEL:
        // TODO: add code
        break;
    case IDTRYAGAIN:
        // TODO: add code
        break;
    case IDCONTINUE:
        // TODO: add code
        break;
    }

    return msgboxID;
}

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 29, 2008 5:09 pm    Post subject: Reply with quote

Get the basics down with console stuff first before you jump into windows. THEN read http://www.winprog.org/tutorial/index.html and understand it.

Anyway...

Quote:
If the function succeeds, the return value is one of the following menu-item values.

...


int msgboxID is simply going to hold the return value of MessageBox, depending on what it returns, we do something.

Code:
int msgboxID;
      msgboxID = MessageBox(hWnd, "Text", "Title", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2);

      switch (msgboxID)
      {
      case IDCANCEL:
         MessageBox(hWnd, "CANCEL", "1", MB_OK);
         break;
      case IDTRYAGAIN:
         MessageBox(hWnd, "TRYAGAIN", "2", MB_OK);
         break;
      case IDCONTINUE:
         MessageBox(hWnd, "CONTINUE", "3", MB_OK);
         break;
      }
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 8:31 pm    Post subject: Reply with quote

Still not getting any of this, ill just stay with console for a while.. Shocked
_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 29, 2008 8:50 pm    Post subject: Reply with quote

AndrewMan wrote:
Still not getting any of this, ill just stay with console for a while.. Shocked


What don't you get? I'll try to explain it better.

But, sticking with the console for now might be a good idea... or you can just do it from the console heh.

Code:
#include <windows.h>

int mb;
int main(){
   mb = MessageBox(NULL, "Text", "Title", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2);
   switch (mb)
   {
   case IDCANCEL:
      MessageBox(NULL, "CANCEL", "1", MB_OK);
      break;
   case IDTRYAGAIN:
      MessageBox(NULL, "TRYAGAIN", "2", MB_OK);
      break;
   case IDCONTINUE:
      MessageBox(NULL, "CONTINUE", "3", MB_OK);
      break;
   }
}
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Jun 29, 2008 8:55 pm    Post subject: Reply with quote

I recommend reading this:
http://www.cplusplus.com/doc/tutorial/

If your going to go into Win32 API then you'll wanna read this as well:
http://www.winprog.org/tutorial/

And by Win32 API I mean what slovach's code snippet.

MessageBox is an API.
It's .NET Equivilent would be
MessageBox::Show(...)

_________________
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 11:30 pm    Post subject: Reply with quote

Where do I put this? can you explain the steps for me just on how to make a form than add a button, than put this code into the button?

I think I can get started once I learn that.

and @Lurc, thanks for the links! I will check them out in a bit. Very Happy

Code:
#include <windows.h>

int mb;
int main(){
   mb = MessageBox(NULL, "Text", "Title", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2);
   switch (mb)
   {
   case IDCANCEL:
      MessageBox(NULL, "CANCEL", "1", MB_OK);
      break;
   case IDTRYAGAIN:
      MessageBox(NULL, "TRYAGAIN", "2", MB_OK);
      break;
   case IDCONTINUE:
      MessageBox(NULL, "CONTINUE", "3", MB_OK);
      break;
   }
}

_________________
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sun Jun 29, 2008 11:44 pm    Post subject: Reply with quote

We can't help you if you know shit about the API or C++. Read the tutorials and start off with making a basic window. It will go into more difficult concepts. You are just trying to go with a snippet and force learn >.>

And what the hell sort of snippet is that anyways?

I suggest the winprog tut by forgey.

_________________
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Sun Jun 29, 2008 11:50 pm    Post subject: Reply with quote

blankrider wrote:
We can't help you if you know shit about the API or C++. Read the tutorials and start off with making a basic window. It will go into more difficult concepts. You are just trying to go with a snippet and force learn >.>

And what the hell sort of snippet is that anyways?

I suggest the winprog tut by forgey.


I don't get the point of making a window when you can make a form that already has a window?

And no one answered my question yet. What do I make? a Win32 App? or a CLR? Or is it just an empty project, and in the sourcle files I add .cpp?

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Jun 29, 2008 11:58 pm    Post subject: Reply with quote

AndrewMan wrote:
Where do I put this? can you explain the steps for me just on how to make a form than add a button, than put this code into the button?

I think I can get started once I learn that.

and @Lurc, thanks for the links! I will check them out in a bit. Very Happy

Code:
#include <windows.h>

int mb;
int main(){
   mb = MessageBox(NULL, "Text", "Title", MB_ICONWARNING | MB_CANCELTRYCONTINUE | MB_DEFBUTTON2);
   switch (mb)
   {
   case IDCANCEL:
      MessageBox(NULL, "CANCEL", "1", MB_OK);
      break;
   case IDTRYAGAIN:
      MessageBox(NULL, "TRYAGAIN", "2", MB_OK);
      break;
   case IDCONTINUE:
      MessageBox(NULL, "CONTINUE", "3", MB_OK);
      break;
   }
}


That's not just a snippet, it's an entire console program. (That I brilliantly forgot to return 0 in)

AndrewMan wrote:
blankrider wrote:
We can't help you if you know shit about the API or C++. Read the tutorials and start off with making a basic window. It will go into more difficult concepts. You are just trying to go with a snippet and force learn >.>

And what the hell sort of snippet is that anyways?

I suggest the winprog tut by forgey.


I don't get the point of making a window when you can make a form that already has a window?

And no one answered my question yet. What do I make? a Win32 App? or a CLR?


CLR is managed code, you'd be right back to where you started.


You're getting ahead of yourself. Get the basics down, when you feel comfortable, go read the forgers stuff, and read it well. Win32 is simple enough to jump into if you have some footing... which you don't yet.

Some ideas, start off with your typical hello world in the console. Then maybe move onto a calculator. A calculator is a good project where you can put things like loops and handling input to use.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites