Oxygen Basic

Programming => Example Code => Topic started by: Peter on November 05, 2010, 08:40:03 AM

Title: MandelBrotRip
Post by: Peter on November 05, 2010, 08:40:03 AM
Deleted
Title: Re: MandelBrotRip
Post by: efgee on November 05, 2010, 09:11:08 AM
I have OB alpha18 and I'm able to compile but the program crashes.  :'(
(WinXP-SP3)
Title: Re: MandelBrotRip
Post by: Charles Pegge on November 05, 2010, 09:59:19 AM

Hi efgee,

The message loop may need attention. You had problems with another O2 program and found that fixing the WinMain message loop resolved the problem on your system.

If an error is returned by GetMessage then this loop will not attempt to pass the Message back into Windows for further processing.

Charles

Code: [Select]
  sys bRet
  '
  do while bRet := GetMessage (&wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage &wm
      DispatchMessage &wm
    end if
  wend
Title: Re: MandelBrotRip
Post by: Charles Pegge on November 05, 2010, 01:48:47 PM

Yes okay Peter, I've put in exit while and exit for, into the next release (Alpha019).


On the subject of message loops, here it is from the horses mouth :)

http://msdn.microsoft.com/en-us/library/ms644928(VS.85).aspx

Code: [Select]

    while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
    {
        if (bRet == -1)
        {
            // handle the error and possibly exit
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

Charles