Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Muy til para crear instalaciones por ejemplo: Aadir un textbox y hacerlo oculto. Una vez oculto, escribir estas lneas sustituyendo "Nombre del Grupo" por que que se desea crear, y que lo colocamos en Inicio -> Programas. Private Sub Command1_Click() Text1.LinkTopic = "Progman|Progman" Text1.LinkMode = 2 Text1.LinkExecute "[CreateGroup(" + "Nombre del Grupo" + ")]" End Sub
Uso de Random:
La funcin Rnd o Random posee la virtud de obtener nmeros aleatorios entre 0 y 1: El nico inconveniente a la hora de usar Rnd, es que hay que inicializarlo, en otro caso, el resultado de la funcin Rnd, ser siempre el mismo dentro de un determinado ordenador. Por ejemplo, el cdigo:
Private Sub Form_Load() Dim Num As Double Num = Rnd MsgBox Num End Sub Nos dara como resultado siempre el mismo nmero. Para solucionar este problema, debemos escribir la sentencia Randomize antes de llamar a la funcin Rnd. De esta manera, la funcin Rnd actuar correctamente. El cdigo quedara as:
Private Sub Form_Load() Dim Num As Double Randomize Num = Rnd MsgBox Num End Sub
Private Type FormatRange hdc As Long hdcTarget As Long rc As Rect rcPage As Rect chrg As CharRange End Type Private Const WM_USER As Long = &H400 Private Const EM_FORMATRANGE As Long = WM_USER + 57 Private Const EM_SETTARGETDEVICE As Long = WM_USER + 72 Private Const PHYSICALOFFSETX As Long = 112 Private Const PHYSICALOFFSETY As Long = 113 Private Declare Function GetDeviceCaps Lib "gdi32" ( _ ByVal hdc As Long, ByVal nIndex As Long) As Long Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal msg As Long, ByVal wp As Long, lp As Any) As Long Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _ (ByVal lpDriverName As String, ByVal lpDeviceName As String, _ ByVal lpOutput As Long, ByVal lpInitData As Long) As Long Public Function WYSIWYG_RTF(RTF As RichTextBox, LeftMarginWidth As Long, _ RightMarginWidth As Long) As Long Dim LeftOffset As Long, LeftMargin As Long, RightMargin As Long Dim LineWidth As Long Dim PrinterhDC As Long Dim r As Long Printer.Print Space(1) Printer.ScaleMode = vbTwips LeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _ PHYSICALOFFSETX), vbPixels, vbTwips) LeftMargin = LeftMarginWidth - LeftOffset RightMargin = (Printer.Width - RightMarginWidth) - LeftOffset LineWidth = RightMargin - LeftMargin PrinterhDC = CreateDC(Printer.DriverName, Printer.DeviceName, 0, 0) r = SendMessage(RTF.hWnd, EM_SETTARGETDEVICE, PrinterhDC, _ ByVal LineWidth) Printer.KillDoc WYSIWYG_RTF = LineWidth End Function Public Sub PrintRTF(RTF As RichTextBox, LeftMarginWidth As Long, _ TopMarginHeight, RightMarginWidth, BottomMarginHeight) Dim LeftOffset As Long, TopOffset As Long Dim LeftMargin As Long, TopMargin As Long Dim RightMargin As Long, BottomMargin As Long Dim fr As FormatRange Dim rcDrawTo As Rect Dim rcPage As Rect Dim TextLength As Long Dim NextCharPosition As Long Dim r As Long
Printer.Print Space(1) Printer.ScaleMode = vbTwips LeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _ PHYSICALOFFSETX), vbPixels, vbTwips) TopOffset = Printer.ScaleY(GetDeviceCaps(Printer.hdc, _ PHYSICALOFFSETY), vbPixels, vbTwips) LeftMargin = LeftMarginWidth - LeftOffset TopMargin = TopMarginHeight - TopOffset RightMargin = (Printer.Width - RightMarginWidth) - LeftOffset BottomMargin = (Printer.Height - BottomMarginHeight) - TopOffset rcPage.Left = 0 rcPage.Top = 0 rcPage.Right = Printer.ScaleWidth rcPage.Bottom = Printer.ScaleHeight rcDrawTo.Left = LeftMargin rcDrawTo.Top = TopMargin rcDrawTo.Right = RightMargin rcDrawTo.Bottom = BottomMargin fr.hdc = Printer.hdc fr.hdcTarget = Printer.hdc fr.rc = rcDrawTo fr.rcPage = rcPage fr.chrg.cpMin = 0 fr.chrg.cpMax = -1 TextLength = Len(RTF.Text) Do NextCharPosition = SendMessage(RTF.hWnd, EM_FORMATRANGE, True, fr) If NextCharPosition >= TextLength Then Exit Do fr.chrg.cpMin = NextCharPosition Printer.NewPage Printer.Print Space(1) fr.hDC = Printer.hDC fr.hDCTarget = Printer.hDC Loop Printer.EndDoc r = SendMessage(RTF.hWnd, EM_FORMATRANGE, False, ByVal CLng(0)) End Sub
Aada el siguiente cdigo: Private Sub Command1_Click() Dim canalLibre As Integer 'Obtenemos un canal libre que nos dar
'el sistema oparativo para poder operar canalLibre = FreeFile 'Abrimos el fichero en el canal dado Open "C:\fichero.txt" For Output As #canalLibre 'Escribimos el contenido del TextBox al fichero Print #canalLibre, Text1 Close #canalLibre End Sub
Nuevo
Para abrir:
Cdigo: Dim foo As Integer foo = FreeFile Open "C:\Archivo.txt" For Input As #foo Text1.Text = Input(LOF(foo), #foo) Close #foo Para guardar: Cdigo: Dim foo As Integer foo = FreeFile Open "C:\Archivo.txt" For Output As #foo Print #foo, Text1.Text Close #foo dialogos: Ese es para Abrir Cdigo: Dim strOpen As String CommonDialog1.ShowOpen strOpen = CommonDialog1.FileName Text1.LoadFile strOpen Text1.LoadFile strClose
Ese para guardar Cdigo: Dim strNewFile As String CommonDialog1.ShowSave strNewFile = CommonDialog1.FileName Text1.SaveFile strNewFile
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Sub Form_Load() List1.AddItem "Texto 1" List1.AddItem "Texto 2" List1.AddItem "Texto 3" List1.AddItem "Texto 4" List1.AddItem "Texto 5" List1.AddItem "Texto 6" List1.AddItem "Texto 7" End Sub Private Sub Command1_Click() 'Seleccion de todo el contenido Dim Resp As Long Resp = SendMessageLong(List1.hwnd, &H185&, True, -1) End Sub Private Sub Command2_Click() 'Eliminacion de todos los elementos seleccionados Dim Resp As Long Resp = SendMessageLong(List1.hwnd, &H185&, False, -1) End Sub
If ObCaps = 120 Then Cad = "Grandes" MsgBox "Fuentes de letra " & Cad End Sub *) Esta funcin ha sido corregida por un error en las etiquetas, 96 corresponde a pequeas y 120 a Grandes, agradecimientos a Andrs Moral Gutirrez por su correcin (01/06/1998)
End Sub otra forma: Insertar tres TextBox, cambiar la propiedad KeyPreview del formulario a True y escribir el siguiente cdigo: Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{tab}" KeyAscii = 0 End If End Sub
"ShellAboutA" (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long Private Sub Command1_Click() Call ShellAbout(Me.hwnd, "Ttulo Programa", "Copyright 1997, Dueo de la aplicacin", Me.Icon) End Sub
Caption -> Editor Name -> MnuEditor Pulse Insertar y el botn "->" Caption -> Aadir Name -> MnuAadir Pulse Insertar Caption -> Quitar Name -> MnuQuitar Enabled -> False Pulse Insertar Caption -> Salir Name -> MnuSalir Pulse Insertar Caption -> Name -> MnuIndex Index -> 0 Pulse Aceptar Escribir el siguiente cdigo en el formulario: Private ultElem As Integer Private Sub Form_Load() ultElem = 0 End Sub Private Sub MnuQuitar_Click() Unload MnuIndex(ultElem) ultElem = ultElem - 1 If ultElem = 0 Then MnuQuitar.Enabled = False End If End Sub
Private Sub MnuSalir_Click() End End Sub Private Sub MnuAadir_Click() ultElem = ultElem + 1 Load MnuIndex(ultElem) MnuIndex(ultElem).Caption = "Menu -> " + Str(ultElem) MnuQuitar.Enabled = True End Sub
Escribir lo siguiente: Private Sub Form_Paint() Dim i As Integer For i = 0 To Form1.ScaleHeight Step Picture1.Height For j = 0 To Form1.ScaleWidth Step Picture1.Width PaintPicture Picture1, j, i, Picture1.Width, Picture1.Height Next Next End Sub Private Sub Form_Resize() Picture1.Left = -(Picture1.Width + 200) Picture1.Top = -(Picture1.Height + 200) Label1.Top = 100 Label1.Left = 100 End Sub
c% = c% + 1 Loop End Function Private Sub Form_Load() Dim r&, allDrives$, JustOneDrive$, pos%, DriveType& Dim CDfound As Integer allDrives$ = Space$(64) r& = GetLogicalDriveStrings(Len(allDrives$), allDrives$) allDrives$ = Left$(allDrives$, r&) Do pos% = InStr(allDrives$, Chr$(0)) If pos% Then JustOneDrive$ = Left$(allDrives$, pos%) allDrives$ = Mid$(allDrives$, pos% + 1, Len(allDrives$)) DriveType& = GetDriveType(JustOneDrive$) If DriveType& = DRIVE_CDROM Then CDfound% = True Exit Do End If End If Loop Until allDrives$ = "" Or DriveType& = DRIVE_CDROM If CDfound% Then label1.Caption = "La unidad de CD-ROM corresponde a la unidad: " & UCase$(JustOneDrive$) Else label1.Caption = "Su sistema no posee CD-ROM o unidad no encontrada." End If End Sub
ElseIf col = 8 Then Text1.Text = "Resolucion de 8 bits / 256 colores" ElseIf col = 16 Then Text1.Text = "Resolucion de 16 bits / 65000 colores" Else Text1.Text = "Resolucion de 16 M colores" End If largo = GetDeviceCaps(Form1.hdc, 8) alto = GetDeviceCaps(Form1.hdc, 10) Text1.Text = Text1.Text & " " & largo & "x" & alto & " pixels" End Sub
Select Case verinfo.dwPlatformId Case 0 msg = msg + "Windows 32s " Case 1 msg = msg + "Windows 95 " Case 2 msg = msg + "Windows NT " End Select ver_major$ = verinfo.dwMajorVersion ver_minor$ = verinfo.dwMinorVersion build$ = verinfo.dwBuildNumber msg = msg + ver_major$ + "." + ver_minor$ msg = msg + " (Construido " + build$ + ")" + vbCrLf + vbCrLf Dim sysinfo As SYSTEM_INFO GetSystemInfo sysinfo msg = msg + "CPU: " Select Case sysinfo.dwProcessorType Case PROCESSOR_INTEL_386 msg = msg + "Procesador Intel 386 o compatible." + vbCrLf Case PROCESSOR_INTEL_486 msg = msg + "Procesador Intel 486 o compatible." + vbCrLf Case PROCESSOR_INTEL_PENTIUM msg = msg + "Procesador Intel Pentium o compatible." + vbCrLf Case PROCESSOR_MIPS_R4000 msg = msg + "Procesador MIPS R4000." + vbCrLf Case PROCESSOR_ALPHA_21064 msg = msg + "Procesador DEC Alpha 21064." + vbCrLf Case Else msg = msg + "Procesador (desconocido)." + vbCrLf End Select msg = msg + vbCrLf Dim memsts As MEMORYSTATUS Dim memory& GlobalMemoryStatus memsts memory& = memsts.dwTotalPhys msg = msg + "Memoria Fisica Total: " msg = msg + Format$(memory& \ 1024, "###,###,###") + "Kb" memory& = memsts.dwAvailPhys msg = msg + "Memoria Fisica Disponible: " msg = msg + Format$(memory& \ 1024, "###,###,###") + "Kb" memory& = memsts.dwTotalVirtual msg = msg + "Memoria Virtual Total: " msg = msg + Format$(memory& \ 1024, "###,###,###") + "Kb" memory& = memsts.dwAvailVirtual msg = msg + "Memoria Virtual Disponible: " msg = msg + Format$(memory& \ 1024, "###,###,###") + "Kb" vbCrLf MsgBox msg, 0, "Acerca del Sistema" MousePointer = 0 End
+ vbCrLf
+ vbCrLf
+ vbCrLf
+ vbCrLf +
End Sub Escribir lo siguiente en el mdulo: Type SYSTEM_INFO dwOemID As Long dwPageSize As Long lpMinimumApplicationAddress As Long lpMaximumApplicationAddress As Long dwActiveProcessorMask As Long dwNumberOrfProcessors As Long dwProcessorType As Long dwAllocationGranularity As Long dwReserved As Long End Type Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Type MEMORYSTATUS dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As Long End Type Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (LpVersionInformation As OSVERSIONINFO) As Long Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS) Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO) Public Public Public Public Public Const Const Const Const Const PROCESSOR_INTEL_386 = 386 PROCESSOR_INTEL_486 = 486 PROCESSOR_INTEL_PENTIUM = 586 PROCESSOR_MIPS_R4000 = 4000 PROCESSOR_ALPHA_21064 = 21064
End Sub Private Sub Command2_Click() Dim i as integer i = ExitWindowsEx(0, 0&) 'Reinicia Windows con nuevo usuario End Sub Private Sub Command3_Click() Dim i as integer i = ExitWindowsEx(2, 0&) 'Reinicia el Sistema End Sub
de reciclaje. El parmetro .fFlags nos permitir recuperar el fichero de la papelera si lo deseamos Si eliminamos esta lnea, el fichero no podr ser recuperado.
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Sub Form_Load() Dim strUser As String Dim strOrg As String Dim lngLen As Long Dim lngType As Long Dim hKey As Long Dim x As Long Const HKEY_LOCAL_MACHINE = &H80000002 Const REG_SZ = &H1 x = RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion", hKey) ' open desired key in registry strUser = Space$(256) lngLen = Len(strUser) x = RegQueryValueEx(hKey, "RegisteredOwner", 0, lngType, ByVal strUser, lngLen) If x = 0 And lngType = REG_SZ And lngLen > 1 Then strUser = Left$(strUser, lngLen - 1) Else strUser = "Unknown" End If strOrg = Space$(256) lngLen = Len(strOrg) x = RegQueryValueEx(hKey, "RegisteredOrganization", 0, lngType, ByVal strOrg, lngLen) If x = 0 And lngType = REG_SZ And lngLen > 1 Then strOrg = Left$(strOrg, lngLen - 1) Else strOrg = "Unknown" End If Label1.Caption = "Usuario: " & strUser Label2.Caption = "Empresa: " & strOrg x = RegCloseKey(hKey) End Sub
Sub Text1_Keypress(KeyAscii As Integer) If KeyAscii <> Asc("9") Then 'KeyAscii = 8 es el retroceso o BackSpace If KeyAscii <> 8 Then KeyAscii = 0 End If End If End Sub Nuevo: Private Sub Text1_Keypress(KeyAscii As Integer) If Not IsNumeric(Chr$(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0 End Sub
Private Sub Form_Load() Dim Numero As String Do Numero = InputBox("Introduzca un numero:") Loop Until IsNumeric(Numero) MsgBox "El numero es el " & Numero Unload Me End Sub
Private DragX As Integer Private DragY As Integer Sub Form_DragDrop(Source As Control, X As Single, Y As Single) Source.Move (X - DragX), (Y - DragY) End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Si el boton del raton es el derecho, no hacemos nada
If Button = 2 Then Exit Sub Picture1.Drag 1 DragX = X DragY = Y End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.Drag 2 End Sub
Editor de texto:
Seleccionar todo el texto: Text1.SetFocus Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) Copiar texto: Clipboard.Clear Clipboard.SetText Text1.SelText Text1.SetFocus Pegar texto: Text1.SelText = Clipboard.GetText() Text1.SetFocus Cortar texto: Clipboard.SetText Text1.SelText Text1.SelText = "" Text1.SetFocus Deshacer texto: (Nota: esta operacin slo es eficaz con el control Rich TextBox). En un mdulo copie esta lnea: Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _ hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long Esta es la instruccin de la funcin deshacer: UndoResultado = SendMessage(Text1.hwnd, &HC7, 0&, 0&) If UndoResultado = -1 Then Beep MsgBox "Error al intentar recuperar.", 20, "Deshacer texto" End If Seleccionar todo el texto: SendKeys "^A" Copiar texto: SendKeys "^C"
Pegar texto: SendKeys "^V" Cortar texto: SendKeys "^X" Deshacer texto: SendKeys "^Z"
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName_ As String, ByVal lpWindowName As String) As Long Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long,_ ByVal wFlags As Long) As Long Global Ventana As Long Global Const Muestra = &H40 Global Const Oculta = &H80 En un formulario ponga dos botones y escriba el cdigo correspondiente a cada uno de ellos: 'Oculta la barra de tareas Private Sub Command1_Click() Ventana = FindWindow("Shell_traywnd", "") Call SetWindowPos(Ventana, 0, 0, 0, 0, 0, Oculta) End Sub 'Muestra la barra de tareas Private Sub Command2_Click() Call SetWindowPos(Ventana, 0, 0, 0, 0, 0, Muestra) End Sub
Printer.Print Bloque Next I Else Printer.Print Texto.Text End If Printer.EndDoc End Sub
Escribir el cdigo siguiente: Private Sub Form_Load() Dim I1 As Long Dim I2 As Long Dim I3 As Long Dim I4 As Long Dim Unidad As String Unidad = "C:/" GetDiskFreeSpace Unidad, I1, I2, I3, I4 Label1.Caption = Unidad Label2.Caption = I1 & " Sectores por cluster" Label3.Caption = I2 & " Bytes por sector" Label4.Caption = I3 & " Nmero de clusters libres" Label5.Caption = I4 & " Nmero total de clusters" Label6.Caption = "Espacio total en disco: " & (I1 * I2 * I4) Label7.Caption = "Espacio libre en disco: " & (I1 * I2 * I3) End Sub
Insertar un botn en el formulario y escribir el siguiente cdigo: Private Sub Form_Load() X% = (Form1.Left + Command1.Left + Command1.Width / 2 + 60) / Screen.TwipsPerPixelX Y% = (Form1.Top + Command1.Top + Command1.Height / 2 + 360) / Screen.TwipsPerPixelY SetCursorPos X%, Y% End Sub
Crear un nuevo proyecto, insertar un botn al formulario que inserte un formulario ms y un mdulo. Pegue el siguiente cdigo en el mdulo: Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Peguar el siguiente cdigo en el formulario principal: Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) Unload Form2 End Sub Private Sub Command1_Click() Dim ret As Integer If doshow = False Then ret = SetParent(Form2.hWnd, Form1.hWnd) Form2.Left = 0 Form2.Top = 0 Form2.Show doshow = True Else Form2.Hide doshow = False End If End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim nPC as String Dim buffer As String Dim estado As Long buffer = String$(255, " ") estado = GetComputerName(buffer, 255) If estado <> 0 Then nPC = Left(buffer, 255) End If MsgBox "Nombre del PC: " & nPC End Sub Private Sub Command2_Click() Unload Form1 End Sub Pegue el siguiente cdigo en el mdulo: Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command2_Click() result = ShowCursor(True) End Sub Usar las teclas alternativas Alt+O para ocultarlo y Alt+M para mostrarlo. Peguar el siguiente cdigo en el mdulo: Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ContLinea = 0 MensajeSaliente = "" MensajeEntrante = "" If Cfg.FicheroAnexo <> "" Then Open NFich For Binary As #3 Len = 3 Cont = 0 ContTotal = 0 Progreso.Max = FileLen(NFich) While Not ContTotal = LOF(3) ContTotal = ContTotal + 1 Caracter = Input(1, 3) Cont = Cont + 1 Trio(Cont) = Asc(Caracter) 'MensajeSaliente = MensajeSaliente + Caracter If Cont = 3 Then Cuatro(1) = Int(Trio(1) / 4) Cuatro(2) = (Trio(1) - Int(Trio(1) / 4) * 4) * 16 + Int(Trio(2) / 16) Cuatro(3) = (Trio(2) - (Int(Trio(2) / 16) * 16)) * 4 + Int(Trio(3) / 64) Cuatro(4) = Trio(3) - Int(Trio(3) / 64) * 64 MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(1) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(2) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(3) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(4) + 1, 1) Cont = 0 ContLinea = ContLinea + 4 If ContLinea = 76 Then MensajeEntrante = MensajeEntrante + vbCrLf ContLinea = 0 End If End If DoEvents Wend Select Case Cont Case 1 Cuatro(1) = Int(Trio(1) / 4) Cuatro(2) = (Trio(1) - Int(Trio(1) / 4) * 4) * 16 MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(1) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(2) + 1, 1) + "==" Case 2 Cuatro(1) = Int(Trio(1) / 4)
Cuatro(2) = (Trio(1) - Int(Trio(1) / 4) * 4) * 16 + Int(Trio(2) / 16) Cuatro(3) = (Trio(2) - (Int(Trio(2) / 16) * 16)) * 4 MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(1) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(2) + 1, 1) MensajeEntrante = MensajeEntrante + Mid(Base64, Cuatro(3) + 1, 1) + "=" End Select Close #3 End If End Sub
Trucos Breves 2
Informacin sobre los archivos de acceso a bases de datos. Debemos crear un archivo en la carpeta de Windows con esa Informacin: copiar el archivo Vb.INI a dicha subcarpeta, con el nombre de la aplicacin ejecutable y la extensin INI (por ejemplo, Agenda.INI).
Esto es especialmente recomendado en el caso de usar alguna funcin API, puesto que una mala definicin de la misma, o el paso incorrecto de algn argumento, pueden causar un GPF (Error de proteccin general) en Visual Basic, e incluso en el mismo Windows.
' NO estoy minimizado ' El cdigo para mover o cambiar el tamao del formulario va aqui. End If
Abrir aplicaciones en vb 6 Private Sub Cmdadtareas_Click() valred = Shell("c:\WINDOWS\system32\taskmgr.exe") End Sub Private Sub Cmdcalculadora_Click() valred = Shell("c:\windows\system32\calc.exe") End Sub Private Sub Cmdconsola_Click() valred = Shell("c:\WINDOWS\system32\cmd.exe") End Sub Private Sub Cmdnotepad_Click() valred = Shell("c:\windows\notepad.exe") End Sub Private Sub Cmdword_Click() valred = Shell("C:\Archivos de programa\Microsoft Office\Office12\WINWORD.EXE") End Sub Private Sub Siguiente3_Click() Form3.Hide Form4.Show End Sub