Click to See Complete Forum and Search --> : Reading Memory
sivaprakash.shanmugam
May 19th, 2006, 05:43 AM
Whats the possibility to set some text to the memory and read the same text after a while but in the same process. If it is possible how can i accoplish this please explain me in detial.
I have tried with memset() and etc., but i couldnt see the desired output.
Hobson
May 19th, 2006, 05:49 AM
Write text to memory: std::string mystring = "TEST STRING";
Read the same text after a while but in the same process: std::cout << mystring;
Is this not sufficient?
sivaprakash.shanmugam
May 19th, 2006, 05:54 AM
Actually i am reading some text from file so it will be a stream of Bytes, i need to send bytes to MFC Activex control and i need to read it. I have tried in many ways but i couldnt so i am thought going this method. Do you have solution for this.
Siddhartha
May 19th, 2006, 06:04 AM
Actually i am reading some text from file so it will be a stream of Bytes, i need to send bytes to MFC Activex control and i need to read it. I have tried in many ways but i couldnt so i am thought going this method.How are you reading the text file? Post code.
MrBeans
May 19th, 2006, 06:05 AM
So you think you just read some bytes from the memory and some how tranfer it to the activex control...well I have to say that is would not be possible. ActiveX control's work and comunicate with each other using COM and you have to use COM API to achieve your task.
Siddhartha
May 19th, 2006, 06:08 AM
So you think you just read some bytes from the memory and some how tranfer it to the activex control...well I have to say that is would not be possible. ActiveX control's work and comunicate with each other using COM and you have to use COM API to achieve your task.It is possible for the methods exposed by an ActiveX control (and interface thereof) to accept a BYTE*, or a BSTR... ;)
sivaprakash.shanmugam
May 19th, 2006, 06:12 AM
System::IO::FileStream* fsFileContennt = new System::IO::FileStream(dlgUploadFile->get_FileName (),System::IO::FileMode::Open,System::IO::FileAccess::Read);
BinaryReader* brFileContent = new BinaryReader(fsFileContennt);
From this i am getting Bytes how can i send it to Activex control.
Siddhartha
May 19th, 2006, 06:14 AM
From this i am getting Bytes how can i send it to Activex control.I presume that the ActiveX control is available via a member variable.
If so, simply call -
m_MyActiveX.Method (Appropriate Parameters...); As you can see, without knowing the signature of "Method", people here will be clueless as to what you are asking for.
Siddhartha
May 19th, 2006, 06:15 AM
[ redirected ]
Regards,
Siddhartha
sivaprakash.shanmugam
May 19th, 2006, 06:17 AM
mMyActiveX.Method (Appropriate Parameters...);
Here is the problem; i couldnt get appropriate Parameter formates thats where exactly i'm struggling. Let me know whats the correct format for both the side.
Siddhartha
May 19th, 2006, 06:20 AM
mMyActiveX.Method (Appropriate Parameters...);
Here is the problem; i couldnt get appropriate Parameter formates thats where exactly i'm struggling. Let me know whats the correct format for both the side.You need to know the parameters that the ActiveX takes. We can't tell you what parameters a control we know nothing of takes, right?
(It's like me asking you to name the method I am currently programming... )
Is the ActiveX one of your creation? If so, program the method to accept either BSTR or BYTE*
If the ActiveX is not of your creation, the documentation / the compiler error will tell you what it expects vis-a-vis what you are (wrongly) supplying.
sivaprakash.shanmugam
May 19th, 2006, 06:38 AM
As you said, it is not third party control i am creating both the things and i have used BYTE* to send the data but i dont know how to read the BYTE* variable in MFC Activex control side thats why i have started to search some articles and distracted.
BYTE* will hold the pointer of character right?. I have length also from these how can i get my data back in Activex control.
Please explain me.,since i am very new to MFC ActiveX.
Siddhartha
May 19th, 2006, 06:44 AM
Actually, as you are reading a text file, a BSTR makes more sense. A BSTR is a Binary String.
BYTE* will hold the pointer of character right?. I have length also from these how can i get my data back in Activex control.You are right that it will point to the first BYTE (which happens to be a character). However, there is no way to know the length of a BYTE* array and you need to pass array length as a second parameter.
Of course, if you assume that your BYTE* is always a character array, then you can stop at the first NULL character. But, rather than do this, one would change the input to BSTR instead of BYTE* and use the BSTR as a wide-character string.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.