Pelles C forum

C language => Windows questions => Topic started by: gromit on May 17, 2010, 10:03:04 PM

Title: Peekmessage In dialog ???
Post by: gromit on May 17, 2010, 10:03:04 PM
Hi Folks

Could anyone Point me in the right direction

I want to use Peekmessage

However to use Peekmessage it needs a message loop

/* The user interface is a modal dialog box */
    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)MainDlgProc);

As the above code shows In my dialog based app, i have no visible msg loop.

is it possible to do it any other way than to write a non dialog based app
:-\ :-\ :-\
Title: Re: Peekmessage In dialog ???
Post by: DMac on May 18, 2010, 07:28:57 PM
Here is something that I use to keep a dialog refreshed.  Borrowed it from BCX.

VOID DoEvents(VOID)
{
MSG Msg;
while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}

Use it like so:if (GetSaveFileName(&ofn))
{
DoEvents(); // refresh screen

char buf[RichEdit_GetTextLength(txtScript)];

// Do stuff
Title: Re: Peekmessage In dialog ???
Post by: gromit on May 18, 2010, 10:40:19 PM
Cheers for that DMac Bit Pushed for time at present
So wont be able to test until late tonight
Looks more promising than anything i have found so far.

Let U know how i get on Later.

Big Thanks Gromit
:) :) :)