Solved

saving the screen captured

Posted on 2002-04-26
11
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 65
MS SQL store procedure to calculate and return result 6 74
vbModal 12 73
Get the Y value of a line at X in a chart in VBA 28 73
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

739 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