04. september 2004 - 06:09Der er
3 kommentarer og 1 løsning
Klip billede ud fra webside og sammenlign
Hej Eksperter!
Er det muligt at tage et billede af skærmen fra nogen bestemte punkter (altså x,y og x,y)
Alts den skal fx. starte med at tage fra punkt 100,200 og til 150,300.
Det billede programmet får fra den position, skal så sammenlignes med nogen andre billeder i en mappe. Hvis der bliver fundet et identisk billede, skal der komme en MessageBox med billedets navn.
Jeg har et lille problem... jeg kunne godt tænke mig at gemme de billeder der bliver taget med screenshot. Jeg synes det screenshot program du linkede til var lidt for besværligt, s jeg fandt et nyt:
Option Explicit Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Public Sub ShotPos(picBox As PictureBox, pxX As Long, pxY As Long, pxWidth As Long, pxHeight As Long) Call BitBlt(picBox.hdc, 0, 0, pxWidth, pxHeight, GetDC(0), pxX, pxY, vbSrcCopy) End Sub
Private Sub Command1_Click() ShotPos Picture1, 297, 496, 38, 38 End Sub
Men hvis jeg prøver at bruge: Private Sub Command2_Click() Savepicture Picture1.image, "C:\billede.bmp" End Sub
så er billede.bmp bare et guligt billede uden det billede der skulle have været.
Ja det er også bare mig som laver at formeret API :D
Option Explicit
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Public Sub ShotPos(picBox As PictureBox, pxX As Long, pxY As Long, pxWidth As Long, pxHeight As Long) Call BitBlt(picBox.hDC, 0, 0, pxWidth, pxHeight, GetDC(0), pxX, pxY, vbSrcCopy) End Sub
Private Sub Command1_Click() ShotPos Picture1, 297, 496, 38, 38 Picture1.Picture = Picture1.Image '<- Ny her End Sub
'Men hvis jeg prøver at bruge: Private Sub Command2_Click() SavePicture Picture1.Image, "C:\billede.bmp" End Sub
Private Sub Form_Load() Picture1.AutoRedraw = True '<- Ny her End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.