?
Solved

saving the screen captured

Posted on 2002-04-26
11
Medium Priority
?
180 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

765 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