![]() |
|
#1
|
|||
|
|||
Can not display bmp in my picture controlHye,
first of all...excuse me for my bad english, i come frome Switzerland Well, i've got a problem with my MFC application. I would like to display an image who come from my framgrabber buffer... I 've verified that the image buffer was good, and it is, i can save the image on a file toto.bmp. But, when i want to display my buffer image in the picture control....i can't. Here is my code : CPP / C++ / C Code:
Here it is for the part who make this... Someone know where is the mistake ????? Thank you for your precious help Greg Last edited by LuciWiz : 10-Mar-2006 at 10:06.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#2
|
||||
|
||||
Re: Can not display bmp in my picture controlWith a quick glance, if m_Picture is the source to the picture control, it does not appear that m_Picture is given anything to display. Basically, the CPicture object is declared, but not used.
|
|
#3
|
|||
|
|||
Re: Can not display bmp in my picture controlI don't understand...
the source to my picture Control is m_VideoNotModifiedDC like is declared here : CPP / C++ / C Code:
that's right...??? Last edited by LuciWiz : 10-Mar-2006 at 10:17.
Reason: Please insert your C++ code between [c++] & [/c++] tags
|
|
#4
|
||||
|
||||
Re: Can not display bmp in my picture controlWhat is the intention of this line in OnInitializeCam()?
CPP / C++ / C Code:
Based on that first listing, I don't know what type 'm_VideoNotModified' has. Should m_Picture possibly be m_VideoNotModified instead? |
|
#5
|
|||
|
|||
Re: Can not display bmp in my picture controlOh yes ...euh.
do not pay attention about that.... m_VideoNotModified is declared as Control CStatic DC_VIDEONOTMODIFIED is of type Bitmap |
|
#6
|
||||
|
||||
Re: Can not display bmp in my picture controlI'm not 100% sure, but do you possibly need to call UpdateData() to update the dialog?
|
|
#7
|
|||
|
|||
Re: Can not display bmp in my picture controlWell,
i 've seen that on this call : Code:
i should have an CBitmap pointer... I 've made this to test: Code:
But ... pBitmap return value is.... NULL... so there is a real problem here... but why SelectOBject doesn't return a good value... i don't know at all because as seen on my code... Cbmp_frame return a good BItmap image (as i've tested)....so the problem come with CDC_Mem.... |
|
#8
|
||||
|
||||
Re: Can not display bmp in my picture controlI noticed there are two CreateBitmap functions.
One returns BOOL (from the CBitmap class), and the other (a GDI function) returns a handle to the bitmap. Since you call the CBitmap version, the MSDN says that operator HBITMAP() must be called to get the handle from CBitmap class. Here's the MSDN text: Quote:
See if this possibly helps. Also, this might be easier... I see that you pre-save the image to file: "C:\\toto.bmp" instead of all this: ( after is_SaveImageMem() ) CPP / C++ / C Code:
why not just CPP / C++ / C Code:
I'm not sure what the difference is between your m_VideoNotModified and m_VideoNotModifiedDC variables. |
|
#9
|
|||
|
|||
Re: Can not display bmp in my picture controlWell, the line where i save the bitmap file was just for a test in fact...
And i can't use it for my application because it's for high security... m_VideoNotModifiedDC is just the DC pointer to m_VideoNotModified |
|
#10
|
|||
|
|||
Re: Can not display bmp in my picture controlIf you are still having trouble, I learnt this from a previous posting:
Just a thought, but are you using Invadate() to cause the next update, and if so, you may need code something like this : CPP / C++ / C Code:
where ImagePosition is a rectangle of where you want to put the image, and the InvalidateRgn() function will cause the frame to process the OnPaint() function. Display is my class, based on CFrameWnd ( Display : public CFrameWnd) which has an OnPaint function that will be called when the region is invalidated. Now in the OnPaint() function you need to perform your BitBlt, like so: CPP / C++ / C Code:
Thus it is the DC of the OnPaint() function of the instance of the window which is being used and not one that was created at initialisation. Hope this might help. I will try to dig out the previous post that gave a good example of how to do this. Here are the limks i used. If it works for you, then we have Paramesh to thank again. hi... you can find more information by visiting this link http://www.functionx.com/visualc/gdi/displaybitmap.htm or http://cma.zdnet.com/book/visualc/ch15/ch15.htm |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about MFC activeX control | pcxgamer | MS Visual C++ / MFC Forum | 0 | 18-Jan-2006 17:16 |
| fedora display problem | machinated | Computer Software Forum - Linux | 1 | 22-Aug-2005 21:03 |
| [winapi] edit control is lying to me... | ubergeek | C Programming Language | 8 | 15-May-2005 18:02 |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 03:38 |
| Detecting a mouse click outside of control | arran.s | MS Visual C++ / MFC Forum | 1 | 27-Oct-2004 06:01 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The