|
Using MFC
Do you have any sample code for the gdi
email me at simonsmithtelford@blueyonder.co.uk
|
|
|
|
|
For CImage class see this code
CImage m_Image;
m_Image.Load("C:\\1.jpg");
m_Image.BitBlt(...);
and for GDI+
#include <gdiplus.h>
using namespace Gdiplus;
Graphics graphics(GetDC()->m_hDC);
Image m_image(L"c:\\1.jpg");
graphics.DrawImage(&m_image, 800, 600);
dont forget to import lib file.
and other way you can use of
OleLoadPicture .
|
|
|
|
|
i want to know how to use openCV beta 5 with mfc in VC6. Any tutorial or guidance for it, would be appreciated.
Thanks
|
|
|
|
|
Is there a way to fix(make it unmovable) a non-full-screen dialog's location or position on the screen?
|
|
|
|
|
Well, for moving via the caption, you could respond to the WM_NCHITTEST message, and instead of returning HTCAPTION , return something else like HTBORDER .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Would I be better off trying to override the WM_WINDOWPOSCHANGING message?
|
|
|
|
|
Why not just try it and compare the two results?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
One problem regarding this is that we can move the window by taking the sys menu -> Move, and then using arrow keys.
- NS -
|
|
|
|
|
Of course. I was not suggesting an end-all solution, only one that would get the OP pointed in the right direction.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
One method I found useful is
GetSystemMenu( FALSE )->RemoveMenu( SC_MOVE, MF_BYCOMMAND );
in OnInitDialog.
)
- NS -
|
|
|
|
|
How to save CBitmap To .bmp file without ?
thanks
|
|
|
|
|
Do you want to sabe a hbitmao on the a file?
|
|
|
|
|
jerome_data wrote: How to save CBitmap To .bmp file without ?
without what?
- NS -
|
|
|
|
|
Hello
I want to do a capture of one control(custom control) in my project in memory and save directly this capture in a bitmap or jpg file.
Help me please.
Jdata
|
|
|
|
|
Using Win32 APIs or MFC?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
both.
i do this
CDC dc;
CRect rectClient;
thecontrol.GetClientRect(&rectClient);
HDC hdc = ::GetDC(thecontrol.m_hWnd);
dc.Attach(hdc);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CBitmap bm;
bm.CreateCompatibleBitmap(&dc, rectClient.right, rectClient.bottom);
CBitmap * oldbm = memDC.SelectObject(&bm);
memDC.BitBlt(0, 0, rectClient.right, rectClient.bottom, &dc, 0, 0, SRCCOPY);
here bm as done a screenshot of the control. i want to save this Cbitmap to file .bmp??
If you have other function!!
thanks
|
|
|
|
|
Maybe:
CWindowDC ControlDC(&thecontrol);
CDC MemoryDC;
MemoryDC.CreateCompatibleDC(&ControlDC);
CRect ControlRect;
thecontrol.GetWindowRect(&ControlRect);
CImage ControlImage;
ControlImage.Create(ControlRect.Width(), ControlRect.Height(), 24, 0);
HGDIOBJ hOldBitmap = ::SelectObject(MemoryDC, (HBITMAP)ControlImage);
thecontrol.SendMessage(WM_PRINT, (WPARAM)(HDC)MemoryDC, PRF_ERASEBKGND | PRF_CLIENT | PRF_NONCLIENT);
::SelectObject(MemoryDC, hOldBitmap);
ControlImage.Save(_T("c:\\mycontrol.bmp"), ImageFormatBMP);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
CImage is declared in
atlimage.h<br />
<br /> I used that so I wouldn't have to write code to save to a file - let GDI+ do it
You could use CBitmap instead (a DIBSection would make it easier) and write your
own code to save the bitmap.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
ok i try but i have a error on ImageFormatBMP.
undeclared identifier!!!
i have done #include <atlimage.h> to have Cimage class but i have a problem on ImageFormatBMP
thanks
|
|
|
|
|
Try Gdiplus::ImageFormatBMP
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have a black bmp file (Gdiplus::ImageFormatBMP)
ty
|
|
|
|
|
I didn't know if WM_PRINT would work with your custom control.
I suppose you can scrape it off the screen if it's visible:
CWindowDC ScreenDC(0);
CDC MemoryDC;
MemoryDC.CreateCompatibleDC(&ScreenDC);
CRect ControlRect;
thecontrol.GetWindowRect(&ControlRect);
CImage ControlImage;
ControlImage.Create(ControlRect.Width(), ControlRect.Height(), 24, 0);
HGDIOBJ hOldBitmap = ::SelectObject(MemoryDC, (HBITMAP)ControlImage);
MemoryDC.BitBlt(0, 0, ControlRect.Width(), ControlRect.Height(), &ScreenDC, ControlRect.left, ControlRect.top, SRCCOPY);
::SelectObject(MemoryDC, hOldBitmap);
ControlImage.Save(_T("c:\\testmy.bmp"), Gdiplus::ImageFormatBMP); Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It's works Excellent!!!
THANKS
|
|
|
|
|
Note: I am using Microsoft Visual C++ .NET (Microsoft Development Environment 2003 Version 7.1)
I have a solution comprising of five projects. For one of the project, I enable three compiler flags (PCM_MULTILINEAR, PCM_USE_FILTER16, PCM_USE_IMAGE8) as fallows:
1- Right click on the project in question
2- Select Properties.
3- Under "Configuration Properties", I click on "C/C++" then select "Preprocessor". Then I add the compiler flags (separated by at the "Preprocessor Definitions" field.
Is there a way to pass these complier flags from the command line when building the solution using "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" ?
This how I am building now (without enabling the compiler flags):
"C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" "CMM Tool Kit 7.10.sln" /rebuild release /out test.log
Thanks,
Mohamed
|
|
|
|