473,614 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem of Using Unamanged memory in VC++6.0

31 New Member
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:\\DempPictur e.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 MyViewFinderFun ction(
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 ::InteropServic es::Marshal::Co py(pVFData, buffer, 0, Size);
System::IO::Mem oryStream* ms = new System::IO::Mem oryStream(buffe r);
ms->ReadByte();
System::Drawing ::Bitmap *pBitmap = new System::Drawing ::Bitmap(ms);
pBitmap->Save("C:\\Demp Picture.jpg");
ms->Close();
Aug 11 '07 #1
0 1359

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

Similar topics

8
1596
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
1829
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 be another class, ClassB) like this: class ClassA { public: // ...
2
1315
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 version is correct) ========exam code============== #include <afxtempl.h> class CObj:public CObject
2
1600
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 project uses the OpenSSL crypto libraries (specifically the BIGNUM functions). The offending code is: if (this->rbtnSetKeysize->Checked) { this->intKeysize = 512; // Load the Prime Number and calculate the Secret Value
7
2165
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 large datafiles (100MB to 300 MB) that have more than 524,000 lines with 5 columns of numbers in text. I allocate 8 arrays with 524,000 or more doubles , and 10 arrays of 32,768 doubles. Is there a min size for malloc / calloc required to...
1
1533
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 hangs...suggesting some memory problem. On building it with gcc 3.4.4 on red hat linux, I get a seg fault. I'm wondering why my code works fine with vc++ and not with g++/gcc. Are there are any flags I can set in gcc to make it work ok ?. I'm coding on...
12
3395
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 fine on some computers and not so fine on others. I tried debugging and cannot make any sense of it. I narrowed it down to the seekg function and made this simple program which (from what I understand) does not seem to be working as expected in all...
3
2820
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
1806
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; i1<x1; i1 = i1++){ ... for(int i2=0; i2<x2; i2 = i2++){
0
8142
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8640
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8589
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8287
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.