PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

PocketHAL app hangs if any window created before init

diProtector · 18 Feb 2006, 11:20 UTC
I've tested PocketHAL (firework sample) application and got an interesting
results: if MessageBox (or any other window) creates BEFORE some
PocketHAL initialization routines - the application hangs.

Here is a piece of code:

Firework::Firework()

: m_buffer1(0),
m_buffer2(0),
m_map1(0),
m_map2(0),
m_blobs(0)
{
MessageBox(NULL, TEXT("Hello World"), TEXT("New Menu: Hello World"), MB_OK);
m_config.m_appName = TEXT("Firework");
m_config.m_orientation = ORIENTATION_NORMAL;
}

Here MessageBox function called before initialization - application
will hang.

But if we place MessageBox calling somewhere in OnInitialize() method
- everything works good. Example:

bool Firework::OnInitialize()
{
if (!Game::OnInitialize())
return false;

MessageBox(NULL, TEXT("Hello World"), TEXT("New Menu: Hello World"), MB_OK);
m_width = GetDisplay()->GetParameters().m_width;
m_height = GetDisplay()->GetParameters().m_height;
...

Can you explain that thing?
Could it just be losing focus before the calls to create the window?
diProtector · 21 Feb 2006, 06:28 UTC
fast_rx, what did you mean? Could you explain with more details?
I was just thinking that maybe it was missing the 'WA_INACTIVE' message in the GameBase::MessageHandler() because of where you were using the popup. If it loses focus and doesn't know - it would probably hang when it hit the gameloop.

It's all speculation, though.

I have used a few popups in my apps, but it's a lot cleaner to use some sort of ingame display - even if it's a bit crude.
diProtector · 22 Feb 2006, 06:53 UTC
fast_rx, you think I should send 'WA_INACTIVE' to main window before displaying any other windows? But there is no main window created yet.
I was merely speculating on why it may be a problem...
Don't got sending wm_ events.

I suggested not using the popups at all. Why do you need to use them before init?
diProtector · 22 Feb 2006, 16:49 UTC
Because all apps protected with my product (diProtector) should display nag-window.