OK. Thanks. Below is my code and it works.
===========================================
DWORD WINAPI thread(LPVOID lpParam)
{
char *message;
char *title;
title = ((two_strings *) lpParam)->s1;
message = ((two_strings *) lpParam)->s2;
MessageBox(NULL, TEXT(message), TEXT(title), MB_OK | MB_ICONWARNING);
return 0;
}
void show_message(char *title, char *msg)
{
two_strings message;
HANDLE hthread = 0;
strcpy(message.s1, title);
strcpy(message.s2, msg);
hthread = CreateThread(NULL, 0, thread, &message, 0, NULL);
if (hthread == NULL)
ExitProcess(1);
CloseHandle(hthread);
}
On Wednesday, 26 September 2012 09:01:17 UTC-4, Deanna Earley wrote:
> On 26/09/2012 13:42,
>
> > The program would pause if I use messagebox. Is there any as convenient way to show some message to the user without blocking the program? Thanks.
>
>
>
> Putting anything that is "sensitive" on another thread.
>
>
>
> A message box blocks the thread of execution but it still runs a message
>
> pump so messages will be received.
>
>
>
> Putting any work on another thread means it's unaffected by any UI issues.
>
>
>
> --
>
>