473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem of Using Unamanged memory in VC++6.0

Hello,

I am writing a DLL for Capturing the Image from Camera Device using Camera SDK DLL.
All the calls made to functions in Camera SDK DLL are working properly as I am able to get a return value of zero.

I am able to get the image data as unmanaged memory address(pointer) as a result of a functions call to the camera SDK. I do not know how to display this data directly in the interface using the bitmap class without copying the same to managed memory. I want to directly access the image data pointed to by the pointer.

As of now I am using marshall function available in .Net to copy the data (the starting address of which is pointed to by the pointer) to managed bytestream data. Then I copy the bytestream data to a Physical file in the local Hard Disk and then making use of the bitmap class to display the same in the interface.

I have a constraint not to use any .Net framework classes for completing this image display function. Marshall is a .net framework class. Can anybody suggest an alternative process by which I can directly make use of the data in the unmanaged memory to display the image using the bitmap class.

I also want to display the image making use of the data directly from memory (Live Image) rather than writing it to a physical file (C:\\DempPicture.jpg) and then using the bitmap class to view it.

I need to write the code in VC++6.0(DLL) and display the image without using marshal function which is .net class. I see this problem as more of a conceptual problem and not related to the camera SDK.


In .Net I am using following code,

//Function call that returns the Pointer to Image Data
//prVoid* pVFData  refers to the pointer.

prResponse prSTDCALL MyViewFinderFunction(
prHandle CameraHandle,
prContext Context,
prUInt32 Size,
prVoid* pVFData
)


{

//The code segment making use of .net Framework Class (Marshal) to //display the image is as below
//

System::Byte buffer __gc[] = new System::Byte[MY_BUFFER_SIZE];
System::Runtime::InteropServices::Marshal::Copy(pV FData, buffer, 0, Size);
System::IO::MemoryStream* ms = new System::IO::MemoryStream(buffer);
ms->ReadByte();
System::Drawing::Bitmap *pBitmap = new System::Drawing::Bitmap(ms);
pBitmap->Save("C:\\DempPicture.jpg");
ms->Close();
Aug 11 '07 #1
0 1347

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Pat | last post by:
I am using VC++ 6.0 to develop my program. class A { Object *obj public: A() { obj=new Object ; } ; }
9
by: Connell Gauld | last post by:
Hi, I have come across a problem with a slightly complicated section to a program I am writing. I have a class (let's call it ClassA) which has, in its public area, a variable (which happens to...
2
by: nobrain | last post by:
Release Version Only Problem.. this simple.. class include member variable CString, make many object and free. but programe using memory size is big and big..(only release version, debug...
2
by: darkhonor | last post by:
I'm very new to Windows development, all of my background is in Linux, so please bear with me. I am working on a class project and just for fun I'm building a frontend using VC++ 2003. The...
7
by: mef526 | last post by:
I have had this problem for months now and it has been nagging me. I have a large project that has several C++ DLL's, one of them uses malloc / calloc / free for the other DLL's. I process very...
1
by: akjohn | last post by:
My code compiles fine using VC++ 2005 and also with g++/gcc 3.4.2 (mingw...which came with the bloodshed dev c++ ide). But it only the vc++ build works correctly, the gcc exe starts but...
12
by: Julian | last post by:
Hi, I am having problems with a function that I have been using in my program to read sentences from a 'command file' and parse them into commands. the surprising thing is that the program works...
3
by: vrsathyan | last post by:
Hi.., While executing the following code in purifier.., std::vector<int> vecX; vecX.clear(); int iCount = 0; { int iVal;
5
by: ertis6 | last post by:
Hi all, I need to calculate a value inside 8 nested for loops. 2 additional for loops are used during calculation. It was working fine with 4 loops. My code is like this: ... for(int i1=0;...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.