Change static text on dialog window after function finishes
  Home FAQ Contact Sign in
comp.os.mswindows.programmer.win32 only
 
Advanced search
POPULAR GROUPS

more...

comp.os ... win32 Profile…
 Up
Change static text on dialog window after function finishes         


Author: Caleb
Date: May 1, 2008 19:36

Hey all. I have a dialog window with a progress bar, and a function that
slowly increases it. When the progress bar finishes, I want a static text
to change to "Update Finished", but to do this I need the HWND of the
dialog. Since I can't put a/the function inside the AboutDlgProc()
function, I can't get its HWND. Is there a way to do this? Thanks in
advance!

P.S. I don't really know whether or not this is already a given, but I'm
using the win32 API w/C++, not MFC.
2 Comments
Re: Change static text on dialog window after function finishes         


Author: domi
Date: May 2, 2008 02:45

Caleb wrote:
> Hey all. I have a dialog window with a progress bar, and a function that
> slowly increases it. When the progress bar finishes, I want a static text
> to change to "Update Finished", but to do this I need the HWND of the
> dialog. Since I can't put a/the function inside the AboutDlgProc()
> function, I can't get its HWND. Is there a way to do this? Thanks in
> advance!

the HWND should be in your Dlg callback :

LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam,
LPARAM lParam)
no comments
Re: Change static text on dialog window after function finishes         


Author: Caleb
Date: May 2, 2008 06:41

domi valis.com> wrote in news:fvenq8$8rv$1@aioe.org:
>
> the HWND should be in your Dlg callback :
>
> LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam,
> LPARAM lParam)
>

Thanks domi! Technically I already knew that, but you gave me an idea.
At the beginning of the file, I declared

HWND myDialog;

In the Dialogs callback, during initiation, I said that

myDialog = hwnd;

And then when I created a thread for the function

DWORD WINAPI AdvanceProgress(LPVOID lpParam) {
//some code here, just removed it...
SetDlgItemText(myDialog, IDCANCEL, "Finish");
return(0); }

And it worked! This might not be necessarily what you meant, but it
worked either way. Thanks =)
no comments