BASIC/Visual Basic >> Screenshots...in...Vb
Posted by kpyro on 03:12:00 04-25-2002
Does anyone know how to take a screenshot in VB, I know how to do: sendkeys {prntscr}, but I don't know how to get into a picture box, or image! Can you help?

When it says "do not reply to this post", it's just my signature, so please, reply!

Do Not Reply To This Post

[ This Message was edited by: kpyro on 2002-04-25 09:19 ]
Posted by sacah on 17:49:00 04-25-2002
Um, search google, I have emailed you some code, but google is riddled with examples of how to do this.
Posted by dxprog on 07:07:00 04-26-2002
If you want answers check your MSDN Library CD. I found the answer to his problem there. For anyone else who needs it:

' Check to see if data on clipboard is bmp format
If Clipboard(2) = True Then
object = Clipboard.GetData
End If

The object can be a form or a picture box.
Posted by kpyro on 08:10:00 04-26-2002
Ok, now I got it to take screenshots. Thanx to sacah! He is a well of knowledge. Drink from his mind and you will gain much information... [addsig]
Posted by dxprog on 10:07:00 04-26-2002
DARN. I KNEW I WAS TOO LATE.
Posted by sacah on 18:15:00 04-26-2002
lol
dxprog that is how you get info from the Clipboard, kpyro want to take a screenshot and put it into a picture box, your way would only work if he pushed Prt Scr first.

Kpyro I think you should remove your sig, its a marquee with Do Not Reply To This Post
(-:
Posted by kpyro on 23:13:00 04-26-2002
Ok...fine I will change my signature to what I usually have it. Anyone here do alot of networking in VB? [addsig]
Posted by dxprog on 23:13:00 04-26-2002
Well he talked about using print screen so I figured it was simply pasting that image into the picturebox. Hey, I still learned somthing new.
Posted by kpyro on 23:14:00 04-26-2002
Dxprog just posted something simultaneous with me! Wow, that is a first! [addsig]
Posted by dxprog on 23:14:00 04-26-2002
Nope. Never done networking in VB. [addsig]
Posted by kpyro on 23:16:00 04-26-2002
Quote:
On 2002-04-26 10:07, dxprog wrote:
DARN. I KNEW I WAS TOO LATE.


It's ok. Your bit of information will help too.

Sacah: Ok, you can take a screenshot and then paste into a picture box, but after you wanna take another one, it like makes the picture box all wierd...what do I do? [addsig]
Posted by kpyro on 23:17:00 04-26-2002
Where do you live dx? [addsig]
Posted by dxprog on 23:23:00 04-26-2002
US [addsig]
Posted by kpyro on 02:39:00 04-27-2002
Sacah, are you gonna answer me? [addsig]
Posted by kpyro on 02:50:00 04-27-2002
What I essentially trying to do is get it to take a screenshot every so often, kinda to monitor my computer... This is really important, so would you please respond asap? [addsig]
Posted by dxprog on 05:26:00 04-27-2002
Run the sendkey command through a loop or timer and just clear the picturebox before pasting the image.
Posted by sacah on 15:18:00 04-27-2002
Ok, Im in australia, the time your up, Im probly in bed when u are on here, Im not goin to get up just to answer your question, especially when you could find the answer on the net, use www.google.com, I have not got VB installed to test it, I will be on the net again tomorow, I might have an answer then If I have instaled VB tonight.

Ok?
(-:
Posted by kpyro on 04:53:00 04-28-2002
Reeeowww! Geez, calm down little kitty...I was just asking a question! [addsig]
Posted by sacah on 12:52:00 04-28-2002
kpyro: if you were talkin to me about calmin down, I just want to let you know I was never worked up, Im always calm, sorry for that misunderstanding, I installed VB, and I dont have that problem, mabye you have insufficent Ram/Vid mem to handel it, or its not flushin properly, apart from seein your code, I dont know how else to help you.

I got this sudden urge to hunt this bird sittin by my window...
(-:

[ This Message was edited by: sacah on 2002-04-28 12:54 ]
Posted by kpyro on 09:45:00 04-30-2002
Sorry...I thought I had logged in...hmmm I dunno I guess I just forgot to. Anyways, look at the file ya sent me and see what you think. [addsig]
Posted by dxprog on 11:01:00 04-30-2002
Try doing the Picture1.Cls method to clear the picture box before putting in the new image.
Posted by sacah on 17:58:00 04-30-2002
I did try the code I sent you, it worked perfectly.
Posted by dxprog on 21:53:00 04-30-2002
Maybe it's your vid card. [addsig]
Posted by kpyro on 23:04:00 04-30-2002
Well it doesn't work on any of the 8 computers I have tried it on... Thanx for the help anyway. [addsig]
Posted by sacah on 17:07:00 05-01-2002
what was the mem size on those 8 computers, both RAM, and Vid Ram?
Posted by dxprog on 22:44:00 05-01-2002
Yeah. A computer with low mem or vid mem would garble an image like that. If you could give me the code I could test that on my computer and see what happens there.
Posted by kpyro on 07:37:00 05-02-2002
dxprog: All that I want to do is take a picture of the desktop and put it into an imagebox. It doesn't matter how I do it, I just need it to be done.

sacah: I don't think that out of 8 computers, all new this year, that video memory has alot to do with it. They all play high-powered games very well. [addsig]
Posted by dxprog on 10:38:00 05-02-2002
There is a way to get an image of the desktop by using an API call called GetDesktopWindow or something like that. Then you use the GetDC API call using the handle from the other one and BitBlt it to the picturebox.
Posted by kpyro on 02:42:00 05-03-2002
Do you have the exact code for that? [addsig]
Posted by dxprog on 03:17:00 05-03-2002
Yeah I have the code. I'll have to dig it up for you. [addsig]
Posted by kpyro on 08:14:00 05-03-2002
Yay! [addsig]
Posted by sacah on 21:38:00 05-03-2002
I beleive thats the same code I sent you.

Hope it works for you though.
Posted by dxprog on 22:19:00 05-03-2002
Okay. I take that back. I'll have to recode it. I must have got deleted in one of my repartition\format frenzies. I'll have it for you by tonight US time.

[ This Message was edited by: dxprog on 2002-05-03 22:19 ]
Posted by kpyro on 23:07:00 05-03-2002
sacah: The code that you sent me in the e-mail, not the zip, did not work. It said that there was some function that wasn't declared or something like that. [addsig]
Posted by sacah on 00:09:00 05-04-2002
The code in the email was just the API to use wasnt it?

The code in the zip uses the same function ole mate is talkin about.
Posted by kpyro on 03:05:00 05-04-2002
This is the code:

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
Const SRCCOPY = &HCC0020

Dim tmpDC, Dummy As Long

Picture1.Width = Screen.Width
Picture1.Height = Screen.Height

tmpDC = GetDC(0) ''''''
Dummy = BitBlt(Picture1.hDC, 0, 0, Screen.Width, Screen.Height, tmpDC, 0, 0, SRCCOPY)


''''' This is the function GetDc(0) that doesn't exist! [addsig]
Posted by dxprog on 07:12:00 05-04-2002
The GetDC function geos like this:
Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Declare Function GetDesktopWindow Lib "user32" () As Long
You can get the DC of the desktop by using the value returned from the GetDesktopWindow API. BitBlt that into a picturebox and you're set.
Posted by sacah on 17:35:00 05-04-2002
lol, lookin at my code, yes declarin a GetDC function would have helped, but like i said i did not have VB installed.
Posted by godspeed on 02:48:00 05-07-2002
I have tested this code on three (3) computers: Intel Pentium II, Intel Pentium III, and an Intel Celeron 800 mhz. It should work on your computer:

Put this in the declarations:

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function CreateDCAsNull Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) 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
Private Const SRCCOPY = &HCC0020
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Public Sub CopyDesktop(ByRef objTo As Object)
Dim hWnd As Long
Dim tR As RECT
Dim hDC As Long

hWnd = GetDesktopWindow()
GetWindowRect hWnd, tR

objTo.Width = (tR.Right - tR.Left) * Screen.TwipsPerPixelX
objTo.Height = (tR.Bottom - tR.Top) * Screen.TwipsPerPixelY

hDC = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)

BitBlt objTo.hDC, 0, 0, (tR.Right - tR.Left), (tR.Bottom - tR.Top), hDC, 0, 0, SRCCOPY

DeleteDC hDC

End Sub

'Put this in a command button:

Picture1.Cls
CopyDesktop Picture1
Picture1.Refresh

'Picture can be substituted with any object with autodraw, hDC, Picture, height, and width.

If this does not work, I will write something else.
Posted by dxprog on 03:00:00 05-07-2002
Didn't work for me. I ran it on a PIII. What windows version did you test it on?
Posted by godspeed on 03:08:00 05-07-2002
Microsoft Windows 98 Second Edition, Windows Millennium Edition, and Windows XP Professional.
Posted by kpyro on 03:09:00 05-07-2002
Yay! It worked for me! Thanx. [addsig]
Posted by dxprog on 03:24:00 05-07-2002
I have 98SE and it came up blank. Oh well as long as it worked for kpyro [addsig]
Posted by godspeed on 07:39:00 05-07-2002
Did you make sure to put the top code in the form declarations, not in a module?
Posted by dxprog on 10:48:00 05-07-2002
Yep. I never ever use modules. If I need something in a module I make a DLL.
Posted by sacah on 20:58:00 05-07-2002
I dont use moduel or dll, I cant spell either
(-:
see the problem, they were runnin Intel
(-:
Posted by kpyro on 02:19:00 05-08-2002
Why don't you use modules? And how do you make dlls??? [addsig]
Posted by dxprog on 02:38:00 05-08-2002
You make DLLs by compiling and ActiveX dll. The DirectDraw Dll I posted I made with VB. [addsig]
Posted by kpyro on 03:06:00 05-11-2002
Why does everybody always dis on vb?! It gets me so ticked off! [addsig]
Posted by dxprog on 06:14:00 05-11-2002
Don't know. Bugs the crud out of me too.
Posted by sacah on 16:50:00 05-11-2002
Because if you just load up VB and play for a few minutes, it comes accross as a very basic language, its not untill you read further and learn, that it opens up and it very powerful, but most ppl just hear someone else sayin VB lollipops, and they consider that person 'cool' so they say VB lollipops too, same with the Windows vs Linux.
No dont flame about Windows/Linux, I was usin that as an example.
Posted by MoX on 21:45:00 05-14-2002
sacah is right as always. I really never programmed in VB but only heard that it was bad and stuff. And because I know BASIC from a time long ago I believe what I heard.

Linux is, well, a totally different story [addsig]
Posted by kpyro on 02:11:00 05-16-2002
Mox, you are a dumb @%^. You just showed how stupid and gullable you are. Here's something for you: have you ever seen a million dollars in real life and held it? Probably not, but you still believe it right? We all say that VB doesn't lollipop, so I guess you just need proof. Well, I will make you a program that will open up your registry, change your desktop to some porn pic and then change your startup page to something like...www.hotpics.com. Then I will open your cd-drive and put in the registry for the program to start every time your computer is logged into. It will then give you the "blue screen of death" and then it will shutdown your computer. All this will be stored in a macro so it will auto run from your e-mail...But of course that isn't possible in your case because you use Linux. [addsig]
Posted by kpyro on 02:13:00 05-16-2002
while(BASIC!=VBASIC)
{
cout [addsig]
Posted by kpyro on 02:28:00 05-16-2002
[addsig]
Posted by AntiHalcyon on 08:18:00 05-16-2002
private sub command1_click()

MsgBox "Visual Basic lollipops", vbcritical, "C++ is better"

End Sub [addsig]
Posted by dxprog on 12:36:00 05-16-2002
AntiHalcyon: Just a question. Why did you choose that screen name? ust wondering because there is a Star Wars character with that last name. The Halcyon part anyways. I was just wondering if that's why you chose it.
Posted by sacah on 17:00:00 05-16-2002
I saw Episode II at 1 minute past midnight this morning, and it rocked.
Posted by MoX on 17:03:00 05-16-2002
Hope so. But after Episode I it could only get better. [addsig]
Posted by dxprog on 20:07:00 05-16-2002
Hopefully we'll (my bros and I) be seeing it this weekend. I CAN'T WAIT!!!!
Posted by kpyro on 23:14:00 05-16-2002
Star Wars lollipops. [addsig]
Posted by fsvara on 00:19:00 05-17-2002
episode 1 really lollipoped. the whole plot was kinda pointless. but the older episodes are cool imo
Posted by MoX on 02:03:00 05-17-2002
The old ones are nice. And I think Episode One had potential, it's just that they did not use it.

Who does not remember this awful scene where Anakin's mother sais that there was no father...I did not know if I should cry or laugh when I saw it...

And this strange story with these small beings insde the Jedis. Nobody ever wanted to know where the Jedi powers came from. Explaining such things is only needed in StarTrek... [addsig]
Posted by kpyro on 02:51:00 05-17-2002
Star Wars lollipops.







We are getting a bit of subject... [addsig]
Posted by fsvara on 04:01:00 05-17-2002
Quote:
And this strange story with these small beings insde the Jedis. Nobody ever wanted to know where the Jedi powers came from. Explaining such things is only needed in StarTrek...


yeah. it also makes their powers appear more natural, and not as "divine" as they were before... you could think everybody could get a mediclorian (or what they were called..) injection and get "the force"...
Posted by dxprog on 04:32:00 05-17-2002
Episode 1 did lack plot quite a bit. THough that was one heck of a lightsaber fight in the end. My fav so far is Empire Strikes Back. My dad was saying that some people were saying that Episode 2 is better than the old movies (I'll believe it when I see it). [addsig]
Posted by MoX on 05:08:00 05-17-2002
Empire Strikes Back is the best one. It was the moment that Lucas decided to make a trilogy. I don't think he planned it from the start...(no need to argue, 'cause nobody can proove it).

The second one of the original serious was the most gripping one with the coolest mechs and the darkest ending.

To Episode I: I think it's a pity that Lucas did not build up Darth Maul as the villain of the three new Episodes, like Darth Vader is in the original. He had some potential, a nice bad guy if you ask me. [addsig]
Posted by fsvara on 05:55:00 05-17-2002
i think he looked a bit too.. flashy for being really bad. i really like how vader looks.. just cool all this make-up on darth maul and the princess in episode 1 looks stupid imho.. it doesn't add to the "starwars" atmosphere... quite the contrary imo.
Posted by dxprog on 09:30:00 05-17-2002
One of the biggest probs about Episode I was all the media hype. For all that stuff about Maul and he had a whole fifteen literal minutes of fame. Episode III is going to be one depressing movie I bet. The rise of the Empire, Anakin goes bad, and all the Jedi excluding Yoda and Obi get killed. I CAN'T WAIT!!!!
Posted by sacah on 14:37:00 05-17-2002
Remeber theres Episode III where lots can go bad, not giving away any hints, but I think II is best yet.
Posted by MoX on 21:01:00 05-17-2002
Best ever or best of the new series? [addsig]
Posted by dxprog on 22:42:00 05-17-2002
Just DON'T give anything off. I'm dying enough as it is because everyone says the ending is a real shocker. It's like the suspense of Christmas except with a movie. [addsig]
Posted by sacah on 18:03:00 05-18-2002
I reckon its best ever.
Posted by fsvara on 19:07:00 05-18-2002
here's a funny article from slashdot... on /. people are somewhat unsure if it is a joke or not, read the discussion there, it's fun
the article:
http://www.weeklystandard.com/Content/Public/Articles/000/000/001/248ipzbt.asp
and the /. discussion:
http://slashdot.org/article.pl?sid=02/05/17/1019250&mode=flat&tid=101
Posted by Peter on 00:01:00 05-19-2002
svara: OMG, what an article, and OMG what a discussion... my eyes hurt.

dxprog: um, actually, Obi-Wan is killed in Episode IV, not III.
Posted by fsvara on 03:04:00 05-19-2002
peter: how do you mean that?

btw, i'm (probably) going to watch episode 2 tomorrow...
Posted by dxprog on 03:51:00 05-19-2002
We may be seeing on Wednesday. Everyone here goes to church Wednesday night so NO LINES.

Peter: I didn't say Obi was killed in III. I said everyone but him and Yoda were killed. Even after IV though he was kind of alive apearing to Luke all those times. [addsig]
Posted by fsvara on 18:07:00 05-19-2002
dxprog - do you live in the "bible belt"?
the stuff you posted lately makes me think that
Posted by Peter on 20:25:00 05-19-2002
dxprog: oh, misread that..

svara: the article was pretty interesting/funny and the comments were extensive, to put it mildly..
Posted by dxprog on 00:21:00 05-20-2002
Yeah, I live in the Bible belt. Annoying except for the fact that Wednesdays are easy going. [addsig]
Posted by Peter on 00:28:00 05-20-2002
What is really the Bible Belt? Don't make me google.. I'm busy coding php. I'm sure someone can sum it up .
Posted by fsvara on 03:11:00 05-20-2002
a part of the US full of fundamentalist christians who, among other things, want to kill all homosexuals, stop darwin's evolution theory from being taught at schools, etc.
Posted by MoX on 20:30:00 05-20-2002
How progressive...

Hope this "Bible Belt" is not too big... [addsig]
Posted by dxprog on 02:33:00 05-21-2002
The bible belt goes across the nation. I live in the "buckle" of it. [addsig]
Posted by MoX on 03:14:00 05-21-2002
Nice! Wonder when they'll bring up the inquisition again

(And the withhunts and all the other fun stuff) [addsig]
Posted by kpyro on 08:06:00 05-21-2002
I used to live there...it's sad.
Posted by MoX on 15:03:00 05-21-2002
That does not really surprise me... [addsig]
Posted by dxprog on 22:44:00 05-21-2002
Could be worse. Could be communist Russia. [addsig]
Posted by fsvara on 02:03:00 05-22-2002
yeah, scandisk the damn commies
Posted by MoX on 15:05:00 05-22-2002
I'd rather live in a moderate religious part of russia than in an ultra-religious part of the US... [addsig]
Posted by kpyro on 02:40:00 05-23-2002
...this is a dull conversation.
Posted by MoX on 04:21:00 05-23-2002
It really is...so why are you contributing to it? [addsig]
Posted by dxprog on 08:38:00 05-23-2002
We could talk about Star Wars again. [addsig]
Posted by kpyro on 09:22:00 05-23-2002

Is there a way to update the code in a program without having to redistribute a new exe?

Posted by dxprog on 09:52:00 05-23-2002
Yeah. Clickteam has somthing called Patch Maker that does something like that. You would probobly have to buy some expensive software otherwise. [addsig]
Posted by sacah on 16:51:00 05-23-2002
Yes, releasing a patch would be better than releasing a new exe, you can use one of many Patch maker programs on the net, or make your own in Delphi/ASM etc.
Posted by dxprog on 22:43:00 05-23-2002
Good luck on that last one. [addsig]
Posted by kpyro on 02:40:00 05-24-2002
Are those clickteam tools free?
Posted by dxprog on 06:59:00 05-24-2002
Yep. I have the install maker thing they make and it's not too bad. [addsig]
Posted by kpyro on 07:54:00 05-24-2002
Is the installer better than Wise for Windows Installer? [addsig]
Posted by dxprog on 08:47:00 05-24-2002
Don't know. But I'm sure it's cheaper. [addsig]
Posted by kpyro on 09:08:00 05-24-2002
To anyone who knows how:

URGENT!WARNING!CAUTION: Does anyone know how to contain all .ocx's and .dlls and such into a single .exe ? [addsig]
Posted by sacah on 20:09:00 05-24-2002
Make the program with Delphi, or C++, or use a packer.

Or you could be tricky and write your own packer/unpacker in ASM/Delphi
(-:
Posted by dxprog on 22:51:00 05-24-2002
Watch out kpyro. sacah is trying to get your down and make you learn asemmbly. [addsig]
Posted by sacah on 11:19:00 05-25-2002
Or Delphi
(-;
Posted by dxprog on 19:34:00 05-25-2002
EEeeeewwww... [addsig]
Posted by kpyro on 23:19:00 05-29-2002
I think I am going to use that program dx gave me.
Posted by dxprog on 03:21:00 05-30-2002
What program? [addsig]
Posted by kpyro on 07:14:00 05-30-2002
Ooops...I meant link. [addsig]
Posted by dxprog on 09:22:00 05-30-2002
Oh, you mean install maker? [addsig]
Posted by kpyro on 02:59:00 05-31-2002
Yeah and the uhh... patchmaker. [addsig]
Posted by dxprog on 06:44:00 05-31-2002
Oh yeah. Forgot about that one. [addsig]
Posted by kpyro on 09:36:00 06-11-2002