Jump to content
Sign in to follow this  
matthieuvb

C++ Help

Recommended Posts

matthieuvb

I try to make a messagebox in c++, but it does not work!

int main()
{
    MessageBox(NULL, "hello", "this is a test", MB_OK);
}
And where can i find this libraries?

#include <iostream>
#include <windows.h>
can someone help me to make a good script and learn c++?

Tanks!


[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
Richard Robertson

What compiler are you using?

Share this post


Link to post
Share on other sites
matthieuvb

What compiler are you using?

No idea:)

stupid!

where can i find a good compiler?

Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
matthieuvb

You insult yourself....nice.....

did you even bother to read the sticky in this forum concerning books?

no.

where can I find?

i heave search for example scripts, for iostream and windows.h, and i try it again,

but if i press F11 then i see this message:

Posted Image

where can i find iostream and windows.h?

and how I let my script work?


[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
Kip

Can you understand english?

Because F11 is "Step Into", and you expect us to help you based on that screenshot. Do you even understand what that dialog says?

Share this post


Link to post
Share on other sites
matthieuvb

Can you understand english?

Because F11 is "Step Into", and you expect us to help you based on that screenshot. Do you even understand what that dialog says?

Do you even understand what that dialog says?

yes, there are errors with compile and if you like it to run the latest compiled version.

Can you understand english?

i am 12 years old, but i can a little bit english.

do i something wrong?

Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
Kip

do i something wrong?

Maybe hitting F5 from now on would be better.

You could start with posting the actual errors.

Share this post


Link to post
Share on other sites
matthieuvb

Maybe hitting F5 from now on would be better.

You could start with posting the actual errors.

This are the errors:

1>------ Build started: Project: TestMessageBox, Configuration: Debug Win32 ------
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\matthieu_2\documents\visual studio 2010\Projects\TestMessageBox\Debug\TestMessageBox.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

And if i press F5: same result

Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
Authenticity

You've chose Win32 GUI project type so you need to use the Win32 GUI main procedure, or create a Win32 Console project.

Win32 GUI main procedures should look like:

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
  // Code
  return 0;
}

or:

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{
  // Code
  return 0;
}

In Win32 Console project, the main procedure should look like:

int main(int argc, char* argv[])
{
  // Code
  return 0;
}
Edited by Authenticity

Share this post


Link to post
Share on other sites
matthieuvb

Wait, it works in Dev-C++!

And i heave the libraries now!

With this code:

#define _WIN32_DCOM
#include <iostream>
#include <windows.h>
#include <stdio.h>

using namespace std;

int main(){
    MessageBox(NULL, "hoi", "Test", 0);
}
but does not work in C++.

Posted Image

Tanks all!

PS: But how add an icon to the compiled version?

Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
wraithdu

I'm sorry, do I really have to be the first one to tell this kid to go read a book? There's a thread with suggestions. Come back when you have some fundamental knowledge, cause right now you don't, and it's a waste of everyone's time.

Share this post


Link to post
Share on other sites
E1M1

Why don't you use AutoIt? it's easier than C++. If you start learning you should choose easy language to start like AutoIt. C and asm should not be your first languages.

When I was 12 i started with Turbo Pascal then my next language was Rapid-Q and then there was 2 years pause until i found AutoIt.

After all this I still find C++ bit hard because it doesn't have such good help like Autoit has.

Edited by E1M1

edited

Share this post


Link to post
Share on other sites
matthieuvb

Why don't you use AutoIt? it's easier than C++. If you start learning you should choose easy language to start like AutoIt. C and asm should not be your first languages.

When I was 12 i started with Turbo Pascal then my next language was Rapid-Q and then there was 2 years pause until i found AutoIt.

After all this I still find C++ bit hard because it doesn't have such good help like Autoit has.

i use autoit too, its very easy!

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
matthieuvb

I told him to read a book and he ignored it. :mellow:

???

I don't have a book about C++!

Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
matthieuvb

Matthieu, here is a good place to start!

Thanks! i have a simple code with mesageboxes, and it works:

#include <iostream>
#include <windows.h>



int main()
{
    if (MessageBox(NULL, "Press a button.", "Test messagebox", MB_OKCANCEL)
    == IDOK)
    {
    MessageBox(NULL, "You pressed OK.", "Test messagebox", MB_OK);
    }
    else 
    {
    MessageBox(NULL, "You pressed CANCEL.", "Test messagebox", MB_OK);
    }
}
Code in AutoIt:

If MsgBox(1, "Press a button.", "Test messagebox") = 1 Then
    MsgBox(1, "You pressed OK.", "Test messagebox")
    Else
    MsgBox(1, "You pressed CANCEL.", "Test messagebox")
    EndIf
I have only one question now: how compile your c++ script with an icon? Edited by Matthieuautoitscripter

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites
E1M1

Never tried it. You gotta add ico as resource file. Notepad 2 is open source projec. you can learn from there.

there are also hacks out there to add icons in already compiled exes but it might make your exes not work or piss off antivirus or what ever it might do.

I have searched for this like year ago, and i didn't find how to add icon.


edited

Share this post


Link to post
Share on other sites
matthieuvb

Never tried it. You gotta add ico as resource file. Notepad 2 is open source projec. you can learn from there.

there are also hacks out there to add icons in already compiled exes but it might make your exes not work or piss off antivirus or what ever it might do.

I have searched for this like year ago, and i didn't find how to add icon.

OK, thanks for the tip.

[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×