Solved

CPictureHolder across a network

Posted on 2004-08-02
13
204 Views
Last Modified: 2013-11-20
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
Comment
Question by:lwinkenb
  • 6
  • 3
  • 2
  • +1
13 Comments
 
LVL 16

Expert Comment

by:nonubik
Comment Utility
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
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
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
 
LVL 16

Expert Comment

by:nonubik
Comment Utility
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
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
'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
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
Just picture the 'network' as the internet.  One computer is in Los Angeles, and the other is in New York.
0
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
What would be ideal is if I could take the file loaded in memory, and attach it to a CPictureHolder object somehow.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
Your 'chunck of memory' you want to send sounds suspiciously like a file by any other name
0
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
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
 
LVL 16

Expert Comment

by:nonubik
Comment Utility
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
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
After I transfer it over, it's already in RAM isnt it?
0
 
LVL 5

Author Comment

by:lwinkenb
Comment Utility
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
 

Accepted Solution

by:
OzzMod earned 0 total points
Comment Utility
Closed, 500 points refunded.

Thanks

OzzMod
Community Support Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

16 Experts available now in Live!

Get 1:1 Help Now