## Function parameters and return values

# Function return values

All WinBinder functions return a value. If there is no meaningful value to return, a boolean is returned: TRUE if the function is successful, FALSE if failed.

# Returning multiple values

Multiple values are returned as arrays. For example:

`$size_array = wb_get_size($tabctrl); // This call returns an associative array of two values // For example, if the position is (100, 200) it will return: Array ( [x] => 100 [y] => 200 )`

# Writing cleaner code

WinBinder functions are generally multi-purpose, being able to perform similar operations on several control classes. This allows several Windows functions and messages to use a single function. This also reduces the function count, processing many different Windows functions and messages, according to the object being affected. This makes Windows programming much simpler than usual. For example, see the code below:

`wb_set_text($PushButton, "OK") // Sets the text of a button wb_set_text($ComboBox, "Item 1\nItem 2\nItem 3") // Creates items on a combo box wb_set_text($TabControl, "Tab 1\nTab 2\nTab 3") // Creates tabs on a tab control`

To further simplify the code, optional function arguments with default values are used abundantly in WinBinder. For example:

`// The first call to wb_message_box() will display a default title and an OK button.` `wb_message_box($window, "Press OK to start."); wb_message_box($window, "Are your sure?", "Question", WBC_YESNO);`

Another important way to reduce code size and ease maintenance is trying to use the value returned from one function as a parameter for another function whenever possible. For example:

`wb_set_text(wb_get_control($seldlg, ID_FONTS), get_folder_files($dir)); wb_set_enabled(wb_get_control($seldlg, ID_FONTS), wb_message_box($window, "Are your sure?", "Question", WBC_YESNO));`

# Following PHP conventions

Also, care has been taken to ensure that function parameters and return values follow some common PHP conventions, written or not. For example, the function calls

`wb_get_system_info("ospath") wb_get_system_info("systempath")`

will always return a / or \ character appended to them because this is how paths are generally used in PHP.

# See also

How WinBinder works
Naming conventions