stickman, How long do you expect myFunction to take? If it takes a short time then even if you got the dialog to display before it was executed then it would disapear pretty quickly. If it will take a long time and you want myFunction to update the dialog's progress control, multithreading is your answer.
Code:
case WM_INITDIALOG:
hProgress = CreateWindowEx(0,PROGRESS_CLASS,NULL,WS_CHILD | WS_VISIBLE,5,35,76,20,hWndDlg,0,hInst,NULL);
SendMessage(hProgress, PBM_SETRANGE, 0, MAKELPARAM(0,100));
SendMessage(hProgress, PBM_SETSTEP, (WPARAM)5, 0);
DWORD dwID;
HANDLE hThread=CreateThread(NULL, 0, (LPVOID)&MyFunction, hWndDlg, 0, &dwID,);
CloseHandle(hThread);
);
return true;