Solved

saving the screen captured

Posted on 2002-04-26
11
168 Views
Last Modified: 2013-11-26
Hi,
I have a function which captures the screen . now my problem is i need to store it in the database. i have aalready created the database. now how do i convert the picture(that i have captured) in to a bitmap and store it in the database. will the SavePicture method help.
Thanks
0
Comment
Question by:RanjiniPraba
11 Comments
 
LVL 4

Expert Comment

by:gencross
ID: 6971055
Here is a sample application at PSC that will do what you want I believe.  Paste this url in the browser.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=21861&lngWId=1

Hope this helps.
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 50 total points
ID: 6971135
SavePicture will help but for save to file in disk.
You could try this excellent code which manages pictures in memory and you could save them in bynary field in db.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6971144
Ups, link forgotten:
http://www.domaindlx.com/e_morcillo/scripts/showtip.asp?tip=pcarr
(sometimes the site is down but keep trying and you will not be dissapointed ;)
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6971949
Yes, you can save the picture in the picturebox out using the SavePicture function, and then you can add it into a database using the ADO stream object.  Assuming that you have ADO checked in the Project|References you can use this code (originally posed by Anthony - aperkins)

Sub AddImage(rs As ADODB.Recordset, ByVal FileName As String)
Dim stm As ADODB.Stream

Set stm = New ADODB.Stream
With stm
 .Type = adTypeBinary
 .Open
 .LoadFromFile FileName
 
 'Add a new record
 rs.AddNew
 'Stream the value into the field through the stream object
 rs.Fields("ImageColumn").Value = .Read
 'Update the recordset
 rs.Update
 .Close
End With
Set stm = Nothing

End Sub

You could call this function as follows:

Dim rs As ADODB.Recordset

Set rs = New ADODB.Recordset
With rs
  .Source = "Select * From Table1"
' you can do the same thing with an Ole column in Access
  .ActiveConnection = "Provider=SQLOLEDB.1;User ID=userid;Initial Catalog=database;Data Source=sqlserver"
  .CursorType = adOpenDynamic
  .LockType = adLockOptimistic
  .Open
  AddImage rs, "c:\winnt\compaq.bmp"
  .Close
End With
Set rs = Nothing

End Sub
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6972461
#listening
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:glass_cookie
ID: 6973152
Hi!

Here's a file for you over the net:

Download...
http://www.vb-helper.com/HowTo/dbpict.zip
Description: Save and restore pictures in a database using ADO with AppendChunk and GetChunk (22K)

Download...
http://www.vb-helper.com/HowTo/dbimage2.zip
Description: Save and display images in a database (45K)

That's it!

glass cookie : )
0
 
LVL 2

Expert Comment

by:gallaghe
ID: 6977275
Best not to save images to a database, why not save images to disk and simply record the image path/name into a field?
0
 

Author Comment

by:RanjiniPraba
ID: 6978054
hi, gallaghe ,this is not the answer which i expect.

 hi others, i am yet to test all your comments, pleae give me sometime. thanks.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7039284
thanks for "A" grade.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7039285
thanks for "A" grade.
0
 
LVL 2

Expert Comment

by:gallaghe
ID: 7039294
Ranjini

Concerning your "reply" to my "comment". I didn't post a "answer" just wanted to "warn" you that saving images to a database table is not a very wise idea, even MS$ says so.

Do what you feel is right for you, but be forewarned.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now