What? Stops working? Ha!

I'm coding this program so I can use it in CMD (for the hell of it, it's just one of those "messing around" applications). It runs fine, but then the program stops working (on Win8 x64). What? How do I manage to get it working, but then it stops working? Huh?

Here's the code I'm working with, though I'm not sure how y'all can utilize it when it's such an odd situation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <windows.h>

int main(int argc, char* argv[]) {
    if (argc < 2) {
        MessageBox(HWND_DESKTOP, "ERROR: No text and/or title specified.", "ERROR", MB_OK);
    }
    if (argc > 3) {
        MessageBox(HWND_DESKTOP, "ERROR: Too many arguments specified.", "ERROR", MB_OK);
    }
    if (argc = 3) {
        MessageBox(HWND_DESKTOP, (LPCSTR)argv[1], (LPCSTR)argv[2], MB_OK);
    }
    return 0;
}


Any ideas? I don't get how it does this...
if (argc = 3) { should be if (argc == 3) { (two equals signs).
Don't use HWND_DESKTOP, too.
Use a plain 0.

And on line 4, it should be < 3
Last edited on
Topic archived. No new replies allowed.