Solved

saving the screen captured

Posted on 2002-04-26
11
166 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

759 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

19 Experts available now in Live!

Get 1:1 Help Now