I'm building an image processing toolkit in win32 (learning win32 as I'm building it unfortunately) and one operation takes forever to complete, so i want to display a title-less dialog that says "please wait" and lock the parent window (disable moving and focus).
my dialog:
IDD_WAIT DIALOGEX 0, 0, 147, 38
style DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU
EXstyle WS_EX_TOPMOST
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Decomposing Image - Please Wait",IDC_STATIC,20,15,114,8
END
and am displaying it as follows:
[/
case ID_FILE_CREATEDPTFROMIMAGE :
{
//get filename
char filename[MAX_PATH] = "";
getImageFilename(hWnd, filename);
//load image
if ( imgHandler.loadImage(filename) )
{
//create wait message
HWND hDlg = CreateDialog( hInst, MAKEINTRESOURCE(IDD_WAIT), hWnd, waitDialogProc );
ShowWindow(hDlg, SW_SHOW);
//center dialog
RECT rect, rectP;
int width, height;
int screenwidth, screenheight;
int x, y;
GetWindowRect(hDlg, &rect);
GetWindowRect(hWnd, &rectP);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
screenwidth = GetSystemMetrics(SM_CXSCREEN);
screenheight = GetSystemMetrics(SM_CYSCREEN);
//make sure that the dialog box never moves outside of
//the screen
if(x < 0) x = 0;
if(y < 0) y = 0;
if(x + width > screenwidth) x = screenwidth - width;
if(y + height > screenheight) y = screenheight - height;
MoveWindow(hDlg, x, y, width, height, FALSE);
//create FPT object and decompose
FPT fpt(imgHandler.getImg(), imgHandler.getWidth(), imgHandler.getHeight() );
fpt.decompose();
//close wait message
DestroyWindow(hDlg);
//updateControls();
}
else MessageBox(hWnd, "Invalid Image File!", "Image Load Error", MB_ICONERROR);
}
break;
now i'm having two problems, the first is that the dialog appears but the text doesnt?!?! and i have no idea why...
secondly how do i go about "locking" the parent so that the user cant do anything till the process finishes?