Personal tools
From wiki.swiftlytilting.com
Jump to: navigation, search

WinBinder Manual/wb main loop

int wb_main_loop (void)

Enters the Windows main loop. This function must be called if the application has a window and the processing of the messages should start. Usually the call to wb_main_loop() must be the last executable statement of the PHP script. This occurs because all code after the call of the function wb_main_loop() gets executed only if there exists a higher return scope (be it global or from a function/method). The return value is used for debugging purposes only and may be ignored.

Known issues:

  • There's one known bug in the implementation: if more than one window is created and a child window is destroyed, all the remaining windows including the main one may be destroyed too and the application exits. A viable workaround is to call the function wb_main_loop() directly — within the same scope — after having set the new window handler with wb_set_handler(). This effectively stacks the window loop processing and avoids this behavior.

Example

// A Windows application with only three lines

include("../include/winbinder.php");                            // Include WinBinder library
wb_create_window(NULL, PopupWindow, "Hello world!", 480, 320);  // Create application window
wb_main_loop();                                                 // Enter message loop

See also

Keywords

wb_main_loop
wb_set_handler
Main loop, the

Winbinder Projects