Click here to Skip to main content
15,924,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Display Strings Pin
choramale_vs7-Sep-09 0:41
choramale_vs7-Sep-09 0:41 
GeneralRe: Display Strings Pin
Stuart Dootson7-Sep-09 2:35
professionalStuart Dootson7-Sep-09 2:35 
QuestionNon Blocking message Box Pin
trioum6-Sep-09 20:18
trioum6-Sep-09 20:18 
AnswerRe: Non Blocking message Box Pin
Stuart Dootson6-Sep-09 20:23
professionalStuart Dootson6-Sep-09 20:23 
AnswerRe: Non Blocking message Box Pin
Randor 6-Sep-09 21:49
professional Randor 6-Sep-09 21:49 
QuestionHow Could we make a field or fields of database primary key for that database using Dao Database? Pin
A&Ms6-Sep-09 16:42
A&Ms6-Sep-09 16:42 
AnswerRe: How Could we make a field or fields of database primary key for that database using Dao Database? Pin
Stuart Dootson6-Sep-09 20:21
professionalStuart Dootson6-Sep-09 20:21 
QuestionModal Dialogs HELP!!! Pin
sixstorm6-Sep-09 15:22
sixstorm6-Sep-09 15:22 
Hi everyone,

I have a modal dialog box which is called by the main thread. This dialog has no parent (appears at center screen, overlapped, and shown in taskbar). When the user clicks "Save" in the dialog, the dialog procedure receives the command and displays a save file dialog (GetSaveFileName).
The problem is that the second dialog (Save Dialog) doesn't work at all. It can't be activated, and seems kind of frozen (can't be closed, buttons and scroll bars are frozen). Here's my code:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	DialogBox(hInstance, MAKEINTRESOURCE(101), NULL, DialogProc);
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0) != 0)
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return (int)msg.wParam;
}

INT_PTR CALLBACK DialogProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
HDC hdc; PAINTSTRUCT ps;
switch (message) {
	case WM_COMMAND:
		switch(LOWORD(wParam)) {
			case IDSAVE:
				OPENFILENAME OFN;
				OFN.hwndOwner = hWnd;
				[...]
				//PROBLEM IS HERE. The save file dialog is half-frozen and never returns.
				if (GetSaveFileName(&OFN)) {[...]}
				break;
			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
		}
		return true;
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		EndPaint(hWnd, &ps);
		break;
	case WM_INITDIALOG:
		[...]
		return true;
	case WM_CLOSE:
		[...]
		return true;
	case WM_DESTROY:
		[...]
		return true;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return false;
}


Whatever dialog type I put at this line (print dialog, modal dialog, modeless dialog), it doesn't behave properly. What am I missing?
I tried with OFN.hwndOwner = NULL, but doesn't work.

Thanks in advance!
AnswerRe: Modal Dialogs HELP!!! Pin
Iain Clarke, Warrior Programmer6-Sep-09 21:52
Iain Clarke, Warrior Programmer6-Sep-09 21:52 
GeneralRe: Modal Dialogs HELP!!! Pin
sixstorm7-Sep-09 6:34
sixstorm7-Sep-09 6:34 
AnswerRe: Modal Dialogs HELP!!! Pin
sixstorm7-Sep-09 8:08
sixstorm7-Sep-09 8:08 
QuestionActivating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm6-Sep-09 11:01
amitalonm6-Sep-09 11:01 
AnswerRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
Saurabh.Garg6-Sep-09 21:24
Saurabh.Garg6-Sep-09 21:24 
GeneralRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm7-Sep-09 13:08
amitalonm7-Sep-09 13:08 
QuestionRe: Activating the PC's speaker using C++ for until I will need to stop - how ? (Beep, thread, and more)... Pin
amitalonm8-Sep-09 0:00
amitalonm8-Sep-09 0:00 
QuestionThe dll of IDB_VIEW_SMALL_COLOR Pin
Joel Holdsworth6-Sep-09 6:59
Joel Holdsworth6-Sep-09 6:59 
Questionis there a way to read message from the local port Pin
rj47566-Sep-09 3:59
rj47566-Sep-09 3:59 
AnswerRe: is there a way to read message from the local port Pin
Iain Clarke, Warrior Programmer6-Sep-09 9:03
Iain Clarke, Warrior Programmer6-Sep-09 9:03 
Question« Precompiled header file error » Pin
bzsolt916-Sep-09 2:21
bzsolt916-Sep-09 2:21 
QuestionRe: « Precompiled header file error » Pin
Rajesh R Subramanian6-Sep-09 3:47
professionalRajesh R Subramanian6-Sep-09 3:47 
QuestionQuickBooks simple questions Pin
John Developer5-Sep-09 23:29
John Developer5-Sep-09 23:29 
AnswerRe: QuickBooks simple questions Pin
Luc Pattyn6-Sep-09 1:08
sitebuilderLuc Pattyn6-Sep-09 1:08 
QuestionODS_HOTLIGHT not work Pin
thanhvinh09065-Sep-09 21:49
thanhvinh09065-Sep-09 21:49 
AnswerRe: ODS_HOTLIGHT not work Pin
Code-o-mat5-Sep-09 23:43
Code-o-mat5-Sep-09 23:43 
GeneralRe: ODS_HOTLIGHT not work Pin
thanhvinh09066-Sep-09 3:06
thanhvinh09066-Sep-09 3:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.