Since your program doesn't have the focus when you want to save the screen. You might want to look into using the RegisterHotKey function to register a hotkey to be used to save the screen. You could then use the code posted by Hack above in the callback function to save the image.
What makes you so sure I dont have focus? Like i said, i have already hooked the keyboard for use of it ingame, so i can just press a button and it saves a screen.
so yes i do have focus. i will try the code now, thanks
You could put the image inside a memory dc and use DrawText and then store it or simply put it in a hidden PictureBox and use the Print statement and then save the image (the PicBox need to have the AutoRedraw property set). To save as a JPG you need some third party control. I think I have a simple BMP2JPG dll somewhere, I'll see if I can dig it out for you.
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Well if you wanted to use my code, you must have some knowledge of DirectX. Otherwise I'm not sure how it'll work with a stand alone app to be honest with ya.
And I just found out that I need to know the correct color format to get that code working. Already posted this problem in www.gamedev.net. It'll be solved shortly, I hope.
The format D3DFMT_A8R8G8B8 works very well with bmp files. Jpg it's something else.
I was just pointing out another method, which DirectX has. They both should do the same thing. The only advantage is the fact that it supports multiple formats that gets converted for you by DirectX.
If user captures the wrong Active Window, or just wants to re-capture that window (content changed), or capture another active Window, the 'focus' is still on that option. That prevents a re-click.
I have added an option 4 to the control array. Placed it at the bottom/center of Frame1. Set it's style to Graphical, and made it's Caption 'Clear'
The large button 'Clear Picture Box' can be removed, as this smaller Clear button does the same thing, and also frees up the options. Thus any of them can be re-clicked after the new Clear is used.
Can anyone add the ability to Save the image as jpg ?
(That would make me a very happy 'mother' this Mother's Day)
Last edited by RobCrombie; Apr 27th, 2005 at 10:09 PM.
Why? Someone else may want to add something else in the future.
I had an old version, before your update. Now it's better than before and it also does jpeg. That's what the forum is all about.
I have added many enhancements to the Saving area.
You can still use the Dialog.
However it remembers where you put it (in txtFolder), and what you called it (in txtFile).
You can then quickly Save subsequent captures, into the same folder.
I have also added a button to allow you to just save into the app.path
When the Form closes it Saves the Folder and File names used, and restores them (in those textboxes), when the pgm next runs.
I believe that a capture pgm has to be quick and easy to use, when you really need it. At those times, you don't want to be stuffing around browsing and naming all your images.
Thus there is also a 'lazy' feature that allows you to just tell it to save the flippin image, and not bother you with minor details, like having to tell it where to put it, or what to call it.
If no folder has been specified, it uses app.path
If no file has been specifed, it uses yyyymmdd.jpg
AH! you might say 'What happens if I am lazy twice ?'
That is, when you use the same file name (or no file name, and it uses the yyyymmdd again)
There is an auto increment feature that adds an incrementing number, whenever it detects a clash.
Thus if you were super lazy (like me), it would create in app.path -
20050428.jpg
20050428_001.jpg
20050428_002.jpg
If you have specified a File name in txtFile, then it does the same, but uses that File name.
It could have more commenting, than it has. So I figure you'll make some small deductions from your PayPal transfers (to punish me).
I am attaching the DLL separately, as some of you may have downloaded that already.
There may be some bugs (it is 4:00 AM in OZ). (More PayPal deductions ?)
The click to hide and click to show, was ok, except you had to hide some Apps to see our Form.
I have enhanced the attached, to hopefully fix that inconvenience
Let me know if it is still hard to find(see), when un-hiding 'our' Form.
When you are singing about 'us' around the camp fire, the 'our'' refers to Martin, David and Rob.
PS Don't forget to download David's DLL, which I attached separately above Bmp2Jpeg.zip
Last edited by RobCrombie; Apr 30th, 2005 at 12:14 AM.
Hi,
I have a couple of improvements I'm working on.
Also I think the middle two options are not much use, or am I missing something ?
An nice additional option, would be the ability to use mouse to define an area of the screen to capture.
Anyone got a sample that I could slot into this project ?
An nice additional option, would be the ability to use mouse to define an area of the screen to capture.
Anyone got a sample that I could slot into this project ?
I did something like that a few years back. What I basically did was to take a snapshot of the entire screen and put it on a non-border topmost fullscreen Form which the user could select an area from.
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.