de Grenville Tryon Pera |
Las paginas de Visual Basic |
Pagina 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
131 | Obtener las BD en un servidor SQL | Como obtener los nombres de las bases de datos en un servidor SQL | |
132 | Poner opcion de boton derecho | Como poner en boton derecho (fuera de VB) un Shortcut | |
133 | Cambiar color de un RichtextBox desde codigo | Cambiar color de un richtextobox desde codigo en VB | |
134 | Crear un DSN desde VB | Como crear un DSN desde Visual Basic | |
135 | Obtener los primeros 'n' registros de un select | Como puede obtener los primeros 'n' registros en una sentencia SQL. | |
136 | Flecha derecha/zquierda en un textbox | Capturar las teclas de desplazamiento en un textbox | |
137 | Cerrar programas desde VB | Como cerrar programas desde VB | |
138 | Nombre de dominio | Como obtener el nombre de dominio en NT | |
139 | Comandos de una a otra ventana | Como ejecutar comandos de otra ventana | |
140 | Busqueda en un combo | Como realizar una busqueda en un Combobox |
OBTENER LAS BD DE UN SERVIDOR -SQL-
PONER UNA OPCION AL BOTON DERECHO (ESTILO ADD TO ZIP)
Hace algunos días se trato este tema en la lista.... y se soluciono, pero
encontré algo que les puede servir a todos...
Se trata de personalizar los menús contextuales cuando hacemos click con el
botón derecho sobre algún archivo, como lo hace winzip cuando nos da la
opción de "Add to Zip". Lo cual es muy útil para agrégale a nuestra
aplicación que funciona con parámetros. Para ello debemos editar la clave del
registro (Regedit.exe)
<HKEY_CLASSES_ROOT\FOLDER\SHELL>.
Donde Agregamos una nueva clave con el nombre que queremos que muestre el menú
contextual. Por ejemplo "Comprimir".
Luego dentro de la Clave creada agregamos otra clave "Command" y
dentro de esta editamos el valor predeterminado asignándole la ruta de nuestra
aplicación y los parámetros que necesita. Por ejemplo
"C:\COMPRESOR\COMPRIME.EXE ,/idlist,%I,%L".
Luego desde visual basic tomamos los parámetros y listo...
CAMBIAR COLOR DE UN RICHTEXT POR CODIGO
CREAR UN DSN DESDE VB
OBTENER LOS 'N' PRIMEROS ELEMENTOS DE UN SELECT
FLECHA DERECHA/IZQUIERDA EN
UN TEXTBOX
Dim WindowHandle As Long
Private Const NERR_Success As Long = 0&
Option Explicit
Private Const NullByte As Byte = 0
Type WKSTA_INFO_101_I
wki101_platform_id As Long
wki101_computername As Long
wki101_langroup As Long
wki101_ver_major As Long
wki101_ver_minor As Long
wki101_lanroot As Long
End Type
Type WKSTA_INFO_101_S
wki101_platform_id As Long
wki101_computername As String
wki101_langroup As String
wki101_ver_major As Long
wki101_ver_minor As Long
wki101_lanroot As String
End Type
Private Declare Function NetGetDCName Lib "netapi32"
(servername As Byte, domainname As Byte, bufptr As Long) As Long
Private Declare Function NetWkstaGetInfo Lib "netapi32"
(servername As Byte, ByVal level As Long, bufptr As Long) As Long
Private Declare Function NetApiBufferFree Lib
"netapi32" (ByVal Buffer As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias
"RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As
Long)
Private Declare Function lstrcpy Lib "kernel32" Alias
"lstrcpyW" (sDest As Byte, ByVal lpString2 As Long) As Long
Private Declare Function lstrlen Lib "kernel32" Alias
"lstrlenW" (ByVal lpString As Long) As Long
Sub Main()
Dim nBuffer As Long
Dim nBufSize As Long
Dim nErr As Long
Dim nPtr As Long
Dim sServer As String
Dim cServer() As Byte
Dim wsiInfoLongs As WKSTA_INFO_101_I
Dim wsiInfoString As WKSTA_INFO_101_S
nErr = NetGetDCName(NullByte, NullByte, nBuffer)
If nErr <> NERR_SUCCESS Then
MsgBox "Error " & nErr & " calling
NetGetDCName - See WINERROR.H for definition"
Exit Sub
End If
nBufSize = lstrlen(nBuffer)
ReDim cServer(1 To (nBufSize + 2) * 2)
lstrcpy cServer(1), nBuffer
NetApiBufferFree nBuffer
sServer = cServer
nErr = NetWkstaGetInfo(cServer(1), 101, nBuffer)
If nErr <> NERR_SUCCESS Then
MsgBox "Error " & nErr & " calling
NetWkstaGetInfo - See WINERROR.H for definition"
Exit Sub
End If
CopyMemory wsiInfoLongs, nBuffer, LenB(wsiInfoLongs)
wsiInfoString.wki101_platform_id =
wsiInfoLongs.wki101_platform_id
wsiInfoString.wki101_computername =
GetString(wsiInfoLongs.wki101_computername)
.wki101_langroup = GetString(wsiInfoLongs.wki101_langroup)
wsiInfoString.wki101_ver_major = wsiInfoLongs.wki101_ver_major
wsiInfoString.wki101_ver_minor = wsiInfoLongs.wki101_ver_minor
wsiInfoString.wki101_lanroot =
GetString(wsiInfoLongs.wki101_lanroot)
NetApiBufferFree nBuffer
MsgBox "Primary domain controller: " & sServer
& vbCrLf & "Domain name: " & wsiInfoString.wki101_langroup
End Sub
Private Function GetString(ByVal nPointer As Long) As String
Dim cBuffer() As Byte
sBuffer As String
Dim nLen As Long
nLen = lstrlen(nPointer)
ReDim cBuffer(1 To (nLen + 2) * 2)
lstrcpy cBuffer(1), nPointer
sBuffer = cBuffer
GetString = sBuffer
End Function
COMANDOS DE UNA A OTRA VENTANA
BUSQUEDA EN COMBO