Display Dialog Box Then Execute

This is a discussion on Display Dialog Box Then Execute within the C++ Programming forums, part of the General Programming Boards category; Thanks for clarifying that for me. I actually think I saw "ID" in an example somewhere and decided to use ...

  1. #16
    Registered User
    Join Date
    Aug 2004
    Posts
    193
    Thanks for clarifying that for me. I actually think I saw "ID" in an example somewhere and decided to use it since it worked just like MAKEINTRESOURCE(ID). I just think its easier if you dont have to #define as much (especially with me, I have a lot of #definitions.)

  2. #17
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    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;
    Last edited by Quantum1024; 05-10-2006 at 04:35 AM.

  3. #18
    Registered User
    Join Date
    Aug 2004
    Posts
    193
    myFunction(...) depends on what the user inputted in the previous dialog box. It uploads files (so if the files are big, it takes a long time, if the files are small, it takes a short time). Right now, I'm glad I got it working how I want it to. The next thing I need to do is update the progress bar at a steady, but accurate pace. Right now, I have the progress bar updating in certain parts of myFunction(...).

    About the multithreading. I'm not familiar with this so I'd prefer not to do this. Thanks for the information anyway.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. make Child Dialog not Popup?
    By Zeusbwr in forum Windows Programming
    Replies: 5
    Last Post: 04-08-2005, 02:42 PM
  2. Get a string from a modal dialog box
    By axr0284 in forum Windows Programming
    Replies: 1
    Last Post: 03-03-2005, 12:39 PM
  3. Dialog Box Resources
    By Mecnels in forum Windows Programming
    Replies: 2
    Last Post: 04-28-2003, 05:57 AM
  4. edit control in dialog box problems
    By Bajanine in forum Windows Programming
    Replies: 11
    Last Post: 11-11-2002, 05:55 PM
  5. Resize Dialog Box via Code :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 10-27-2002, 10:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21