Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/08/2011, 18:06
zxs23
 
Fecha de Ingreso: mayo-2009
Mensajes: 238
Antigüedad: 15 años, 11 meses
Puntos: 7
Respuesta: Como ejecutar una imagen con el visor de imagenes de windows

ASI:
Código:
Option Explicit

Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long
Private Declare Function GetVersion Lib "kernel32" () As Long

Private Function FixPath(ByVal strPath As String) As String
    FixPath = strPath & IIf(Left$(strPath, 1) = "\", "", "\")
End Function

Public Function ShowImageViewer(ByVal strPath As String) As Boolean

    Dim lngLib As Long
    Dim lngFunc As Long
    
    If (((GetVersion And &HFFFF&) Mod 256) = 6) Then
        lngLib = LoadLibrary(FixPath(Environ("ProgramFiles")) & "Windows Photo Viewer\PhotoViewer.dll")
    Else
        lngLib = LoadLibrary("shimgvw.dll")
    End If
    
    lngFunc = GetProcAddress(lngLib, "imageview_fullscreenW")
    
    CallWindowProc lngFunc, 0&, 0&, StrPtr(strPath), 0&
End Function

Private Sub Command1_Click()
Call ShowImageViewer(App.Path & "\imp.png")
End Sub
Fuente:
http://www.leandroascierto.com.ar/fo...hp?topic=351.0