Hi all!

I have a very strange problem.
I am making a Win32 program, using Visual C++ professional 2010. Everything works exactly as it should, until I want a MessageBox to appear. It appears, but I cant click any buttons. I also can't access my main API, so I can't close it in any way when I'm not debugging.

I'll post my code.

Thanks in advance! :)
Hidde

#include "stdafx.h"
#include <windows.h>
#include <Windows.h>
#include <iostream>
#include <sstream> 
#include <string>
#include <stdio.h>
#include <Commctrl.h>
#include "resource.h"
#include "cstring"
#include <atlstr.h>

using namespace std;

BOOL CALLBACK DialProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

void solve(HWND hwnd);
bool getint (HWND);
void check_b (HWND); int empty_b(int); int getemptynum_b(int);
void check_r (void); int empty_r(int); int getemptynum_r(int);
void check_c (void); int empty_c(int); int getemptynum_c(int);
void checkpos (void);
void checkwin (void);
void putint (HWND);

int num [83];
char put [83];
bool win, lose;


int __stdcall WinMain  (HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR    lpCmdLine,
	int       nCmdShow)
{

	DialogBox (hInstance, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialProc);
	return 0;
}

BOOL CALLBACK DialProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvent;
	PAINTSTRUCT ps;
	HDC hdc;

	switch (message) {

	case WM_INITDIALOG:


		break;

	case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);

		switch (wmId) {
		case IDC_SOLVE:
			solve (hwnd);
			MessageBox (hwnd, (LPCWSTR)L"Hi!", (LPCWSTR)L"H", MB_OK); // THIS IS WHERE IT ALL GOES WRONG, WHEN I PRESS THE SOLVE BUTTON.
			break;

		case IDCANCEL:
			PostQuitMessage(0);
			break;

		default:
			return DefWindowProc(hwnd, message, wParam, lParam);

		}
		break;

	case WM_PAINT:
		hdc = BeginPaint(hwnd, &ps);

		EndPaint(hwnd, &ps);
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;

	default:
		return DefWindowProc(hwnd, message, wParam, lParam);

	}
	return 0;
}

Haha, I understand that :P

What you say is exactly my problem. I cant click the OK button, nor the cross button to close it. It doesnt even 'pop in' like buttons do when you click them, just nothing.

Any help?

For a very short description of a dialog box procedure, see Dialogs. Especially your usage of DefWindowProc() in a dialog box procedure is a big no-no.

@MITrmkar

Thanks SOOOOOO much!!!!
I really appreciate your advice.
When I made my Dialog-based Win32 app, I forgot to change the

DefWindowProc()

to FALSE, as normally with DialogBoxes.
When I changed it, everything went back to normal, everything works now!

Cheers!
Hidde

This question has already been answered. Start a new discussion instead.