|
Hi,
I had a simple client/server application that excahnges text data through array of bytes (BYTE byBuffer[256]). Now the server wants to transmit the image data (CBitmap) to the client. How the CBitmap object can be converted into array of bytes and then on receiving end (client) it can be converted back into CBitmap.
THANKS.
|
|
|
|
|
To get the CBitmap to byte use
GetBitmap( BITMAP* pBitMap ); refer http://msdn.microsoft.com/en-us/library/279a3c0c(VS.80).aspx[^]
of CBitmap where LPVOID bmBits member of BITMAP will having the byte array.
To set the BYTE array to CBitmap, you can use DWORD SetBitmapBits( DWORD dwCount, const void* lpBits ); you can set your byte array to lpBits.
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks.
I am facing problems with GetBitmap , however GetBitmapBits is giving me byte of array properly.( I guess). but I am unable to get the size of these bits for SetBitmapBits( DWORD dwCount, const void* lpBits ).
|
|
|
|
|
you getting any error in GetBitmapBits?
r u not getting the size?
Величие не Бога может быть недооценена.
|
|
|
|
|
I tried with the way discussed in the article as well. Using GetBitmapBits and SetBitmapBits[^]
but it does not work.
There is no error but the output is not correct.
see the code below
CDeskTop desktop;
BITMAP bmpX,bmpY;
CBitmap mybmp,bmpClone;
DWORD dwValue,dwValue2;
mybmp.Attach(desktop.GetDeskTopImage());
mybmp.GetBitmap(&bmpX );
bmpClone.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 bears the same co-ordinate as the source
int x=bmpX.bmHeight*bmpX.bmWidth;
BYTE* bmpBuffer=NULL;
bmpBuffer=(BYTE*)GlobalAlloc(GMEM_ZEROINIT,bmpX.bmWidth*bmpX.bmHeight);
dwValue=mybmp.GetBitmapBits(bmpX.bmWidth*bmpX.bmHeight,bmpBuffer);
dwValue2 = bmpClone.SetBitmapBits(bmpX.bmWidth*bmpX.bmHeight,bmpBuffer);
bmpClone.GetBitmap(&bmpY);
CDC memDC;
CClientDC dc(this);
memDC.CreateCompatibleDC(&dc);
memDC.SelectObject(&bmpClone );
dc.BitBlt(0, 0, bmpY.bmWidth, bmpY.bmHeight, &memDC, 0, 0,SRCCOPY);
DeleteDC(dc.m_hDC);
GlobalFree((HGLOBAL)bmpBuffer);
|
|
|
|
|
I have written a program in matlab to find correlation between two images...
I want that program in C..
I like to implement it in hardware, so matlab codings cant be used as it is..
So i want an equialent C codings..
Is there any convereters to obtain equivalent C codes....?
Please help me...
|
|
|
|
|
Hi,
I'd like to know.
Is it possible to convert power point (.ppt ) to image file(jpg or bmp) with VC6?
Actually, I want slide show in my VC6 application. so I need to convert .ppt file to several image files...
Any comment will help me..
Have a day.
|
|
|
|
|
This[^] should help.
More links that can help you: here[^]
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi.. I did one project in visual c++..now i need to convert into java ..I have a doubt .does both programming lang has any similarities in library files..
|
|
|
|
|
Figure out what is done in the C++ on the functionality front. Then you can implement the same in JAVA. I don't see much other than the oops concept being the same in either of the languages.
On another note, may I politely ask why do you need to convert the C++ code to Java code.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Friday, July 31, 2009 5:02 AM
|
|
|
|
|
You cannot do a C++ to Java 'conversion' as such. Think of pointers, for instance. Period.
You wrote the program, right? So, you know what it does. Now, just rewrite it in Java.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
C++ syntax can be converted (even most pointers), but the real challenge for you will be to find the equivalent underlying library functionality in the Java library.
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|
|
hi, Anyone know how to display the GB2312 formatted in an MFC application.
I just have create an SDI to read the the text file formatted in GB2312. I tried it dosen't display the chineese kanji characters. please help me out.
|
|
|
|
|
whether it is displaying any other language?
Величие не Бога может быть недооценена.
|
|
|
|
|
yes it does,, like if the same chracters are in unicode(utf-8) format
|
|
|
|
|
Just a guess here but maybe you need to use the right font with the right charset to display your texts.If you check out the LOGFONT[^] structure and look at the lfCharSet member it can have the value of GB2312_CHARSET. That looks promising, does it not?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
yes that looks helpful,, let me look in to the LOGFONT now. thanks anyways.
|
|
|
|
|
|
|
Hello again, all. I need help with function overloads. I have overloaded a class constructor but its not working. I added the second constructor and thought I could call the original and save a lot of typing.
ref MyClass{
int ProductValue;
MyClass(array<int32^>^ arrIn)
{
///Do lots of stuff
ProductValue = arrIn[0] * arrIn[1];
}
MyClass(int i, int j)
{
array<int32>^ newArr = gcnew array<int32>(2);
newArr[0] = i;
newArr[1] = j;
MyClass::MyClass(newArr);
}};
myCobj = gcnew MyClass(4,6);
///myCobj->ProductValue = 0 and not 24
When I call the 1st constructor everything works fine. But calling the second constructor does not return an initialized object. i.e. ProductValue is 0 (zero) instead of 24 (for example).
|
|
|
|
|
The call MyClass::MyClass(newArr); will create a new temporary object.
Change it to this->MyClass::MyClass(newArr);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Alright, thanks brother. Just changed it and it looks good.
|
|
|
|
|
Hi all,
I'm trying to program my first game. It's sort of like Tetris where you have different shapes.
I'd like to use a linked list to go through the list of shapes. But I'd also like to have derived classes representing each type of shape. Basically, I would have a basic Shape class, and derived classes for each type of shape (Shape_1, Shape_2, Shape_3 etc.)
Now, using the linked list, the *next pointer in my list would have to point to a different derived class depending on the shape. Is that something possible in c++?
|
|
|
|
|
|