| //********************** Déclaration des structures nécessaires à la fonction de l'API : RECT est une structure eLeft est un entier //Type C : LONG eTop est un entier //Type C : LONG eRight est un entier //Type C : LONG eBottom est un entier //Type C : LONG FIN //********************** Fin de la déclaration des structures pour HORZSIZE est un entier=4 VERTSIZE est un entier=6 HORZRES est un entier=8 VERTRES est un entier=10
iWidthMM est un entier iHeightMM est un entier iWidthPels est un entier iHeightPels est un entier
hWnd est un entier HDCWMF est un entier // Type C :HDC HDC est un entier // Type C :HDC sNom est un chaîne Coord est un RECT // Pointeur sur structureRECT sDesc est une chaîne SRCCOPY est un entier=13369376//(DWORD)0x00CC0020
HDC= dDébutDessin(CHP_IMAGE_SOURCE)//<--------- Chanp image à partir duquel ou vent faire un WMF sNom="FichierImage.WMF" iWidthMM = API("GDI32","GetDeviceCaps",HDC, HORZSIZE) iHeightMM = API("GDI32","GetDeviceCaps",HDC, VERTSIZE) iWidthPels = API("GDI32","GetDeviceCaps",HDC, HORZRES) iHeightPels = API("GDI32","GetDeviceCaps",HDC, VERTRES)
// Retrieve the coordinates of the client // rectangle, in pixels. Coord:eTop =0 Coord:eLeft =0 Coord:eRight = CHP_IMAGE_SOURCE..Largeur Coord:eBottom = CHP_IMAGE_SOURCE..Hauteur
// Convert client coordinates to .01-mm units. // Use iWidthMM, iWidthPels, iHeightMM, and // iHeightPels to determine the number of // .01-millimeter units per pixel in the x- // and y-directions.
Coord:eLeft = (Coord:eLeft * iWidthMM * 100)/iWidthPels; Coord:eTop = (Coord:eTop * iHeightMM * 100)/iHeightPels; Coord:eRight = (Coord:eRight * iWidthMM * 100)/iWidthPels; Coord:eBottom = (Coord:eBottom * iHeightMM * 100)/iHeightPels; HDCWMF=API("GDI32","CreateEnhMetaFileA",HDC,&sNom,&Coord,&sDesc)
//copie de l'image affiché dans le DC du WMF SI API("GDI32","StretchBlt",HDCWMF,0,0,CHP_IMAGE_SOURCE..Largeur,... CHP_IMAGE_SOURCE..Hauteur,HDC,0,0,CHP_IMAGE_SOURCE..Largeur,... CHP_IMAGE_SOURCE..Hauteur,SRCCOPY)=0 ALORS Erreur("StretchBlt",ErreurInfo()) FIN API("GDI32","CloseEnhMetaFile",HDCWMF) SI HDCWMF=0 ALORS Erreur("Erreur de création du WMF",ErreurInfo()) SINON Info("Ok") FIN | |
|