News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

shimgvw dll who show images in the explorer

Started by ToutEnMasm, November 22, 2010, 01:40:30 PM

Previous topic - Next topic

ToutEnMasm


This dll have some functions who can be (perhaps) useful in asm.
I have tried this:
Quote
   invoke LoadLibrary,addr pathshimgvw
   mov Hmodule,eax
   invoke GetProcAddress,Hmodule,addr szImageView_Fullscreen
   mov HImageView_Fullscreen,eax
   invoke AtoU,addr pathimage   ;ascii to unicode
   mov    pszupathimage,eax
   ;invoke ImageView_Fullscreen,hwnd,hInstance,pszupathimage,SW_NORMAL
   invoke ImageView_Fullscreen,NULL,hInstance,psupathimage,SW_NORMAL
The functions of the dll are undocumented.
Not really very successful ,is someone have made others tests ?


ToutEnMasm


I answer myself
The dll as the same need as ShellExecute
Quote
invoke CoInitializeEx,NULL, COINIT_APARTMENTTHREADED OR COINIT_DISABLE_OLE1DDE   
and ..it's work
To have the full set of functions,use dumpbin (c++ express) with /EXPORTS option.

Vortex

Hi ToutEnMasm,

Thanks for the info. Here is a quick example :


.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc

includelib  \masm32\lib\kernel32.lib
includelib  shimgvw.lib

UnicodeStr              PROTO :DWORD,:DWORD         
ImageView_Fullscreen    PROTO :DWORD,:DWORD,:DWORD,:DWORD


.data

file    db '\forum.jpg',0

.data?

CurDir  db 64 dup(?)
buffer  db 200 dup(?)

.code

start:

    invoke  GetCurrentDirectory,64,ADDR CurDir
    invoke  lstrcat,ADDR CurDir,ADDR file

    invoke  UnicodeStr,ADDR CurDir,ADDR buffer

    invoke  GetModuleHandle,0
    invoke  ImageView_Fullscreen,NULL,eax,ADDR buffer,SW_NORMAL

    invoke  ExitProcess,0

END start

jj2007

One more example from the new MasmBasic version, using dynamic loading:

include \masm32\MasmBasic\MasmBasic.inc ; use the MasmBasic library (includes Masm32, too)
Init ; initialise the app
Dll "shimgvw" ; load the Windows Picture and Fax Viewer Library
Declare ImageView_Fullscreen, 4 ; ImageView_Fullscreen expects 4 dwords
void ImageView_Fullscreen(0, 0, wCL$(1), SW_SHOW) ; wCL$: wide version of the commandline
Err$(1) ; there is no retval, so we have to test for errors
Exit ; do a clean exit, inter alia FreeLibrary
end start


Apparently, the shimgvw DLL ignores the SW_ parameter. The app always uses the last mode and position selected by the user, at least on Win XP SP2. Since there is also no valid return value, Err$(1) uses GetLastError to test for problems.
GetModuleHandle seems not to be necessary.

Antariy

invoke WinExec,CTXT("rundll32.exe shimgvw.dll,ImageView_Fullscreen ThePictureFile.Jpg"),1