Yet another windows questions

When I run my application it says Window creation failed, I think its cause of my header file, but I will include my main.cpp, and my resources.

1
2
3
4
5
6
7
8
9
10
#ifndef OCRUNNER_H_INCLUDED
#define OCRUNNER_H_INCLUDED

#define IDI_REDXICON 777
#define REDXPIC 101
#define RedX_Menu 106
#define RedX_Menu_Icon
#define Windows_RedXOrginization 105
#define Console_Application_RedXOrginization
#endif // OCRUNNER_H_INCLUDED 


Header File

Next the Resource File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35


#include "OcRunner.h"


// IDI_REDXICON ICON "RedXIcon.ico"

RedX_Menu MENU
BEGIN
POPUP "&Play"
BEGIN
MENUITEM "Windows Version(Recomended)", Windows_RedXOrginization
MENUITEM "Command Prompt Version(Less Recomended)", 0, GRAYED
MENUITEM "2D Version (Not Yet Available, wait for updates)", 0, GRAYED
MENUITEM "3D Version (Not Yet Available, wait for updates)", 0, GRAYED
END
POPUP "&File"
BEGIN
MENUITEM "Open File Folder",0, GRAYED
MENUITEM "Open Exe Location",0,GRAYED
END
POPUP "&Credit"
BEGIN
MENUITEM "Adam Talbott, Age 17, Helped with the cursor, and beta tested", 0, GRAYED
MENUITEM "Michael Rubenstein, Age 14, Beta Tester", 6, GRAYED
END
POPUP "&Others"
BEGIN
MENUITEM "KeyBind", 0, GRAYED
MENUITEM "Calculater", 0, GRAYED
MENUITEM "Website", 0, GRAYED
MENUITEM "System Requirements", 0, GRAYED
END
END


and lastly the main.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107




#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#include <stdlib.h>
#include <iostream>
#include <windows.h>
#include <math.h>
#include <fstream>
#include <string.h>
#include "OcRunner.h"

using namespace std;
int derp;

const char g_szClassName[] = "myWindowClass";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_LBUTTONDOWN:
        {
            char szFileName[MAX_PATH];
            HINSTANCE hInstance = GetModuleHandle(NULL);

            GetModuleFileName(hInstance, szFileName, MAX_PATH);
            MessageBox(hwnd, szFileName, "This program is:", MB_OK | MB_ICONINFORMATION);
        }
        break;
        case WM_CLOSE:
            DestroyWindow(hwnd);
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        case WM_CREATE:

        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = 0;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REDXICON));
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = MAKEINTRESOURCE(RedX_Menu);
    wc.hIconSm       = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_REDXICON));

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, "Window Registration Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }


    hwnd = CreateWindowEx(
        WS_EX_APPWINDOW,
        g_szClassName,
        "Custom Story(Red X Orginization)",
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, 2000, 900,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, "Window Creation Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }



    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }
    return Msg.wParam;
}



anyone? :/
nvm fixed it.
Topic archived. No new replies allowed.