Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CPictureHolder across a network

Posted on 2004-08-02
13
Medium Priority
?
219 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
[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
  • 6
  • 3
  • 2
  • +1
13 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11701519
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
ID: 11701627
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
ID: 11701676
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
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 45

Expert Comment

by:AndyAinscow
ID: 11702979
'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
ID: 11708990
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
ID: 11709010
What would be ideal is if I could take the file loaded in memory, and attach it to a CPictureHolder object somehow.
0
 
LVL 45

Expert Comment

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

Author Comment

by:lwinkenb
ID: 11709522
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
ID: 11710116
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
ID: 11710169
After I transfer it over, it's already in RAM isnt it?
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 11710651
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
ID: 11741991
Closed, 500 points refunded.

Thanks

OzzMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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