[ طلب ] اريد التقاط صوره عن طريق ملف bat

تم تحميل الصفحة في 1,6131894 ثانية
اريد التقاط صوره عن طريق ملف bat
إنضم
7 سبتمبر 2010
المشاركات
3,261
الإعجابات
1,634
النقاط
113
اريد التقاط صوره عن طريق ملف bat
عايز اخد سكرين شوت للجهاز عن طريق ملف بات

ويقوم بحفظ الصوره فى مكان معين

على الجاهز
 

عـبـدالـله

.:: مُشرف قسم python ::.
rankrankrankrank
إنضم
5 ديسمبر 2013
المشاركات
1,975
الإعجابات
2,486
النقاط
198
نضعه في while

حتى يشتغل مضبوط

Python:
from PIL import ImageGrab
import keyboard
while True:
    if keyboard.is_pressed('Alt+F11'):
           image = ImageGrab.grab()
           image.save("screenshot.png")
           break
 
إنضم
7 سبتمبر 2010
المشاركات
3,261
الإعجابات
1,634
النقاط
113
انا عملت ده

بيكون عندى شغال تمام وبيعمل فولدر بجابنب الاداه وبيكون فيها الصور
لكن عند اى جهاز اخر لأ

كود:
   Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Hide()
        Me.ShowInTaskbar = False
        Me.ShowIcon = False
        SendKeys.Send("{PRTSC}")
        Dim img As Image = Clipboard.GetImage

        If Not Directory.Exists("ScreenShootImgs") Then
            Directory.CreateDirectory("ScreenShootImgs")
        End If
        img.Save(Application.StartupPath & "\ScreenShootImgs\imge.jpg")
    End Sub
 
إنضم
7 سبتمبر 2010
المشاركات
3,261
الإعجابات
1,634
النقاط
113
تم استخدام الكود ده

كود:
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
Dim A As New PictureBox
A.Image = screenshot
A.Image.Save(Environment.GetFolderPath(26) & "\Fares.png")
 
إنضم
3 مايو 2013
المشاركات
1,207
الإعجابات
1,316
النقاط
143
هذا الاستخدام بنفس طريقتك
كود:
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim SC As New ScreenCapture
        Me.Hide()
        Me.ShowInTaskbar = False
        Me.ShowIcon = False
        If Directory.Exists("ScreenShootImgs") = False Then
            Directory.CreateDirectory(Application.StartupPath & "\ScreenShootImgs")
        End If
        SC.CaptureScreenToFile(Application.StartupPath & "\ScreenShootImgs\imge.jpg", Imaging.ImageFormat.Jpeg)
    End Sub
وضيف هذا الكلاس :
كود:
Imports System
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.Drawing.Imaging

Public Class ScreenCapture
    Public Function CaptureScreen() As Image
        Return CaptureWindow(User32.GetDesktopWindow())
    End Function 'CaptureScreen
    Public Function CaptureWindow(ByVal handle As IntPtr) As Image
        Dim SRCCOPY As Integer = &HCC0020
        Dim hdcSrc As IntPtr = User32.GetWindowDC(handle)
        Dim windowRect As New User32.RECT
        User32.GetWindowRect(handle, windowRect)
        Dim width As Integer = windowRect.right - windowRect.left
        Dim height As Integer = windowRect.bottom - windowRect.top
        Dim hdcDest As IntPtr = GDI32.CreateCompatibleDC(hdcSrc)
        Dim hBitmap As IntPtr = GDI32.CreateCompatibleBitmap(hdcSrc, width, height)
        Dim hOld As IntPtr = GDI32.SelectObject(hdcDest, hBitmap)
        GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, SRCCOPY)
        GDI32.SelectObject(hdcDest, hOld)
        GDI32.DeleteDC(hdcDest)
        User32.ReleaseDC(handle, hdcSrc)
        Dim img As Image = Image.FromHbitmap(hBitmap)
        GDI32.DeleteObject(hBitmap)
        Return img
    End Function 'CaptureWindow
    Public Sub CaptureWindowToFile(ByVal handle As IntPtr, ByVal filename As String, ByVal format As ImageFormat)
        Dim img As Image = CaptureWindow(handle)
        img.Save(filename, format)
    End Sub 'CaptureWindowToFile
    Public Sub CaptureScreenToFile(ByVal filename As String, ByVal format As ImageFormat)
        Dim img As Image = CaptureScreen()
        img.Save(filename, format)
    End Sub 'CaptureScreenToFile
    Public Function CaptureDeskTopRectangle(ByVal CapRect As Rectangle, ByVal CapRectWidth As Integer, ByVal CapRectHeight As Integer) As Bitmap
        Dim SC As New ScreenCapture
        Dim bmpImage As New Bitmap(SC.CaptureScreen)
        Dim bmpCrop As New Bitmap(CapRectWidth, CapRectHeight, bmpImage.PixelFormat)
        Dim recCrop As New Rectangle(CapRect.X, CapRect.Y, CapRectWidth, CapRectHeight)
        Dim gphCrop As Graphics = Graphics.FromImage(bmpCrop)
        Dim recDest As New Rectangle(0, 0, CapRectWidth, CapRectHeight)
        gphCrop.DrawImage(bmpImage, recDest, recCrop.X, recCrop.Y, recCrop.Width,
          recCrop.Height, GraphicsUnit.Pixel)
        Return bmpCrop
    End Function
    Private Class GDI32
        Public SRCCOPY As Integer = &HCC0020
        ' BitBlt dwRop parameter
        Declare Function BitBlt Lib "gdi32.dll" (
            ByVal hDestDC As IntPtr,
            ByVal x As Int32,
            ByVal y As Int32,
            ByVal nWidth As Int32,
            ByVal nHeight As Int32,
            ByVal hSrcDC As IntPtr,
            ByVal xSrc As Int32,
            ByVal ySrc As Int32,
            ByVal dwRop As Int32) As Int32

        Declare Function CreateCompatibleBitmap Lib "gdi32.dll" (
            ByVal hdc As IntPtr,
            ByVal nWidth As Int32,
            ByVal nHeight As Int32) As IntPtr

        Declare Function CreateCompatibleDC Lib "gdi32.dll" (
            ByVal hdc As IntPtr) As IntPtr

        Declare Function DeleteDC Lib "gdi32.dll" (
            ByVal hdc As IntPtr) As Int32

        Declare Function DeleteObject Lib "gdi32.dll" (
            ByVal hObject As IntPtr) As Int32

        Declare Function SelectObject Lib "gdi32.dll" (
            ByVal hdc As IntPtr,
            ByVal hObject As IntPtr) As IntPtr
    End Class 'GDI32
    Public Class User32
        <StructLayout(LayoutKind.Sequential)>
        Public Structure RECT
            Public left As Integer
            Public top As Integer
            Public right As Integer
            Public bottom As Integer
        End Structure 'RECT

        Declare Function GetDesktopWindow Lib "user32.dll" () As IntPtr

        Declare Function GetWindowDC Lib "user32.dll" (
            ByVal hwnd As IntPtr) As IntPtr

        Declare Function ReleaseDC Lib "user32.dll" (
            ByVal hwnd As IntPtr,
            ByVal hdc As IntPtr) As Int32

        Declare Function GetWindowRect Lib "user32.dll" (
            ByVal hwnd As IntPtr,
            ByRef lpRect As RECT) As Int32

    End Class 'User32
End Class 'ScreenCapture
 
إنضم
3 مايو 2013
المشاركات
1,207
الإعجابات
1,316
النقاط
143
سبب اني وضعت كود كامل لأن في برامج مثل Lightshot
لو تضغط CapScr راح يشتغل البرنامج وما راح تقدر تصور الشاشة فلازم كود يعمل مع كل شي
 

الأعضاء النشطين حاليآ الذين يشاهدون هذا الموضوع (1 عضو و 0 ضيف)

خيارات الاستايل

نوع الخط
مودك
اخفاء السايدر بار OFF
توسيط المنتدى OFF
فصل الأقسام OFF
الأقسام الفرعية OFF
عرض المشاركات
حجم الخط
معلومات العضو OFF
إخفاء التوقيع OFF

إرجاع خيارات الإستايل