function test_values($window) { wb_set_value(wb_get_control($window, IDC_HSCROLL4026), 50, 0, 10000); wb_set_value(wb_get_control($window, IDC_UPDOWN4028), 10, 0, 50); wb_set_value(wb_get_control($window, IDC_CHECKBOX4034), TRUE); wb_set_value(wb_get_control($window, IDC_RADIOBUTTON4015), TRUE); wb_set_range(wb_get_control($window, IDC_HSCROLL4056), 0, 400); wb_set_range(wb_get_control($window, IDC_SLIDER4011), 0, 200); wb_set_range(wb_get_control($window, IDC_PROGRESSBAR4007), 0, 60); // List boxes / combo boxes wb_set_text(wb_get_control($window, IDC_LISTBOX4053), "Option1\nOption2\nOption3"); wb_set_text(wb_get_control($window, IDC_COMBOBOX4054), "Option1\nOption2\nOption3"); wb_set_text(wb_get_control($window, IDC_LISTBOX4055), "Option1\nOption2\nOption3"); // Edit_boxes $text = wb_get_text(wb_get_control($window, IDC_EDIT4057)); wb_set_text(wb_get_control($window, IDC_EDIT4058), $text); wb_set_text(wb_get_control($window, IDC_EDIT4059), $text); wb_set_text(wb_get_control($window, IDC_EDIT4065), implode(" ", array_fill(0, 20, $text))); }
wb_create_control($mainwin, PushButton, "²¥·Å", 110, 10, 100, 20, ID_PLAY); wb_create_control($mainwin, PushButton, "Í£Ö¹", 210, 10, 100, 20, ID_STOP); wb_create_control($mainwin, PushButton, "ÔÝÍ£", 310, 10, 100, 20, ID_PAUSE); wb_create_control($mainwin, PushButton, "¹Ø±Õ", 410, 10, 100, 20, ID_CLOSE); wb_create_control($mainwin, PushButton, "¾²Òô", 10, 40, 50, 20, ID_MUTE); wb_create_control($mainwin, PushButton, "Öмä", 10, 60, 50, 20, ID_BALCENTER); wb_create_control($mainwin, PushButton, "Ñ»·", 250, 40, 50, 20, ID_SURROUND); // volumen and balance wb_create_control($mainwin, Slider, "", 70, 40, 150, 20, ID_VOLUMEN); wb_create_control($mainwin, Slider, "", 70, 60, 150, 20, ID_BALANCE); wb_create_control($mainwin, Slider, "²¥·Å½ø¶È", 70, 100, 250, 20, ID_PLAY_POS); wb_set_range(wb_get_control($mainwin, ID_VOLUMEN), 0, 255); wb_set_value(wb_get_control($mainwin, ID_VOLUMEN), 255); wb_set_range(wb_get_control($mainwin, ID_BALANCE), 0, 255); wb_set_value(wb_get_control($mainwin, ID_BALANCE), 127); wb_set_range(wb_get_control($mainwin, ID_PLAY_POS), 0, 100); wb_set_value(wb_get_control($mainwin, ID_PLAY_POS), 0); // timer wb_create_timer($mainwin, ID_INFOTIMER, 1000); // run application wb_set_image($mainwin, "resource/musicm.ico"); wb_set_handler($mainwin, "process_main"); wb_main_loop(); //-------------------------------------------------------------- HANDLE PROCESS function process_main($window, $id, $ctrl) { global $statusbar, $fmod, $mainwin; switch ($id) { case ID_INFOTIMER: $status = "´ÅÅÌ: " . $fmod->fmod_GetOutputName() . " "; $status .= "¸èÇú³¤¶È: " . $fmod->fmod_GetLenght(true) . " ·ÖÖÓ ";
function download_file($save_to_var = false) { $this->_update_download_status('connecting'); // did a error happen? then stop the process! if ($this->status == 'error') { return false; } // build request: $http_request = $this->get_http_request(); $host = $this->get_host(); $port = $this->get_port(); // did a error happen? then stop the process! if ($this->status == 'error') { return false; } // open connection: $errno = 0; $errstr = ""; $connection = @fsockopen($host, $port, $errno, $errstr, 1); if (!$connection) { $this->_error('download_file', "connection failed: {$errstr} (#{$errno})"); return false; } // send http header: if (!fwrite($connection, $http_request)) { $this->_error('download_file', 'could not send the http header!'); return false; } // did a error happen? then stop the process! if ($this->status == 'error') { return false; } if (!$save_to_var) { // save content to this file: if (!($dll_file_handle = fopen($this->target_file, 'wb'))) { $this->_error('download_file', 'could not write to file!'); return false; } } // needed variables: $content_size = 0; $current_size = 0; $reached_content = 0; $header = ''; $buffer = ''; $percent = 0; // set progressbar range to 100 if ($this->wb_progressbar_active) { wb_set_range($this->wb_progressbar, 0, 100); } $this->_update_download_status('getting_header'); while (!feof($connection) and $this->status != 'error') { if ($reached_content == 1) { // // getting data // // fill buffer $buffer = fgets($connection, 1024); // append buffer to file or variable if ($save_to_var) { $this->file_contents .= $buffer; } else { fwrite($dll_file_handle, $buffer); } // update cur size $current_size += strlen($buffer); // did the user hit ESC? if ($this->stop_key != NULL and wb_wait() == $this->stop_key) { // then break break; } if ($content_size != 0) { $percent = round(100 / $content_size * $current_size); if ($this->wb_progressbar_active) { wb_set_value($this->wb_progressbar, $percent); } } } else { // get header $buffer = fgets($connection, 2); $header .= $buffer; // end of header? if (strstr($header, $this->end_of_header)) { $this->_update_download_status('downloading'); // save header $this->header_str = $header; // extract content size from header $content_size = $this->get_content_length(); // update vars $reached_content = 1; $buffer = ''; } } } // close download file if (!$save_to_var) { fclose($dll_file_handle); } // close connection if (!@fclose($connection)) { $this->_error('download_file', 'could not close the connection!'); } $this->_update_download_status('finished'); return true; }