The main loop

The Windows main loop is done by as a single function call, wb_main_loop(), that must be called if the application has a window. This function uses the standard Windows approach, that is, a loop that uses the API function GetMessage() to retrieve a message from the queue and DispatchMessage() to send it to the window procedure.

All the additional tasks needed to run a Windows program, including DLL loading, initialization, and cleanup, are done when PHP calls the WinBinder library upon startup.

There are a few special cases where a Windows programs will not need a message loop, namely when the only tasks to be performed are the creation of message boxes or system dialog boxes. For example:

 

<?

// This program does not need a call to wb_main_loop()

include("../include/winbinder.php");       // Include WinBinder library
if(wb_message_box(null, "This program has no Windows loop.\nCan you believe it?", null, WBC_YESNO))
    wb_sys_dlg_color(NULL);

?>

See also

Creating WinBinder applications
Windows messages
wb_main_loop