Home > Net >  VB.net Graphics drawn in the image on the screen, how to use Graphics again. Fromscreen screenshot
VB.net Graphics drawn in the image on the screen, how to use Graphics again. Fromscreen screenshot

Time:10-04

As title, because when I was in the screenshot will not go in this screenshot, what method? If there are more advanced methods indicate that don't plugin DLL and third-party libraries, and is directly draw a picture on the screen (centered, and the picture is cut the photo), and then in the screenshot again out of the picture and the original desktop, all its window also cut together (is) of the human eye to see, because I used in the title on the above method, draw speed too slow, and often crash, please expert help,
Best post code,

CodePudding user response:

refer to the original poster QEVM response:
such as topic, because when I was in the screenshot will not go in this screenshot, what method? If there are more advanced methods indicate that don't plugin DLL and third-party libraries, and is directly draw a picture on the screen (centered, and the picture is cut the photo), and then in the screenshot again out of the picture and the original desktop, all its window also cut together (is) of the human eye to see, because I used in the title on the above method, draw speed too slow, and often crash, please expert help,
Best post code,

If USES the same method, and the topic will only repeatedly cut without the image of the desktop, the end result is a desktop

CodePudding user response:

I also want to know
Graphics drawn in the image on the screen, the hair can look down under

CodePudding user response:

refer to the second floor of orange peel ZZZ reply:
I also want to know
Graphics drawn in the image on the screen, the hair can look down under?

Sorry, I also want to, but I think should be the problem of the handle

CodePudding user response:

I don't know way not
Dim SLP As Double=1000 'decision to sleep time,
Dim temp1 As Screen=My.Com puter. Screen
Dim As a New Bitmap (temp1. WorkingArea. Size, Width, temp1. WorkingArea. The Size, Height)
Dim aaa As Graphics=Graphics. FromHdc (GetWindowDC (GetDesktopWindow ()))
Dim aaab As Graphics=Graphics. FromImage (a)
Dim sa As New Point (0, 0)
Do
Try
SLP -=0.5
If SLP & lt;=0 Then
SLP=1
End the If
Aaab. FastCopySreen ()
Atul gawande at the Dim Hicon As IntPtr=etHicon ()
Aaa. DrawIcon (Icon. FromHandle (Hicon), the New Rectangle With {
. Width=temp1. WorkingArea. Width * 0.9,
. Height=temp1. WorkingArea. Height * 0.9,
X=temp1. WorkingArea. Width * 0.05,
. Y=temp1. WorkingArea. Height * 0.05
})
Threading. Thread.sleep (SLP)
Aaab. The Dispose ()
A. d. ispose ()
A=New Bitmap (temp1. WorkingArea. The Size, Width, temp1. WorkingArea. The Size, Height)
Aaab=Graphics. FromImage (a)
Catch
Aaa. The Dispose ()
Aaab. The Dispose ()
A. d. ispose ()
Threading. Thread.sleep (10000)
GoTo To2DWorld
End the Try
Loop

CodePudding user response:

What the hell is FastCopySreen

CodePudding user response:

A.net DLL (win32) call in a very strange question

DLL is written in Delphi7.0 a COM component, use VB.NET call is a heap of damage is unusual, but can return the correct results,
The code below
Procedure TMyComObj. GetText (Dir, FileNameCol: PWideChar);
Var s: a string;
Ss: Widestring;
I, Len: integer;
P: ^ Widestring;
The begin
S:=XXXXX (Dir);//XXXXX is a function return a string
Ss:=s;
Len:=length (ss);
P:=Pointer (FileNameCol);
For I:=1 to Len do
The begin
P=ss ^ : [I];
Inc (p)
end;
end;
At VB.NET to FileNameCol pre-allocated space one million
Did the following processing
FileNameCol="aa"
For I=1 to 19
FileNameCol=FileNameCol & amp; FileNameCol
Next

Call this MyComObj in VB. The GetText method is a heap "damage" is unusual, but FileNameCol retrieve the value is correct,

But make the following improvement in the COM component will not appear this exception
First in this interface implementation class defined in a Private Ps: ^ Widestring;
Then join in the interface of the following two methods
ALLocaMemory (Len: LongWord)
FreeMeMory (Len: LongWord)
The implementation code below
Procedure TMyComObj. ALLocaMemory (Len: LongWord);
The begin
Ps:=ALLocMem (2 * Len)
end;

Procedure TMyComObj. FreeMemory (Len: LongWord);
The begin
FreeMem (Ps, 2 * Len)
end;

The GetText (Dir, FileNameCol: PWideChar) method for the following changes:

Procedure TMyComObj. GetText (Dir, FileNameCol: PWideChar);
Var s: a string;
Ss: Widestring;
I, Len: integer;
P, pa, pb: ^ Widestring;
The begin
S:=XXXXX (Dir);//XXXXX is a function return a string
Ss:=s;
Len:=length (ss);
P:=Pointer (FileNameCol);
Pa:=Pointer (Ps);
Pb:=pa;
//the code below is the to ss by character writes Ps block of memory (for Ps allocates memory through ALLocaMemory)
For I:=1 to Len do
The begin
Pa ^ :=ss [I];
Inc (pa)
end;
//the code below is pointed to Ps the memory block of content copied to FileNameCol
For I:=1 to Len do
The begin
P=pb ^ ^ :;
Inc (pb);
Inc (pb);
end;
end;

On the VB.NET call ALLocaMemory first and then calls the GetText, finally call FreeMemory,
Can correct string, and does not appear abnormal,
I a mystery on this question, so consult ace answer






CodePudding user response:

  • Related