NO

Author Topic: Peekmessage In dialog ???  (Read 3963 times)

gromit

  • Guest
Peekmessage In dialog ???
« 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
 :-\ :-\ :-\

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Peekmessage In dialog ???
« Reply #1 on: May 18, 2010, 07:28:57 PM »
Here is something that I use to keep a dialog refreshed.  Borrowed it from BCX.

Code: [Select]
VOID DoEvents(VOID)
{
MSG Msg;
while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
Use it like so:
Code: [Select]
if (GetSaveFileName(&ofn))
{
DoEvents(); // refresh screen

char buf[RichEdit_GetTextLength(txtScript)];

// Do stuff
No one cares how much you know,
until they know how much you care.

gromit

  • Guest
Re: Peekmessage In dialog ???
« Reply #2 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
 :) :) :)