Click here to Skip to main content
15,893,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: advantage of interface/abstract class Pin
xcavin2-Jul-04 23:34
xcavin2-Jul-04 23:34 
GeneralRe: advantage of interface/abstract class Pin
Vega023-Jul-04 4:30
Vega023-Jul-04 4:30 
GeneralDataGrid & ArrayList Pin
bmasephol2-Jul-04 11:03
bmasephol2-Jul-04 11:03 
GeneralDatagrid Navigation Pin
IamADotNetGuy2-Jul-04 7:30
IamADotNetGuy2-Jul-04 7:30 
GeneralRe: Datagrid Navigation Pin
saud_a_k2-Jul-04 20:07
saud_a_k2-Jul-04 20:07 
GeneralQuestion on events and local variables Pin
Flack2-Jul-04 7:14
Flack2-Jul-04 7:14 
GeneralRe: Question on events and local variables Pin
Karl 20002-Jul-04 9:10
Karl 20002-Jul-04 9:10 
GeneralSaving BMP/JPEG from Stream Pin
Emiliano2-Jul-04 6:53
Emiliano2-Jul-04 6:53 
Hello,

I know this is the c# section, so my managed c++ code might be in the wrong place, but i know that the .net classes are the same in c++ or c# and all the code samples i have used are in c# and the logic is the same

I am trying to save an image stream into a .bmp file or a jpeg file. I an trying to use the .NET classes in the System::Drawing namespaces.


I have some code like the following

//preaper the bufferchar* buf = new char[bufSize];<br />
//populate the buffer with raw bytes coming from the video Stream<br />
dev->Grab(buf);<br />
Byte b[] = new Byte[bufSize];<br />
MemoryStream *ms = new MemoryStream( b );<br />
for(int i=0; i{    <br />
b[i]=buf[i];<br />
}<br />
Bitmap *b = new Bitamp( ms ); <br />
b->Save(S"C:\\test.jpg", ImageFormat::Jpeg);



Every time i run the code the following line
Bitmap *b = new Bitamp( ms );
throws a ArgumentException:Invalid Parameter used exception.

Does any one Know Why, could it be that the Bitmap class understands that the stream is not a valid image yet because the stream only contains the row bytes... any help please...
GeneralRe: Saving BMP/JPEG from Stream Pin
Gimpy19832-Jul-04 6:58
Gimpy19832-Jul-04 6:58 
GeneralRe: Saving BMP/JPEG from Stream Pin
Emiliano2-Jul-04 8:37
Emiliano2-Jul-04 8:37 
GeneralRe: Saving BMP/JPEG from Stream Pin
Gimpy19834-Jul-04 8:28
Gimpy19834-Jul-04 8:28 
GeneralDatagrid column header Pin
Member 5877032-Jul-04 6:33
Member 5877032-Jul-04 6:33 
Generalenum question Pin
Mikke_x2-Jul-04 6:27
Mikke_x2-Jul-04 6:27 
GeneralRe: enum question Pin
Werdna2-Jul-04 12:11
Werdna2-Jul-04 12:11 
GeneralRe: enum question Pin
Mikke_x2-Jul-04 12:49
Mikke_x2-Jul-04 12:49 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 13:57
Colin Angus Mackay2-Jul-04 13:57 
GeneralRe: enum question Pin
Werdna2-Jul-04 14:38
Werdna2-Jul-04 14:38 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 14:52
Colin Angus Mackay2-Jul-04 14:52 
GeneralRe: enum question Pin
Werdna2-Jul-04 15:06
Werdna2-Jul-04 15:06 
GeneralRe: enum question Pin
Colin Angus Mackay2-Jul-04 15:19
Colin Angus Mackay2-Jul-04 15:19 
GeneralRe: enum question Pin
Mikke_x3-Jul-04 0:33
Mikke_x3-Jul-04 0:33 
GeneralRe: enum question Pin
Colin Angus Mackay3-Jul-04 12:08
Colin Angus Mackay3-Jul-04 12:08 
GeneralDatagrid Question Pin
C#Coder672-Jul-04 5:42
C#Coder672-Jul-04 5:42 
GeneralRe: Datagrid Question Pin
DougW482-Jul-04 6:57
DougW482-Jul-04 6:57 
GeneralMultiple instance of startup form Pin
Anonymous2-Jul-04 4:09
Anonymous2-Jul-04 4:09 

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.