[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

CPictureHolder across a network

I have a picture loaded up in a CPictureHolder object.  I need to send this to another computer via TCP, but I'm unsure how.  What data should I send across in order to build the CPictureHolder object on the other side?
0
lwinkenb
Asked:
lwinkenb
  • 6
  • 3
  • 2
  • +1
1 Solution
 
nonubikCommented:
You can just send the picture file name to the other side, build there a network filename of the picture (i.e. \\comp1\myshare\mypicture.bmp) and create a new CPictureHolder object. Make sure the picture is on a shared folder.
Or you can just send the picture over the net and build there again the CPictureHolder.
0
 
lwinkenbAuthor Commented:
I cant just send the file name across, because the computers are on different networks.

"Or you can just send the picture over the net and build there again the CPictureHolder."
If I knew how to do that, I wouldn't have had to ask the question :)

Currently, this is the only way I know how to do what I need to do:

Open the file on comp1, and read the file into memory.  
Send the data to comp2.
Have comp2 write the file to disk.
Load the file that was just written to disk into a CPictureHolder object.
Delete the file from comp2.

Now obviously this is terribly inefficient.  What I want to do is something like this:

Open the file on comp1, and read the file into memory.  
Send the data to comp2.
Create a new CPictureHolder object on comp2 with the data it received from comp1.
0
 
nonubikCommented:
Ok. Instead of

>Have comp2 write the file to disk.

You can write the data into a memory file. Use CreateFile with FILE_ATTRIBUTE_TEMPORARY set. The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
AndyAinscowFreelance programmer / ConsultantCommented:
'I cant just send the file name across, because the computers are on different networks'

Do the networks share anything?  Your 'terribly inefficient' way may be the only possible solution.
0
 
lwinkenbAuthor Commented:
Just picture the 'network' as the internet.  One computer is in Los Angeles, and the other is in New York.
0
 
lwinkenbAuthor Commented:
What would be ideal is if I could take the file loaded in memory, and attach it to a CPictureHolder object somehow.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Your 'chunck of memory' you want to send sounds suspiciously like a file by any other name
0
 
lwinkenbAuthor Commented:
Of course it's a file, where did I ever call it a "chunk of memory", and not a file?

Maybe I'm not explaining what I need to do in clear enough terms.

I want to take a FILE that is loaded into memory.  This file is an image.  I want to take this image file and attach it to a CPictureHolder object without having to write the file to disk first, and then loading it from there.
0
 
nonubikCommented:
Well, after you transfer it over the net, you have to write it somewhere on the host computer, don't you? Even if not on disk, in the RAM or where?
0
 
lwinkenbAuthor Commented:
After I transfer it over, it's already in RAM isnt it?
0
 
lwinkenbAuthor Commented:
Well, after messing around with this for the better part of a day, I figured out how to do it.  You can load the data into a CPictureObject by using ::OleLoadPicture().  

It should be noted that I used code posted by RONSLOW on codeguru :)
0
 
OzzModCommented:
Closed, 500 points refunded.

Thanks

OzzMod
Community Support Moderator
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 6
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now