[Win32API] Dlg Proc not working?

so I have this code

http://pastebin.com/bS4tZmtX

but message in Tab<number>DlgProc is not working, when I add MessageBox BEFORE switch it will spam message boxes, BUT when I'll add MessageBox anyhwere inside of any callback it won't do anything...

resource

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
// Generated by ResEdit 1.5.11
// Copyright (C) 2006-2012
// http://www.resedit.net

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"




//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_MAIN DIALOG 0, 0, 407, 246
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_CLIPSIBLINGS | WS_GROUP | WS_TABSTOP | WS_POPUP | WS_SYSMENU
CAPTION "Heroes of Newerth Hero Creator v0.1"
CLASS "HON HC"
FONT 8, "Ms Shell Dlg"
{
    CONTROL         "", IDC_TABCONTROL, WC_TABCONTROL, 0, 23, 15, 50, 30
}



LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TAB_FIVE DIALOGEX 1, 13, 296, 220
STYLE DS_SETFONT | WS_VISIBLE | WS_CHILDWINDOW
FONT 8, "Ms Shell Dlg", 0, 0, 1
{
}



LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TAB_FOUR DIALOGEX 1, 13, 296, 220
STYLE DS_SETFONT | WS_VISIBLE | WS_CHILDWINDOW
FONT 8, "Ms Shell Dlg", 0, 0, 1
{
}



LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TAB_ONE DIALOGEX 1, 13, 296, 220
STYLE DS_SETFONT | WS_VISIBLE | WS_CHILDWINDOW
FONT 8, "Ms Shell Dlg", 0, 0, 1
{
    EDITTEXT        IDC_HERONAME, 11, 31, 64, 14, ES_AUTOHSCROLL
    LTEXT           "Hero Name", IDC_STATIC, 11, 22, 37, 8, SS_LEFT
    COMBOBOX        IDC_FACTION, 11, 55, 64, 30, CBS_DROPDOWN | CBS_HASSTRINGS
    LTEXT           "Faction", IDC_STATIC, 11, 46, 24, 8, SS_LEFT
    PUSHBUTTON      "Stats", IDC_BSTATS, 18, 70, 50, 14
    EDITTEXT        IDC_DIFF, 85, 55, 64, 14, ES_AUTOHSCROLL | ES_NUMBER
    LTEXT           "Category", IDC_STATIC, 85, 22, 29, 8, SS_LEFT
    LTEXT           "Difficulty", IDC_STATIC, 85, 46, 28, 8, SS_LEFT
    COMBOBOX        IDC_CAT, 85, 31, 64, 30, CBS_DROPDOWN | CBS_HASSTRINGS
    PUSHBUTTON      "Sounds", IDC_BSOUNDS, 18, 85, 50, 14
    PUSHBUTTON      "Effects", IDC_BEFFECTS, 92, 70, 50, 14
    PUSHBUTTON      "Models", IDC_BMODELS, 92, 85, 50, 14
    LISTBOX         IDC_LRITEMS, 11, 133, 138, 57, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_SORT | LBS_NOTIFY
    LTEXT           "Recommended Items", IDC_STATIC, 11, 124, 68, 8, SS_LEFT
    PUSHBUTTON      "+", IDC_BRIA, 128, 191, 21, 14
    PUSHBUTTON      "-", IDC_BRIR, 106, 191, 21, 14
}



LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TAB_THREE DIALOGEX 1, 13, 296, 220
STYLE DS_SETFONT | WS_VISIBLE | WS_CHILDWINDOW
FONT 8, "Ms Shell Dlg", 0, 0, 1
{
}



LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TAB_TWO DIALOGEX 1, 13, 296, 220
STYLE DS_SETFONT | WS_VISIBLE | WS_CHILDWINDOW
FONT 8, "Ms Shell Dlg", 0, 0, 1
{
}



//
// Icon resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_ICON1          ICON           ".\\hon_logo.ico"


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif

#define IDD_MAIN                                101
#define TAB_ONE                                 102
#define TAB_TWO                                 103
#define TAB_THREE                               104
#define TAB_FOUR                                105
#define TAB_FIVE                                106
#define IDI_ICON1                               113
#define IDC_TABCONTROL                          1001
#define IDC_HERONAME                            1002
#define IDC_FACTION                             1004
#define IDC_CAT                                 1010
#define IDC_DIFF                                1011
#define IDC_BSOUNDS                             1015
#define IDC_BSTATS                              1016
#define IDC_BEFFECTS                            1017
#define IDC_BMODELS                             1018
#define IDC_LRITEMS                             1020
#define IDC_BRIR                                1023
#define IDC_BRIA                                1024 
http://www.cplusplus.com/forum/windows/ Win32, MFC, ATL, C++/CLI, .NET ...
*cough* post whore *cough*
The way you are registering/creating the TabOne, TabTwo, etc dislog boxes is
not quite the same method you are using to create the Main Dialog window
(there is a long explanation I can give if you want it).

Change the TabOneDlPproc, TabTwoDlgProc, .......etc.. to use the standard
WM_INITDIALOG message like this and see if it works;
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
BOOL CALLBACK TabOneDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	
    
    case WM_INITDIALOG:
 			SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_ADDSTRING, NULL, (LPARAM)Faction[0].c_str());
			SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_ADDSTRING, NULL, (LPARAM)Faction[1].c_str());
			SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_SETCURSEL, (WPARAM)1, NULL);   
        return TRUE;

    //case MY_WM_INITDIALOG:
		//{
			//SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_ADDSTRING, NULL, (LPARAM)Faction[0].c_str());
			//SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_ADDSTRING, NULL, (LPARAM)Faction[1].c_str());
			//SendMessage(GetDlgItem(hWnd, IDC_FACTION), CB_SETCURSEL, (WPARAM)1, NULL);
		//}
		//break;
	//case WM_CREATE:
		//{
			//PostMessage(hWnd, MY_WM_INITDIALOG, 0, 0);
		//}
		//break;
	case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{

			}
			break;
		}
	}
	return DefWindowProc(hWnd, msg, wParam, lParam);
}

ooo yeah I forgot about that, so when I'm not using WNDCLASSEX I don't have to create custom callback ? or in other words, when I'm not using WNDCLASSEX I don't have to use CREATE but INITDIALOG callback?

- it's working, thanks!
Topic archived. No new replies allowed.