Click here to Skip to main content
15,898,538 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralQuestion About Modems Pin
Rassul Yunussov24-Dec-04 18:37
Rassul Yunussov24-Dec-04 18:37 
GeneralRe: Question About Modems Pin
Michael Dunn25-Dec-04 5:51
sitebuilderMichael Dunn25-Dec-04 5:51 
GeneralLocking the desktop... Pin
dSolariuM24-Dec-04 17:21
dSolariuM24-Dec-04 17:21 
Generalmaybe someone can help me out. Pin
donttrip24-Dec-04 16:56
donttrip24-Dec-04 16:56 
GeneralRe: maybe someone can help me out. Pin
Rassul Yunussov24-Dec-04 17:51
Rassul Yunussov24-Dec-04 17:51 
GeneralRe: maybe someone can help me out. Pin
Dennis Gourjii24-Dec-04 23:47
Dennis Gourjii24-Dec-04 23:47 
GeneralRe: maybe someone can help me out. Pin
Michael Dunn25-Dec-04 5:55
sitebuilderMichael Dunn25-Dec-04 5:55 
GeneralData Buffer into a VB .Net Byte Array Pin
Daniel Gow24-Dec-04 16:01
Daniel Gow24-Dec-04 16:01 
Hi!

I'll preface this by saying I'm a novice with C++ and the majority of my work is VB .Net, although in the past month I've had to take a self-crash-course in C++ for a project with some severely short deadlines, so I'm able to grasp basic C++ concepts. My C++ work at the moment involves writing my own C++ DLL to act as a join between a VB .Net application I am writing and an SDK that is designed for and writen in, C++ (I unfortunately lack the time to a solid course in C# and work with a more compatible pair of languages). The reason I'm writing this DLL is because certain uses of data types (unions being my biggest problem) used by the SDK aren't replicable in VB .Net (at least not to the best of my ability), and it's been easier to reproduce the functionality I need in C++ and send the data my VB .Net app needs back up the line.

Coming to my problem, the SDK is for a Canon line of digital cameras, and is used for manipulating the camera from a PC (taking pictures and getting live video, with a whole bunch of additional features on the camera you can access). My goal is to be able to take pictures (which I've fully accomplished), and get live video so that the user of my application can see what they're going to take a picture of before they do so. To put this in context, the app is for taking security badge photos.

The SDK handles video capture as sending to the PC what the digital view-finder on the camera can 'see', and it does this at a frame rate I think to be on the order of 25-29 fps, via an event call procedure I vaguely understand. Basically I create a pointer for the event that the initial function recognizes and then runs every time a frame of data is sent in from the camera, and then I write what code I want to in that event to display images. The event's parameters are a void field that is a buffer holding the data of the image, an unsigned long field holding the size of the buffer, another unsigned long field for the format (a 0 or 1 that I set as a seperate parameter of the initial function call to set the images coming back as bitmap or jpeg format, I'm using bitmap), and one more unsigned long field that I can use at my hearts content, but doesn't play any role in my needs.

Basically, I want to take what's in that buffer, and get it to my VB .Net application as a Byte array (in the .Net sense of the type) that I can then turn via a .Net memory-stream that data into a bitmap image (that final step being something I've done countless times before). My attempts at the moment have been to use a 'global' variable within my C++ DLL that I try to fill with the data from the buffer, and then I have a function of my own that returns the data from that global variable, and from my VB .Net app I just call that custom function however many times a second I want to.

The problem is I'm not getting any usable data, and my Byte array is showing up as having been accessed, but it has a length of 1. I presume this is because the data is being copied to it, but because I'm not so crash hot with C++ data formats, only the first byte of data is going into my array and nothing else (thus a length of 1, which obviously doesn't get me much).

I can provide sample code if it will help, but I wasn't sure it's necessary because I think my problem is not something particularly specific. Using a global unsigned long field I returned using my custom function, the Size field I mentioned earlier and it shows up as a little over 23,000, which would make sense for a 320x240 bitmap from the viewfinder (default size). I don't really know how to measure the buffer; I know of the sizeof() method but that for some reason was returning 4 to me when I used it on the buffer variable.

So my basic question follows my subject line (I hope so anyway!): How do I take the data out of a buffer that is of the Void data type, and copy it into a type that I can grasp from VB .Net as a Byte array?

Again, for reference. I have the buffer as a Void datatype, and the Size of the buffer, and I have the code in place to draw from a global variable that would be filled every time the viewfinder event is run by the SDK. My problem is I have had zero luck turning the buffer into a VB .Net Byte array.

Thanks so much in advance for any help or suggestions anyone can offer!
GeneralSeparate compilation Problem Pin
elixxo2924-Dec-04 15:00
elixxo2924-Dec-04 15:00 
GeneralIE Add-on for text translation Pin
Samsung24-Dec-04 14:11
Samsung24-Dec-04 14:11 
GeneralIfstream returning crashfest. Hlplz :) Pin
Anonymous24-Dec-04 8:55
Anonymous24-Dec-04 8:55 
GeneralRe: Ifstream returning crashfest. Hlplz :) Pin
Neville Franks24-Dec-04 9:53
Neville Franks24-Dec-04 9:53 
GeneralRe: Ifstream returning crashfest. Hlplz :) Pin
Anonymous24-Dec-04 13:46
Anonymous24-Dec-04 13:46 
GeneralRe: Ifstream returning crashfest. Hlplz :) Pin
Anonymous24-Dec-04 13:53
Anonymous24-Dec-04 13:53 
GeneralRe: Ifstream returning crashfest. Hlplz :) Pin
Neville Franks24-Dec-04 14:08
Neville Franks24-Dec-04 14:08 
QuestionSDI Project-How do I Implement Resizing of Modeless Dialog Windows? Pin
jerry1211a24-Dec-04 7:36
jerry1211a24-Dec-04 7:36 
AnswerRe: SDI Project-How do I Implement Resizing of Modeless Dialog Windows? Pin
Dennis Gourjii24-Dec-04 23:51
Dennis Gourjii24-Dec-04 23:51 
GeneralRe: SDI Project-How do I Implement Resizing of Modeless Dialog Windows? Pin
jerry1211a25-Dec-04 4:11
jerry1211a25-Dec-04 4:11 
AnswerRe: SDI Project-How do I Implement Resizing of Modeless Dialog Windows? Pin
John R. Shaw25-Dec-04 6:01
John R. Shaw25-Dec-04 6:01 
GeneralDetecting events on Folder Pin
Imtiaz Murtaza24-Dec-04 5:13
Imtiaz Murtaza24-Dec-04 5:13 
GeneralRe: Detecting events on Folder Pin
Michael Dunn24-Dec-04 5:38
sitebuilderMichael Dunn24-Dec-04 5:38 
GeneralRe: Detecting events on Folder Pin
Dennis Gourjii24-Dec-04 23:56
Dennis Gourjii24-Dec-04 23:56 
GeneralRe: Detecting events on Folder Pin
Michael Dunn25-Dec-04 5:32
sitebuilderMichael Dunn25-Dec-04 5:32 
GeneralIcon Question Pin
mango_lier24-Dec-04 3:54
mango_lier24-Dec-04 3:54 
GeneralRe: Icon Question Pin
Dennis Gourjii24-Dec-04 23:59
Dennis Gourjii24-Dec-04 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.