Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Visionneuse PDF avec dynawrap

1 réponse
Avatar
omen999
bonjour,

pour tester la version am=E9lior=E9e du composant dynawrap
(la version initiale datait de 1998) =E9crit par Gilles Laurent:
http://glsft.free.fr/index.php?option=3Dcom_content&task=3Dview&id=3D47&Ite=
mid=3D33
j'ai imagin=E9 une visionneuse pdf basique qui utilise les services du
freeware
sorax reader dispo ici: http://www.soraxsoft.com/index.html

il convient d'y ajouter une petite dll =E9crite par mes soins dispo ici:
http://rapidshare.com/files/133592229/PdfScript.dll.html

je dois dire que je n'ai pas tr=E8s bien compris la syntaxe
de la fonction SetMemInBSTRAddr avec nDataType=3Ddw_BSTR
mais =E7a n'a pas d'incidence sur le bon fonctionnement du code...

ps: la gestion des bookmarks n'a pas =E9t=E9 achev=E9e ;-)

PdfViewer.vbs :

Option Explicit
' exemple de visionneuse pdf
' utilise le composant automation DynaWrap am=E9lior=E9 par Gilles Laurent
qui autorise la gestion
' des types structur=E9s; http://glsft.free.fr/index.php?option=3Dcom_conte=
nt&task=3Dview&id=3D47&Itemid=3D33
' n=E9cessite =E9galement l'installation de Sorax Reader et de la
biblioth=E8que PdfScript.dll
' omen999 ao=FBt 2008

Class XGui 'v3.1 "lightweight"
' cette classe permet de cr=E9er directement une boite de dialogue =E0
partir de l'API de fa=E7on "almost trivial"
Public dFrmData 'objet dictionnaire sName -> handle/valeur finale du
contr=F4le
Public Sub CreateForm(sCaption,lLeft,lTop,lWidth,lHeight,bOnTaskBar)
'Cr=E9e une feuille non modale et invisible
'sCaption: titre de la feuille
'lLeft,lTop: coordonn=E9es de l'angle haut gauche de la feuille
'lWidth, lHeight: dimensions de la feuille
'bOnTaskBar: si vrai (-1) la feuille est affich=E9e dans la barre des
t=E2ches

Const WS_VISIBLE=3D&H10000000
Const WS_POPUP=3D&H80000000
Const WS_OVERLAPPEDWINDOW=3D&HCF0000
Dim hTask,fChild
If bOnTaskBar Then
hTask=3D0
fChild=3D0
Else
hTask=3DhWsh
fChild=3DWS_CHILD
End If
hWF=3DoApi.CreateWindowExA(0,"#32770",sCaption&"",WS_OVERLAPPEDWINDOW
+WS_POPUP+fChild,lLeft,lTop,lWidth,lHeight,hTask,0,hIns,0)
End Sub
Public Sub ShowForm(bAlwaysOnTop)
'Affiche la feuille pr=E9alablement cr=E9=E9e par CreateForm
'bAlwaysOnTop: si vrai (-1) la feuille sera toujours au premier plan
Const HWND_TOP=3D0
Const HWND_TOPMOST=3D-1
Const SWP_SHOWWINDOW=3D&H40
Const SWP_NOMOVE=3D&H2
Const SWP_NOSIZE=3D&H1
Dim fTop

If bAlwaysOnTop Then fTop=3DHWND_TOPMOST Else fTop=3DHWND_TOP
oApi.SetWindowPos hWF,fTop,0,0,0,0,SWP_SHOWWINDOW+SWP_NOMOVE
+SWP_NOSIZE
End Sub
Public Sub RunForm()
'G=E8re la pompe =E0 messages de la feuille qui devient modale ainsi que
le contenu final du dictionnaire
Const WM_COMMAND=3D&H111
Const WM_SYSCOMMAND=3D&H112
Const WM_KEYUP=3D&H101
Const WM_LBUTTONUP=3D&H202
Const WM_TIMER=3D&H113
Const WM_SETTEXT=3D&HC
Const GCW_ATOM=3D-32
Const LB_GETCURSEL=3D&H188
Const LB_ERR=3D-1
Const LB_GETTEXT=3D&H189
Const LB_GETTEXTLEN=3D&H18A
Const GWL_STYLE=3D-16
Const WS_CHILD=3D&H40000000
Const WS_VISIBLE=3D&H10000000
Const WS_TABSTOP=3D&H10000
Const BS_AUTOCHECKBOX=3D&H3
Const BS_AUTORADIOBUTTON=3D&H9
Const BM_GETCHECK=3D&HF0
Const BST_UNCHECKED=3D&H0
Const BST_CHECKED=3D&H1
Const BST_INDETERMINATE=3D&H2
Const BST_PUSHED=3D&H4
Const BST_FOCUS=3D&H8
Const CP_ACP=3D0
Const GWL_ID=3D-12
Const PBM_SETSTEP=3D&H404
Const PBM_STEPIT=3D&H405
Const PBM_SETBARCOLOR=3D&H409
Const CLR_DEFAULT=3D&HFF000000
Const CB_GETDROPPEDSTATE=3D&H157
Const WM_PV_SHOWPAGE=3D&H405
Const WM_USER=3D&H400
Const WM_NOTIFY=3D&H4E
Const PVN_OPEN_FILE=3D&H501
Const PVN_GOTO_PAGE=3D&H502
Const PVN_RUN_APP=3D&H503
Const PVN_GO_BACK=3D&H504
Const PVN_GO_FORWARD=3D&H505
Const PVN_QUIT=3D&H506
Const TVM_INSERTITEM=3D&H1100
Const dw_LONG=3D4
Const dw_BSTR=3D0
'variables dlg s=E9lection fichier pdf
Dim aFilter(3),sFilters
Dim sFullFileName,sFileName,sInitDir,sDefExt,sTitre
Dim OPENFILENAME,pOPENFILENAME,lRc

Dim sCN,sCNW 'contenu du contr=F4le ansi/wide
Dim aKData,aHData 'contenu du dictionnaire cl=E9s/donn=E9es
Dim lGetI 'index de l'item s=E9lectionn=E9 (listbox)
Dim lStyle 'style du bouton
Dim lKCode 'param message
Dim lPos 'position barre de progression
Dim lCurPage 'page courante doc pdf
Dim n 'compteur

Do While oApi.GetMessageA(pMSG,hWF,0,0)>0 'Main loop messages pump
'WM_NOTIFY is sync message, so isn't set in queue
If oApi.GetMemInBSTRAddr(pMSG,4,dw_LONG)=3DPVN_GOTO_PAGE Then 'set
current page
lCurPage=3DoApi.GetMemInBSTRAddr(pMSG,8,dw_LONG)
oApib.SendMessageA dFrmData.Item("curpage"),WM_SETTEXT,
0,CStr(lCurPage)
End If
If oApi.IsDialogMessageA(hWF,pMSG)<>0 Then
Select Case oApi.GetMemInBSTRAddr(pMSG,4,dw_LONG)
Case WM_KEYUP,WM_LBUTTONUP 'touche clavier ou bouton gauche souris
lKCode=3DoApi.GetMemInBSTRAddr(pMSG,8,dw_LONG)
If oApi.GetMemInBSTRAddr(pMSG,4,dw_LONG)=3DWM_LBUTTONUP Then
If dFrmID.Item(oApi.GetFocus)=3D"button" Then lKCode=3D13 'assimile
le clic gauche souris =E0 la touche enter
End if
Select Case lKCode 'suivant le code de la touche
Case 27 'esc -> fermeture sans sauvegarde des donn=E9es publiques
If Not bOpenF Then
dFrmData.RemoveAll
oApi.DestroyWindow hWF
Exit Do
Else
bOpenF=3DFalse
End If
Case 33 'PgUp
If lCurPage > 1 Then
lCurPage=3DlCurPage-1
oApi.SendMessageA oApi.GetFocus,WM_PV_SHOWPAGE,lCurPage,98
oApib.SendMessageA dFrmData.Item("curpage"),WM_SETTEXT,
0,CStr(lCurPage)
End If
Case 34 'PgDown
If lCurPage < lTPages Then
lCurPage=3DlCurPage+1
oApi.SendMessageA oApi.GetFocus,WM_PV_SHOWPAGE,lCurPage,98
oApib.SendMessageA dFrmData.Item("curpage"),WM_SETTEXT,
0,CStr(lCurPage)
End If
Case 13,32 'enter ou space quand le contr=F4le courant est un bouton
If oApi.GetClassLongA(oApi.GetFocus,GCW_ATOM)=3D49175 Then 'get
atom button
sCNW=3DUCase(GetBSTRCtrl(oApi.GetFocus))
If sCNW=3D"&OK" Then 'c'est le bouton OK donc maj du dictionnaire
et fermeture de la feuille
aKData=3DdFrmData.Keys 'tableau des nomd des contr=F4les
aHData=3DdFrmData.Items 'tableau des handles des contr=F4les
For n=3D0 To dFrmData.Count-1 'boucle de la maj
sCNW=3D"" ' valeur unicode =E0 r=E9cup=E9rer
sCNW=3DGetBSTRCtrl(aHData(n))
dFrmData.Item(aKData(n))=3DsCNW 'la maj
Next
oApi.DestroyWindow hWF ' maj dico termin=E9e fermeture feuille
Exit Do
End If
If sCNW=3D"&CANCEL" Then ' fermeture sans sauvegarde
dFrmData.RemoveAll
oApi.DestroyWindow hWF
Exit Do
End If
'If sCNW=3D"&CLOSE" Then
' oApi.SendMessageA dFrmData.Item("pdf1"),WM_PD_DETACH,0,0
' oAPi.SPD_Close hPdf
' oApi.InvalidateRect dFrmData.Item("pdf1"),0,-1
'End If
If sCNW=3D"O&PEN" Then
'd=E9finition des param=E8tres de la boite
aFilter(0)=3D"Tous fichiers (*.*)"
aFilter(1)=3D"*.*"
aFilter(2)=3D"Fichiers pdf (*.pdf)"
aFilter(3)=3D"*.pdf"
sFilters=3DJoin(aFilter,vbNullChar) & vbNullChar & vbNullChar
sFullFileName=3Dstring(1024,chr(0)) 'peut contenir un nom complet
de fichier qui sera propos=E9 comme le fichier par d=E9faut
sFileName=3Dstring(128,chr(0))
sInitDir=3D"C:\Documents and Settings\Nemo\Mes documents"
sTitre=3D"S=E9lectionner un fichier pdf"
sDefExt=3D"pdf"
OPENFILENAME=3DString(38,Chr(0))
pOPENFILENAME=3DoApi.GetBSTRAddr(OPENFILENAME)
With oApi
.SetMemInBSTRAddr pOPENFILENAME,0,dw_LONG,76 'lStructSize
OPENFILENAME_SIZE_VERSION_400
.SetMemInBSTRAddr pOPENFILENAME,4,dw_LONG,hWF 'hwndOwner
handle de la fen=EAtre parent (peut =EAtre nul)
'.SetMemInBSTRAddr pOPENFILENAME,8,dw_LONG,0 'hInstance
inutilisable
.SetMemInBSTRAddr pOPENFILENAME,
12,dw_LONG,oApi.GetBSTRAddr(sFilters)'filtre d'affichage
'.SetMemInBSTRAddr pOPENFILENAME,16,dw_LONG,0
'lpstrCustomFilter inutilisable
'.SetMemInBSTRAddr pOPENFILENAME,20,dw_LONG,0
'nMaxCustFilter inutilisable
.SetMemInBSTRAddr pOPENFILENAME,24,dw_LONG,2 'FilterIndex
s=E9lectionne le 2=E8me filtre par d=E9faut
.SetMemInBSTRAddr pOPENFILENAME,
28,dw_LONG,oApi.GetBSTRAddr(sFullFileName)'fichier avec chemin
complet
.SetMemInBSTRAddr pOPENFILENAME,32,dw_LONG,1024 'taille du
buffer fichier (min: 256)
.SetMemInBSTRAddr pOPENFILENAME,
36,dw_LONG,oApi.GetBSTRAddr(sFileName)'lpstrFileTitle nom du fichier
seul
.SetMemInBSTRAddr pOPENFILENAME,40,dw_LONG,128 'taille du
nom fichier
.SetMemInBSTRAddr pOPENFILENAME,
44,dw_LONG,oApi.GetBSTRAddr(sInitDir) 'r=E9pertoire par d=E9faut
.SetMemInBSTRAddr pOPENFILENAME,
48,dw_LONG,oApi.GetBSTRAddr(sTitre)'titre de la boite de dialogue
(facultatif)
'**TEST**.SetMemInBSTRAddr pOPENFILENAME,
48,dw_BSTR,sTitre'titre de la boite de dialogue (facultatif)
'.SetMemInBSTRAddr pOPENFILENAME,52,dw_LONG,0 'flags
(voir ci-dessus la liste des options)
'.SetMemInBSTRAddr pOPENFILENAME,56,dw_LONG,0 'offset nom
fichier (valeur renvoy=E9e)
'.SetMemInBSTRAddr pOPENFILENAME,60,dw_LONG,0 'offset
extension (valeur renvoy=E9e)
.SetMemInBSTRAddr pOPENFILENAME,
64,dw_LONG,oApi.GetBSTRAddr(sDefExt)'extension par d=E9faut si
l'utilisateur l'oublie
'.SetMemInBSTRAddr pOPENFILENAME,68,dw_LONG,0 'lCustData
inutilisable
'.SetMemInBSTRAddr pOPENFILENAME,72,dw_LONG,0 'lpfnHook
inutilisable
'.SetMemInBSTRAddr pOPENFILENAME,76,dw_LONG,0
'lpTemplateName inutilisable
bOpenF=3DTrue
lRc=3D.GetOpenFileNameW(pOPENFILENAME)
End With
If lRc <> 0 Then
'clean trailer
sFullFileName=3DReplace(sFullFileName,Chr(0),"")
oApi.DestroyWindow dFrmData.Item("button1")
AddControl "pdf1","pdfview",sFullFileName,0,0,892,720,0
bOpenF=3DFalse
End If
End If
End If
End Select
Case WM_COMMAND,WM_SYSCOMMAND
If (oApi.GetMemInBSTRAddr(pMSG,8,dw_LONG)=3D2) Or
(oApi.GetMemInBSTRAddr(pMSG,8,dw_LONG)=3D61536) Then 'bouton fermeture
de la feuille ou menu syst=E8me
dFrmData.RemoveAll
oApi.DestroyWindow hWF
Exit Do
End If
End Select
Else
oApi.TranslateMessage pMSG
oApi.DispatchMessageA pMSG
End If
Loop
End Sub
Public Sub
AddControl(sName,sClass,sData,lLeft,lTop,lWidth,lHeight,bFlag)
'ajoute un contr=F4le sur la feuille cr=E9=E9e par la m=E9thode CreateForm
'sName: nom unique du contr=F4le
'sClass: nom d'une des classes globales du syst=E8me (=E0 compl=E9ter)
'sData: donn=E9es du contr=F4le =E0 cr=E9er
'lLeft,lTop: coordonn=E9es relatives de l'angle haut gauche du contr=F4le
'lWidth, lHeight: dimensions du contr=F4le
'bFlag: valeur flag/handle d=E9pendant du contr=F4le bouton->activ=E9/
d=E9sactiv=E9 checkbox radiobox ->chk/unchk pdfview->handle fen=EAtre

Const WS_EX_CLIENTEDGE=3D&H200
Const WS_EX_STATICEDGE=3D&H20000
Const PBS_SMOOTH=3D&H1
Const DEFAULT_GUI_FONT=3D17
Const WM_SETFONT=3D&H30
Const WS_CHILD=3D&H40000000
Const WS_VISIBLE=3D&H10000000
Const WS_DISABLED=3D&H8000000
Const WS_TABSTOP=3D&H10000
Const WM_SETTEXT=3D&HC
Const GWL_ID=3D-12
Const WS_VSCROLL=3D&H200000
Const BS_AUTOCHECKBOX=3D&H3
Const BS_AUTORADIOBUTTON=3D&H9
Const BS_GROUPBOX=3D&H7
Const BM_SETCHECK=3D&HF1
Const BST_CHECKED=3D1
Const LBS_HASSTRINGS=3D&H40
Const CBS_DROPDOWN=3D&H2
Const CBS_DROPDOWNLIST =3D &H3
Const CB_ADDSTRING=3D&H143
Const LB_ADDSTRING=3D&H180
Const LBS_DISABLENOSCROLL=3D&H1000
Const WM_PD_ATTACH=3D&H401
Const WM_PD_DETACH=3D&H402
Const WM_PV_SHOWPAGE=3D&H405
Const WM_PV_DOOPENACTION=3D&H410
Const WM_PV_PRINT=3D&H40A
Const dw_LONG=3D4

Dim hWn 'handle du contr=F4le courant
Dim sD 'donn=E9e(s) du contr=F4le courant
Dim cbBuf 'tableau des donn=E9es liste ou combo
Dim sX 'gestion des diff=E9rents types boutons
Dim lStyle 'style du contr=F4le courant
Dim lStyleEx 'style =E9tendu du contr=F4le courant
Dim lSL 'style liste ou combo
Dim n 'compteur
Dim fX
Dim REC 'structure dimension du contr=F4le pdf viewer
Dim pREC 'pointeur structure

fX=3Dfalse
'd=E9finition des param=E8tres de CreateWindowEx selon la classe du
contr=F4le
Select Case UCase(sClass)
Case "STATIC"
sX=3DsClass
sD=3DsData
lStyle=3DWS_CHILD+WS_VISIBLE
lStyleEx=3D0
Case "BUTTON"
sX=3DsClass
sD=3DsData
lStyle=3DWS_CHILD+WS_VISIBLE+WS_TABSTOP
If Not bFlag Then lStyle=3DlStyle+WS_DISABLED
lStyleEx=3D0
Case "PDFVIEW" 'DLL SORAX READER
With oApi
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_ResetConfig","f=3Dc","i=3Ds","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_Open","f=3Dc","i=3Dsss","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_Close","f=3Dc","i=3Dl","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_GetPageCount","f=3Dc","i=3Dl","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_GetOutline","f=3Dc","i=3Dhll","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPD_PrintDirect","f=3Dc","i=3Dlsllt","r=3Dl"
.Register "C:\Program Files\Sorax Reader
\SPDF.dll","SPV_Create","f=3Dc","i=3Dhlu","r=3Dl"
'.SPD_ResetConfig "C:\SPDF.ini" (facultatif)
.InitDll 'initialise PdfScript
lpProc=3D.SendToPost(hWF) 'permet la gestion des messages
WM_NOTIFY et de SPDOUTLINEPROC
End With
REC=3DString(8,Chr(0))
sX=3D"spdfview"
sD=3DsData
fX=3DTrue
Case Else
Err.raise 10000,"M=E9thode AddControl","La classe " & sClass & " n'est
pas une classe globale du syst=E8me"
Exit Sub
End Select
If fX Then ' Pdf Viewer
With oApi
pREC=3D.GetBSTRAddr(REC)
.SetMemInBSTRAddr pREC,0,dw_LONG,lLeft
.SetMemInBSTRAddr pREC,4,dw_LONG,lTop
.SetMemInBSTRAddr pREC,8,dw_LONG,lWidth
.SetMemInBSTRAddr pREC,12,dw_LONG,lHeight
hWn=3D.SPV_Create(hWF,pREC,256)
hPdf=3D.SPD_Open(sD&"","","")
.SendMessageA hWn,WM_PD_ATTACH,0,hPdf
.SendMessageA hWn,WM_PV_SHOWPAGE,1,98 'default displaymode
98
WScript.Sleep 200 'd=E9lai de parsing...
End With
oApib.SendMessageA hWF,WM_SETTEXT,0,sD&""
oApib.SendMessageA dFrmData.Item("curpage"),WM_SETTEXT,0,"1"
lTPages=3DoApi.SPD_GetPageCount(hPdf)
oApib.SendMessageA dFrmData.Item("totpages"),WM_SETTEXT,
0,CStr(lTPages)
oApi.SPD_GetOutline hPdf,lpProc,hWF 'envoie les bookmarks du doc =E0
la fonction SPDOUTLINEPROC
Else
=20
hWn=3DoApi.CreateWindowExA(lStyleEx,sX&"",sD&"",lStyle,lLeft,lTop,lWidth,lH=
eight,hWF,
0,hIns,0) 'cr=E9ation du contr=F4le
oApi.SendMessageA
hWn,WM_SETFONT,oApi.GetStockObject(DEFAULT_GUI_FONT),-1 'fonte
par d=E9faut
End if
dFrmData.Add sName,hWn 'ajoute une entr=E9e pour le contr=F4le cr=E9=E9 da=
ns
le dictionnaire
dFrmID.Add hWn,LCase(sX)

End Sub
'**************************************************************************=
***********************************
IMPLEMENTATION
Private dFrmID 'objet dico pour identifier la classe des contr=F4les
Public oApi 'objet Dynawrap
Private oApib 'objet SendMessage (syntaxe diff=E9rente)
Private oWaw 'objet conversion ANSI -> UNICODE

Private MSG 'structure MSG d=E9finie par l'API (message queue)
Private pMSG 'pointeur structure MSG
Private hIns 'handle de l'instance
Private hWsh 'handle de la fen=EAtre principale WScript (cach=E9e)
Private hWF 'handle de la feuille cr=E9=E9e
Private hPdf 'handle contr=F4le pdf
Private lTPages 'nb de pages du doc pdf
Private bOpenF 'flag dlg openfile
Public xRes,yRes 'dimensions =E9cran
Private lpProc 'pointeur fonction SPDOUTLINEPROC

Private Sub Class_Initialize 'Constructeur
Const GWL_HINSTANCE=3D-6
Const HORZRES=3D8
Const VERTRES=3D10
Set oApi=3DCreateObject("DynamicWrapper")
Set oApib=3DCreateObject("DynamicWrapper")
Set oWaw=3DCreateObject("DynamicWrapper")
With oApi
.Register "user32.dll","FindWindowA","f=3Ds","i=3Dss","r=3Dl"
.Register
"user32.dll","CreateWindowExA","f=3Ds","i=3Dlsslllllllll","r=3Dl"
.Register "user32.dll","SetWindowPos","f=3Ds","i=3Dlllllll","r=3Dl"
.Register "user32.dll","GetMessageA","f=3Ds","i=3Dllll","r=3Dl"
.Register "user32.dll","DispatchMessageA","f=3Ds","i=3Dl","r=3Dl"
.Register "user32.dll","TranslateMessage","i=3Dl","f=3Ds","r=3Dl"
.Register "user32.dll","GetWindowLongA","f=3Ds","i=3Dll","r=3Dl"
.Register "user32.dll","EnableWindow","f=3Ds","i=3Dll","r=3Dl"
.Register "user32.dll","SendMessageA","f=3Ds","i=3Dllll","r=3Dl"
.Register "user32.dll","SetWindowLongA","f=3Ds","i=3Dlll","r=3Dl"
.Register "user32.dll","GetWindowLongA","f=3Ds","i=3Dll","r=3Dl"
.Register "user32.dll","IsDialogMessageA","f=3Ds","i=3Dll","r=3Dl"
.Register "user32.dll","DestroyWindow","f=3Ds","i=3Dl","r=3Dl"
.Register "user32.dll","GetFocus","f=3Ds","r=3Dl"
.Register "user32.dll","GetWindowTextA","f=3Ds","i=3Dlll","r=3Dl"
.Register "user32.dll","GetWindowTextLengthA","f=3Ds","i=3Dl","r=3Dl"
.Register "user32.dll","GetClassLongA","f=3Ds","i=3Dll","r=3Dl"
.Register "user32.dll","GetDC","f=3Ds","i=3Dh","r=3Dl"
.Register "user32.dll","UpdateWindow","f=3Ds","i=3Dh","r=3Dl"
.Register "user32.dll","InvalidateRect","f=3Ds","i=3Dhll","r=3Dl"
.Register "gdi32.dll","GetStockObject","f=3Ds","i=3Dl","r=3Dl"
.Register "gdi32.dll","GetDeviceCaps","f=3Ds","i=3Dll","r=3Dl"
.Register "comctl32.dll","InitCommonControls","f=3Ds"
.Register "comdlg32.dll","GetOpenFileNameW","f=3Ds","i=3Dl","r=3Dl"
.Register "user32.dll","SetTimer","f=3Ds","i=3Dllll","r=3Dl"
.Register "user32.dll","KillTimer","f=3Ds","i=3Dll","r=3Dl"
.Register "PdfScript.dll","InitDll","f=3Dc","r=3Dl"
.Register "PdfScript.dll","SendToPost","f=3Dc","i=3Dl","r=3Dl"
End With
oApib.Register "user32.dll","SendMessageA","f=3Ds","i=3Dllls","r=3Dl" 'di
oWaw.Register
"kernel32.dll","MultiByteToWideChar","f=3Ds","i=3Dllllll","r=3Dl"
MSG=3DString(14,Chr(0))
pMSG=3DoApi.GetBSTRAddr(MSG)
oApi.SetMemInBSTRAddr pMSG,0,4,28
'instanciation des dictionnaires qui vont g=E9rer les donn=E9es des
contr=F4les cr=E9=E9s
Set dFrmData=3DCreateObject("Scripting.Dictionary")
Set dFrmID=3DCreateObject("Scripting.Dictionary")
'r=E9cup=E8re le handle de l'instance
hWsh=3DoApi.FindWindowA("WSH-Timer",chr(0))
hIns=3DoApi.GetWindowLongA(hWsh,GWL_HINSTANCE)
'lit les dims de l'=E9cran
xRes=3DoApi.GetDeviceCaps(oApi.GetDC(0),HORZRES)
yRes=3DoApi.GetDeviceCaps(oApi.GetDC(0),VERTRES)
bOpenF=3DFalse
'oApi.InitCommonControls inutile, comctl32.dll est d=E9j=E0 r=E9f=E9renc=
=E9e
par la fonction .register
End Sub
Private Function GetBSTRCtrl(hdW)
' Renvoie le contenu d'un contr=F4le de handle hdW sous la forme d'une
chaine BSTR
Const CP_ACP=3D0
Dim sBuf,sBufW
sBuf=3DString(oApi.GetWindowTextLengthA(hdW),Chr(0))
=09
sBufW=3DString(oApi.GetWindowTextA(hdW,oApi.GetBSTRAddr(sBuf),oApi.GetWindo=
wTextLengthA(hdW)
+1),Chr(0))
oWaw.MultiByteToWideChar CP_ACP,
0,oApi.GetBSTRAddr(sBuf),-1,oApi.GetBSTRAddr(sBufW),LenB(sBufW)
GetBSTRCtrl=3DsBufW
End Function
End Class

Dim oFrm
Set oFrm=3DNew XGui
oFrm.CreateForm "PdfViewer by omen999",(oFrm.xRes-900)/2,
(oFrm.yRes-800)/2,900,800,-1 ' feuille non modale
oFrm.AddControl "curpage","static","0",10,730,24,24,True
oFrm.AddControl "slash","static","/",36,730,6,24,True
oFrm.AddControl "totpages","static","0",42,730,24,24,True
oFrm.AddControl "button1","button","O&pen",734,730,70,24,True
oFrm.AddControl "button2","button","&Cancel",808,730,70,24,True
oFrm.ShowForm False
oFrm.RunForm 'pompe =E0 messages (rend la feuille modale)

1 réponse

Avatar
Gilles LAURENT [MVP]
"omen999" a écrit dans le message de
news:
| bonjour,

Bonjour,

| pour tester la version améliorée du composant dynawrap
| (la version initiale datait de 1998) écrit par Gilles Laurent:
|
http://glsft.free.fr/index.php?option=com_content&task=view&idG&Itemid3" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://glsft.free.fr/index.php?option=com_content&task=view&idG&Itemid3
| j'ai imaginé une visionneuse pdf basique qui utilise les services du
| freeware
| sorax reader dispo ici: http://www.soraxsoft.com/index.html
|
| il convient d'y ajouter une petite dll écrite par mes soins dispo ici:
| http://rapidshare.com/files/133592229/PdfScript.dll.html

Très intéressant !
Tentative de communication via votre e-mail publique.
Sinon, me contacter via mon site.

--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr