|
21
|
Programación / Programación Visual Basic / Re: Ayuda a crear en visual basic "Generar Enlace"
|
en: 5 Enero 2016, 06:12 am
|
hola estudialo y trata de entenderlo al menos. Option Explicit
Private Sub Command1_Click() Dim i As Integer Dim sLinks() As String Dim sResult As String sLinks = Split(Text1.Text, vbCrLf) For i = 0 To UBound(sLinks) If Len(sLinks(i)) Then sResult = sResult & "<Script>code(" & Chr$(34) & Format(i + 1, "000") & Chr$(34) & "," & _ Chr$(34) & sLinks(i) & Chr$(34) & ");</script>" & vbCrLf End If Next Text2.Text = sResult End Sub
Private Sub Command2_Click() Text2.Text = vbNullString End Sub
|
|
|
22
|
Programación / Programación Visual Basic / Re: VB6: Problema con función "ProcessExists"
|
en: 25 Noviembre 2015, 13:57 pm
|
hola por lo que vi estas llamando mal la funcion IncorrectoMsgBox IsProcessRunning(FindProcessID("teste.exe")) IsProcessRunning requiere el nombre del proceso (string) no el id por lo que no es necesario llamar a findprocessID, Ó como quieras puedes usar findprocessID y si este retorna <> 0 quiere decir que el proceso esta en ejecucion MsgBox IsProcessRunning("teste.exe") o MsgBox FindProcessID("teste.exe") <> 0
|
|
|
24
|
Programación / Programación Visual Basic / Re: VB6: Problema con función "ProcessExists"
|
en: 24 Noviembre 2015, 16:05 pm
|
Hola es por un tema de privilegios. para ello tenes que darle ciertos privilegios a tu proceso pega en un modulo bas este codigo Option Explicit Private Declare Function GetCurrentProcess Lib "kernel32" () As Long Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As Luid) As Long Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As Any, ReturnLength As Long) As Long Private Type Luid lowpart As Long highpart As Long End Type Private Type LUID_AND_ATTRIBUTES pLuid As Luid Attributes As Long End Type Private Type TOKEN_PRIVILEGES PrivilegeCount As Long Privileges(1) As LUID_AND_ATTRIBUTES End Type Private Const TOKEN_ADJUST_PRIVILEGES As Long = &H20 Private Const TOKEN_QUERY As Long = &H8 Private Const SE_PRIVILEGE_ENABLED As Long = &H2 Private Const SE_DEBUG_NAME As String = "SeDebugPrivilege" Public Function AdjustPrivileges() As Boolean Dim lToken As Long Dim tTOKEN_PRIVILEGES As TOKEN_PRIVILEGES Dim lProcessID As Long lProcessID = GetCurrentProcess If Not OpenProcessToken(lProcessID, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, lToken) = 0 Then With tTOKEN_PRIVILEGES If LookupPrivilegeValue(vbNullString, SE_DEBUG_NAME, .Privileges(0).pLuid) = 0 Then Exit Function End If .PrivilegeCount = 1 .Privileges(0).Attributes = SE_PRIVILEGE_ENABLED End With If Not AdjustTokenPrivileges(lToken, 0, tTOKEN_PRIVILEGES, Len(tTOKEN_PRIVILEGES), 0&, 0&) = 0 Then AdjustPrivileges = True End If End If End Function
luego en el form load llama a AdjustPrivileges, y la funcion IsProcessRunning anda bien. Saludos.
|
|
|
26
|
Programación / Programación Visual Basic / Re: Capturar contenido en un Picturebox
|
en: 15 Enero 2015, 18:42 pm
|
Hola casualmente alguien pregunto en otro foro lo mismo pero con zoom, aca tenes una rutina en un modulo Option Explicit Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(7) As Byte End Type Private Type PicBmp Size As Long Type As Long hBmp As Long hPal As Long Reserved As Long End Type Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long Private Declare Function ReleaseDC Lib "user32.dll" (ByVal hwnd As Long, ByVal hdc As Long) As Long Private Declare Function PrintWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long Private Declare Function SetStretchBltMode Lib "gdi32.dll" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long Private Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long Function GetPictureControl(oControl As Object, Zoom As Integer) As Picture Dim hdc As Long Dim hDCMemory As Long, hBmp As Long, hBmpPrev As Long Dim hDCMemory2 As Long, hBmp2 As Long, hBmpPrev2 As Long Dim tRect As RECT Dim lWidth As Long, lHeight As Long Dim NewWidth As Long, NewHeight As Long Dim Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID GetWindowRect oControl.hwnd, tRect lWidth = tRect.Right - tRect.Left lHeight = tRect.Bottom - tRect.Top hdc = GetDC(0) hDCMemory = CreateCompatibleDC(0) hBmp = CreateCompatibleBitmap(hdc, lWidth, lHeight) hBmpPrev = SelectObject(hDCMemory, hBmp) PrintWindow oControl.hwnd, hDCMemory, 0 NewWidth = (lWidth * Zoom / 100) NewHeight = (lHeight * Zoom / 100) hDCMemory2 = CreateCompatibleDC(0) hBmp2 = CreateCompatibleBitmap(hdc, NewWidth, NewHeight) hBmpPrev2 = SelectObject(hDCMemory2, hBmp2) SetStretchBltMode hDCMemory2, vbPaletteModeNone StretchBlt hDCMemory2, 0, 0, NewWidth, NewHeight, hDCMemory, 0, 0, lWidth, lHeight, vbSrcCopy ReleaseDC 0, hdc DeleteObject SelectObject(hDCMemory, hBmpPrev) Call DeleteDC(hDCMemory) Call SelectObject(hDCMemory2, hBmpPrev2) Call DeleteDC(hDCMemory2) With IID_IDispatch .Data1 = &H20400 .Data4(0) = &HC0 .Data4(7) = &H46 End With With Pic .Size = Len(Pic) .Type = vbPicTypeBitmap .hBmp = hBmp2 End With Call OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic) Set GetPictureControl = IPic End Function
y en el formulario lo llamas asi con un zoom de 150 (si lo queres tal cual le pones 100) Private Sub Command1_Click() Me.Picture = GetPictureControl(Picture1, 150) End Sub
Saludos.
|
|
|
27
|
Programación / Programación Visual Basic / Re: Abrir imagen en el paint con VBS
|
en: 11 Diciembre 2014, 05:33 am
|
Hola mira creo que asi: hay dos formas una tomando como base la misma ruta que el .vbs y la otra utilizando la ruta del escritorio. Set WshShell = WScript.CreateObject("WScript.Shell") 'WshShell.Run "%windir%\system32\mspaint.exe " & chr(34) & left(WScript.ScriptFullName,instrrev(WScript.ScriptFullName,"\")) & "Imagen\35737.png" & chr(34) WshShell.Run "%windir%\system32\mspaint.exe " & chr(34) & WshShell.SpecialFolders("Desktop") & "\Imagen\35737.png" & chr(34)
|
|
|
28
|
Programación / Programación Visual Basic / Re: Utilizar función ShowInTaskbar con firefox
|
en: 3 Noviembre 2014, 19:13 pm
|
hola no manejo .net pero a simple vista te dira que remplazes "Long" por "System.IntPtr", es importante para que los cambios se resalten tenes que poner la ventana hide luego aplicar el camibio a Not WS_EX_APPWINDOW y luego ponerla visible. ShowWindow hwndFireFox, 0 SetWindowLong hwndFireFox, GWL_EXSTYLE, GetWindowLong(hwndFireFox, GWL_EXSTYLE) And Not WS_EX_APPWINDOW ShowWindow hwndFireFox, 1
|
|
|
29
|
Programación / Programación Visual Basic / Re: Utilizar función ShowInTaskbar con firefox
|
en: 31 Octubre 2014, 20:26 pm
|
Hola dos ayudas rapida, por lo que vi en algunos temas anteriores, yo no lo aria con firefox y lo haria con el webbrowser (si el de iexplorer) pero bueno es tu elecion. para quitar una ventana del la barra de tarea se utiliza la constante WS_EX_APPWINDOW de el api SetWindowRgn un ejemplo en vb6 Option Explicit Private Declare Function ShowWindow Lib "user32.dll" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Const WS_EX_APPWINDOW As Long = &H40000 Private Const GWL_EXSTYLE As Long = -20 Private Sub Command1_Click() Dim hwndFireFox As Long hwndFireFox = Me.hWnd '<--aca ira el de firefox ShowWindow hwndFireFox, 0 SetWindowLong hwndFireFox, GWL_EXSTYLE, GetWindowLong(hwndFireFox, GWL_EXSTYLE) And Not WS_EX_APPWINDOW ShowWindow hwndFireFox, 1 End Sub
y despues si showwindow hace que no te funcione proba recortando la región de la ventana a 0, el navegador puede controlar si esta visible o no, pero no controla si su región esta nula. Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Sub Command1_Click() Dim hwndFireFox As Long hwndFireFox = Me.hWnd 'ocultar la ventana recortandola a 0 SetWindowRgn hwndFireFox, CreateRectRgn(0, 0, 0, 0), True End Sub
|
|
|
30
|
Programación / Programación Visual Basic / Re: [AYUDA]Crear skin con imagen png/bitmap/jpeg(GDI+)
|
en: 12 Septiembre 2014, 21:40 pm
|
Hola, ante todo y me gustaría la opinión de otros moderadores u otros usuarios, los temas de .net irían en esta sección
tomando el hilo del tema, no se mucho de .net pero recuerdo alguna vez que tenia una propiedad para hacer esto, al margen de esto es lo mismo que hacerlo con el api SetLayeredWindowAttributes ahora sea con SetLayeredWindowAttributes o con Regiones, no te va a quitar esos bordes porque no son blancos, quitandolos no queda muy lindo ya que te va a quedar todo muy pixelado, y las sombras inferiores olvídate.
para hacer un skin de este tipo tenes que recurrir a el api UpdateLayeredWindow, si la googleas con vas a encontrar ejemplos para .net
|
|
|
|
|
|
|