sábado, 9 de maio de 2015
Exemplo de Download de Arquivo
VIDEO - DOWNLOAD ARQUIVO COM BARRA PROGRESSO E TRACE
Exemplo de Download de Arquivo - http://forum.pcsoft.fr
HTTPProgressBar - http://help.windev.com
HTTPRequest - http://help.windev.com
HTTPGetResult - http://help.windev.com
Event - http://doc.windev.com
fSaveBuffer - http://doc.windev.com
-----------------------------------------------------------------------------------------------------------------
//EXEMPLO DE DOWNLOAD DE ARQUIVO
//##################################
Ok is boolean = HTTPRequest("http://www.7-zip.org/downloads.sourceforge.net/sevenzip/7z920.exe")
IF Ok = True THEN
ArchivoDownloading is Buffer = HTTPGetResult()
Ok = fSaveBuffer("/mnt/sdcard/7z920.EXE",ArchivoDownloading)
Okarchivo is boolean = fFileExist("/mnt/sdcard/7z920.EXE")
IF Ok = True AND Okarchivo = True
Info("Download efetuado com sucesso!'")
ELSE
Error("Não foi possivel efetuar o download.")
END
ELSE
Error("Não foi possivel efetuar o download.")
END
-----------------------------------------------------------------------------------------------------------------
// com barra de progresso
HTTPProgressBar(PROGBAR_download)
_arquivo is boolean = HTTPRequest("http://www.amarildomatos.com.br/clientes_arquivos/dll262.zip")
HTTPProgressBar("")
IF _arquivo = True THEN
_baixar_arquivo is Buffer = HTTPGetResult()
_arquivo = fSaveBuffer("e:\aleva\dll262.zip",_baixar_arquivo)
_arquivo_existe is boolean = fFileExist("e:\aleva\dll262.zip")
IF _arquivo = True AND _arquivo_existe = True
Info("Download efetuado com sucesso!'")
ELSE
Error("Não foi possivel efetuar o download.")
END
ELSE
Error("Não foi possivel efetuar o download.")
END
-----------------------------------------------------------------------------------------------------------------
//Com Trace
HTTPProgressBar("gerencie_projeto")
Event(gerencie_projeto,"*.*","HTTPProgress")
_arquivo is boolean = HTTPRequest("http://www.amarildomatos.com.br/clientes_arquivos/dll262.zip")
HTTPProgressBar("")
IF _arquivo = True THEN
_baixar_arquivo is Buffer = HTTPGetResult()
_arquivo = fSaveBuffer("e:\aleva\dll262.zip",_baixar_arquivo)
_arquivo_existe is boolean = fFileExist("e:\aleva\dll262.zip")
IF _arquivo = True AND _arquivo_existe = True
Info("Download efetuado com sucesso!'")
ELSE
Error("Não foi possivel efetuar o download.")
END
ELSE
Error("Não foi possivel efetuar o download.")
END
PROCEDURE gerencie_projeto(TotalByte, TotalTransmitted)
Trace("Baixando Arquivo : " + TotalTransmitted + " / " + TotalByte)
-----------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
WM - Saber se o aplicativo esta rodando em um tablet e nao em um celular
http://forum.pcsoft.fr/pt-BR/pcsoft.br.windev/197-saber-aplicativo-esta-rodando-tablet-nao-celular/read.awp
adrianoboller
#1
Membro registado
804 mensagems
Publicado em abril, 06 2015 - 11:21 PM
IF isTable() = False
EndProgram()
END
PROCEDURE GLOBAL Java
############################################################################
import android.content.res.Configuration;
// Returns True if the device that runs the application is a tablet
PUBLIC static boolean isTablet(){
RETURN (getApplicationContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}
############################################################################
OU pelo modelo
modelo is string = getDeviceName()
#############################################################################
PROCEDURE GLOBAL Java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.*;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import android.provider.Settings.Secure;
PUBLIC static string getDeviceName() {
string manufacturer = android.os.Build.MANUFACTURER;
string model = android.os.Build.MODEL;
string brand = android.os.Build.BRAND;
string product = android.os.Build.PRODUCT;
string board = android.os.Build.BOARD;
string bootloader = android.os.Build.BOOTLOADER;
string cpu_abi = android.os.Build.CPU_ABI;
string cpu_abi2 = android.os.Build.CPU_ABI2;
string device = android.os.Build.DEVICE;
string display = android.os.Build.DISPLAY;
string fingerprint = android.os.Build.FINGERPRINT;
string hardware = android.os.Build.HARDWARE;
string host = android.os.Build.HOST;
string id = android.os.Build.ID;
string radio = android.os.Build.RADIO;
string serial = android.os.Build.SERIAL;
string tags = android.os.Build.TAGS;
string type = android.os.Build.TYPE;
string user = android.os.Build.USER;
IF (model.startsWith(manufacturer)) {
RETURN (model);
} ELSE {
string MarcaModeloCelular = "manufacturer: " + (manufacturer) + "; model: " + (model) + "; brand: " + (brand) + "; product: " + (product) + "; board:" + (board) + "; bootloader: " + (bootloader) + "; cpu_abi: " + (cpu_abi) + "; cpu_abi2: " + (cpu_abi2) + "; device: " + (device) + "; display: " + (display) + "; fingerprint: " + (fingerprint) + "; hardware: " + (hardware) + "; host: " + (host) + "; id: " + (id) + "; radio: " + (radio) + "; serial: " + (serial) + "; tags: " + (tags) + "; type: " + (type) + "; user: " + (user);
MarcaModeloCelular = MarcaModeloCelular.toUpperCase();
RETURN MarcaModeloCelular;
}
}
#############################################################################
OU pela resolução
PROCEDURE Resolucao()
// Horizontal resolution of the screen
ResHorizRes is int = SysXRes()
gloResHorizRes = ResHorizRes
// Vertical resolution of the screen
ResVertRes is int = SysYRes()
gloResVertRes = ResVertRes
Retorno is string = ResHorizRes +"X"+ ResVertRes
W = gloResHorizRes
H = gloResVertRes
IF H = 1920 AND W = 1080 THEN //s4
gnCentroY = 1530
gnCentroYinitial = 1050
ELSE IF H = 800 AND W = 480 THEN // mini
gnCentroY = 605
gnCentroYinitial = 525
ELSE IF H = 800 AND W = 1280 THEN // tablet 1171 419
gnCentroY = 1070
gnCentroYinitial = 319
END
RESULT(Retorno)
Windev GeneratePassword - Criar Senha
VIDEO - GERENATEPASSWORD
---------------------------------------------------------------------------------------------------
_senha is string = GeneratePassword(8) // Gera Senha com 8 Caracteres
_senha = GeneratePassword(8, "12345") // Gera senha comente com esses Numeros
_senha = GeneratePassword(8, "aeiouyAEIOUY") // Gera senha somente com vogais
----------------------------------------------------------------------------------------------
HotKey / Tecla / Windev / Windev Mobie
HotKey
Verifica quais tecla é pressionada
IF KeyPressed(kpEscape) =True THEN
Close(WIN_APLICADOR)
END
Assinar:
Postagens (Atom)