...

View Full Version : Screen Capture



mex
11-15-2004, 09:09 AM
Below is a script which captures the screen and sends it to the C:\1.bmp. As i'm not a VB programmer, i would like to get help from u. that is, to add some few functions to it!
1. Not to over-write the file but to add automcatically like 001,002..
2. To enable the user to select the location using brose and not to send the file to C:\1.bmp automatically.
3. To have a shortcut key like Ctrl+Alt+P though this is not really important.

thanx for any help

---------------------
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Function fSaveGuiToFile(ByVal theFile As String) As Boolean

Dim lString As String
On Error GoTo Trap

If Dir(theFile) <> "" Then Exit Function

Call keybd_event(vbKeySnapshot, 1, 0, 0)


SavePicture Clipboard.GetData(vbCFBitmap), theFile
fSaveGuiToFile = True
Exit Function
Trap:

MsgBox "Error Occured in fSaveGuiToFile. Error #: " & Err.Number & ", " & Err.Description
End Function


Private Sub Command1_Click()
fSaveGuiToFile ("C:\1.bmp")
End Sub

shmoove
11-15-2004, 11:10 AM
2. http://www.garybeene.com/vb/tut-dlg.htm http://freespace.virgin.net/s.cowan/vbhowto/how_to/vb_controls/common_dialog.html

Use the filename you get from the common dialog and save to that instead and that also takes care of 1. and 3.

shmoove

mex
11-15-2004, 02:04 PM
i may not a VB expert but i sure knows what i'm asking!!! or did u misunderstood!! i dont need those 2 sites. they r of no use to the script i posted! do u went through my code!

shmoove
11-15-2004, 02:31 PM
2. To enable the user to select the location using brose

Using a Common Dialog control you get exactly that: a nice dialog that looks exactly like the ones used in every other Windows application, that let's the user choose a location and a filename.
So you would first open the dialog with it's ShowSave method, and then use it's Filename property as the parameter passed to your fSaveGuiToFile function:


Private Sub Command1_Click()
MyCommonDialog.ShowSave
fSaveGuiToFile (MyCommonDialog.Filename)
End Sub

Since the user is choosing a file of his liking you don't need to make up those automatic filenames (point 1).
About point 3 I was wrong when I sayed it solved it, but for that you would need to use the Form's KeyUp event (or KeyDown) which has an extra argument to allow for special keys like Ctrl and Alt ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/vbevtKeyPress.asp ).

shmoove

shmoove

mex
11-15-2004, 05:00 PM
what exactly the code does is send to the location without having to open the dialog. i mean to choose the location from an option before u press the capture button! so that while pressing it, it will send to the location specified without having to go through that process of opening the dialog and saving it which takes time but to send directly (hidden) to the location which was soecified before, through the options.... thanx

shmoove
11-15-2004, 05:39 PM
Then put a textbox and another button, open the dialog from the new button, and save the filename in the textbox (making it uneditable so it can only change with the dialog might be a good idea). Then get the value for the filename from there when the screen capture button is pressed.

mex
11-17-2004, 07:32 AM
this is strange.... thats what exactly i have been asking and now i got the reply which is suppose to be my QUESTION!..

can u get me the script for that. thanx anyway.

shmoove
11-17-2004, 09:46 AM
I didn't understand that last post.

shmoove

mex
11-18-2004, 08:02 AM
well... atleast u understand the question now... which is your solution:


Then put a textbox and another button, open the dialog from the new button, and save the filename in the textbox (making it uneditable so it can only change with the dialog might be a good idea). Then get the value for the filename from there when the screen capture button is pressed.

shmoove
11-18-2004, 02:21 PM
You're saying you don't know how to put the button on a form?

shmoove

sage45
11-18-2004, 04:07 PM
mex,

You are looking for someone to give you a script/form that solves all of your problems.

In schmooves defense, he did at least answer some of your questions by pointing you in the direction of a resource that you can use by reading and expirementing with it in oder to find the best results for your purpose.

Here at coding forums we try to keep an atmosphere of learning whereas people are given resources that can be used to learn new things. The way I look at it, with the right amount of effort, you could take the resources provided and have this program of yours do everything you wish. On the other hand, if you would like to continue getting snippy with people for not directly giving the answers then I am sure someone can program this for you for the right price.

-sage-

mex
11-19-2004, 11:20 AM
i should have gone to google.com instead... lol! i'm willing to pay if anyone could help me out with this.

tboss132
11-19-2004, 11:56 AM
Mex, If you're willing to pay, let's talk. Send me a PM.

sage45
11-19-2004, 04:38 PM
i should have gone to google.com instead... lol! i'm willing to pay if anyone could help me out with this.

lol!!!

mex
11-20-2004, 10:05 AM
hey but what does this mean:


I was hired to keep off intruders ... they never knew i was the intruder
:rolleyes:

JamieR
11-20-2004, 12:21 PM
it's just his signature.....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum