Copiar archivos cuando la ruta de estos contiene espacios
Visual Fox Pro, Trucos Comentarios ( 0 ) »
cDirDest = "c:\Mis
Documentos\"
cFileACopiar = "Mi
Archivo de Ayer.txt"
Copy File (cFileACopiar)
To
(cDirDest+cFileACopia)

cDirDest = "c:\Mis
Documentos\"
cFileACopiar = "Mi
Archivo de Ayer.txt"
Copy File (cFileACopiar)
To
(cDirDest+cFileACopia)
#Define
VK_LWIN 0x5B
#Define
VK_RWIN 0x5C
#Define
KEYEVENTF_KEYUP 0x2
Declare keybd_event
In
Win32API ;
SHORT
bVk,
SHORT
bScan, ;
Integer
dwFlags, Integer
deExtraInfo
keybd_event(VK_LWIN,0x5B,0,0)
keybd_event(VK_LWIN,0x5B,KEYEVENTF_KEYUP,0)
* Ahora veremos como mostrarlo esperar
* unos segundos y luego ocultarlo
#Define
VK_LWIN 0x5B
#Define
VK_RWIN 0x5C
#Define
KEYEVENTF_KEYUP 0x2
Declare keybd_event
In
Win32API ;
SHORT
bVk,
SHORT
bScan, ;
Integer
dwFlags, Integer
deExtraInfo
keybd_event(VK_LWIN,0x5B,0,0)
keybd_event(VK_LWIN,0x5B,KEYEVENTF_KEYUP,0)
=Inkey(.3) * Espera 3 segundos
keybd_event(VK_LWIN,0x5B,0,0)
keybd_event(VK_LWIN,0x5B,KEYEVENTF_KEYUP,0)
Declare Integer
FindWindow In WIN32API;nOk = FindWindow(
"XLMAIN", 0)?
"Excel"+Iif(nOk > 0,""," no está")+" ejecutándose"DBSetProp
("MiBaseDatos","Database","DBCEvents",.F.)Para volver a activarlos:
DBSetProp
("MiBaseDatos","Database","DBCEvents",.T.)
?(
Left(Ttoc(Datetime()),14) + Right(Ttoc(Datetime()),2))
Close
Databases All
Use Home(2)+"Northwind\northwind.dbc"
In
0
Alias Dbc Noupdate
Select T.ObjectName
Table,I.ObjectName
Tag From Dbc
T ;
Join Dbc
I
On
T.ObjectId = I.ParentId ;
WHERE
T.objecttype ==
"Table"
;
And I.objecttype ==
"Index"
Declare INTEGER FindWindowEx
IN
user32.dll
;
Long,
Long,
string,
String
Declare INTEGER EnableWindow in user32.dll Long, Long
* Deshablitado = 0
* Hablitado = 1
nEnable = 0 * Deshabilitado
lHwnd = FindWindowEx(0, 0,
"Shell_TrayWnd",
.NULL.)
lHwnd = FindWindowEx(lHwnd, 0,
"Button",
.NULL.)
=EnableWindow(lHwnd, nEnable)
Ejemplos:
* Probando con Date( )
? Date(2006,3,13)
+ 2
* Devolverá: 2006.03.15
* Pero con un DateTime
? DateTime(2006,3,13,
8,10,4) + 2
* Devolverá: 2006.03.13
08:10:06 AM
Una solución es la siguiente, multiplicar el
número de días a sumar por 86400 que es el número de segundos que tiene un día.
Resultado:
? DateTime(2006,3,13,
8,10,4) + (2 * 86400)
* Devolverá: 2006.03.15
08:10:04 AM
?
"Existe ",Fsize("Campo","Tabla") > 0Declare
DoFileDownload In shdocvw.Dll;cRuta =
"http://www.davphantom.net/archivo.txt"DoFileDownload(
Strconv(cRuta,12))
* Asumamos que el Set Decimals
está en 2
nValor = "8.2433"
* Con la función VAL() me devolveria 8.24
? VAL(nValor)
* Con la función CAST() me deolveria el valor 8.2433
? CAST(nValor
AS
N(20,4))
Algo también interesante con VAL()
aproximaría el valor mientras que con CAST no.
nValor =
"8.2833"
* Con la función VAL() me devolveria 8.29
? VAL(nValor)
* Con la función CAST() me deolveria el valor 8.2833
? CAST(nValor
AS
N(20,4))
Declare Long GetDriveType
In
"kernel32"
;
STRING
nDrive
nRet = GetDriveType("H:")
Do Case
Case nRet = 1
? "DESCONOCIDO"
Case
nRet = 2
? "DISCO REMOVIBLE"
Case
nRet = 3
? "DISCO DURO"
Case
nRet = 4
? "DISCO EN RED"
Case
nRet = 5
? "CDROM"
Case
nRet = 6
? "DISCO RAM"
EndCase
Declare Integer SetWindowTheme
In
UxTheme ;
INTEGER HWnd,
String pszSubAppName,;
String pszSubIdList
=SetWindowTheme(Thisform.HWnd,
Null,
"")
Declare
SetupPromptReboot IN setupapi.dll ;Para reiniciar, preguntando si se desea proceder
SetupPromptReboot (0,
_Screen.hWnd, 0)Para reiniciar, sin preguntar
SetupPromptReboot (0, _Screen.hWnd, 1)
RUN ping
"NOMBRE_PC"
> c:\PingIp.TXT
cTxt = FILETOSTR([c:\PingIp.TXT])
cTxt = SUBSTR(cTxt,AT("[",cTxt)+1)
? LEFT(cTxt,AT("]",cTxt)
-1)