Solved

saving the screen captured

Posted on 2002-04-26
11
172 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

719 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