| |

VerySource

 Forgot password?
 Register
Search
View: 21|Reply: 8

How to implement screenshot function in the web? ?

[Copy link]

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-2-15 14:30:01
| Show all posts |Read mode
How to implement screenshot function in browser? ?
Reply

Use magic Report

0

Threads

301

Posts

108

Credits

Newbie

Rank: 1

Credits
108

 China

Post time: 2020-4-15 18:00:01
| Show all posts
Must use activex control.
Reply

Use magic Report

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-4-16 12:45:01
| Show all posts
Can you make it clearer upstairs? ?
Reply

Use magic Report

0

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-4-19 09:45:01
| Show all posts
jf

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;

namespace windelf
... {
    class Program
    ... {
        static void Main (string [] args)
        ... {
                // Get the current screen resolution
            Screen scr = Screen.PrimaryScreen;
            Rectangle rc = scr.Bounds;
            int iWidth = rc.Width;
            int iHeight = rc.Height;
                // Create a Bitmap as big as the screen
            Image myImage = new Bitmap (iWidth, iHeight);
                // Create Graphics object from an object inherited from Image class
            Graphics g = Graphics.FromImage (myImage);
                // Screen capture and copy to myimage
            g.CopyFromScreen (new Point (0, 0), new Point (0, 0), new Size (iWidth, iHeight));
                // Save as file
            myImage.Save (@ "c: /windelf.jpeg");

        }

    }
}
Reply

Use magic Report

1

Threads

6

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-4-20 16:45:01
| Show all posts
windelf
People want the web, not winform
Reply

Use magic Report

1

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

 Author| Post time: 2020-4-21 14:15:01
| Show all posts
Yes! It's on the web! ! Not in winform! !
Reply

Use magic Report

0

Threads

3

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-4-23 14:00:01
| Show all posts
azraelmoon,0liujians
This kind of demand cannot be achieved by the Web alone. How can the security of the screenshot client be free?
Can only be achieved by ActiveX or embedded WinForm.
Reply

Use magic Report

3

Threads

26

Posts

20

Credits

Newbie

Rank: 1

Credits
20

 China

Post time: 2020-4-23 18:30:02
| Show all posts
Did you ask before that you can only use ActiveX. Because of security issues, the web does not allow this feature (security sandbox), ActiveX can be achieved, so ActiveX security is widely criticized.
The following is the key code of ActiveX written in VC ++, it should be easier to use C #, but the client does not know whether it is necessary to install Framework to run ActiveX.
HBITMAP CCopyScr :: CopyToBmp (CRect Rect)
{
// Screen and memory device description table
HDC hScrDC, hMemDC;

// Bitmap handle
HBITMAP hBitmap, hOldBitmap;

// Coordinates of the selected area
int nX, nY, nX2, nY2;

// Bitmap width and height
int nWidth, nHeight;

        // Screen Resolution
int xScrn, yScrn;

// Make sure the selected area is not empty rectangle
if (IsRectEmpty (&Rect))
return NULL;

// Create a device description table for the screen
hScrDC = CreateDC ("DISPLAY", NULL, NULL, NULL);
The
// Create a compatible memory device description table for the screen device description table
hMemDC = CreateCompatibleDC (hScrDC);
The
// Get the coordinates of the selected area
nX = Rect.left;
nY = Rect.top;
nX2 = Rect.right;
nY2 = Rect.bottom;
The
// get screen resolution
xScrn = GetDeviceCaps (hScrDC, HORZRES);
yScrn = GetDeviceCaps (hScrDC, VERTRES);
The
// Make sure the selected area is visible
if (nX <0)
nX = 0;
if (nY <0)
nY = 0;
if (nX2> xScrn)
nX2 = xScrn;
if (nY2> yScrn)
nY2 = yScrn;
nWidth = nX2-nX;
nHeight = nY2-nY;
The
// Create a bitmap compatible with the screen device description table
hBitmap = CreateCompatibleBitmap (hScrDC, nWidth, nHeight);
The
// Select the new bitmap to the memory device description table
hOldBitmap = (HBITMAP) SelectObject (hMemDC, hBitmap);
The
// Copy the screen device description table to the memory device description table
BitBlt (hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
The
// Get the handle of the screen bitmap
hBitmap = (HBITMAP) SelectObject (hMemDC, hOldBitmap);
The
// Clear
DeleteDC (hScrDC);
DeleteDC (hMemDC);
The
// return the bitmap handle
return hBitmap;
}
Reply

Use magic Report

0

Threads

10

Posts

6

Credits

Newbie

Rank: 1

Credits
6

 China

Post time: 2020-6-3 18:30:01
| Show all posts
What does the screen shot of the landlord mean? The article in the connection I sent is about how to grab a page of a website in the asp.net program to generate a picture. If the landlord wants to grab the screen of the client, then you can only use the activeX control, or embed winform in the web page. Controls, but that needs to adjust the client security settings, otherwise there is no permission.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list