|
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
|
|
|
|
|
devenv [...] /D"PCM_MULTILINEAR" as shown as "command line" in the Project properties does not work?
Alternatively, you would set up proper project-configs for that, and call devenv with it:
/build builds the specified solution config (e.g. "debug", "release")
/project specifies a project (instead of a solution)
/projectconfig specifies the config (e.g. "debug", "release"
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I tried:
call "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.exe" "CMM Tool Kit 7.10.sln" /rebuild release /D "PCM_MULTILINEAR" /out test.log
But I got the following error message:
Invalid Command Line. Unknown Switch : D.
As far as : "Alternatively, you would set up proper project-configs for that, and call devenv with it:"
Is project-configs simply a text file or a file with a specific extension? Could you please give an example of how the content of project-configs would look like.
Thanks.
|
|
|
|
|
Mohamed Douffir wrote: Is project-configs simply a text file or a file with a specific extension?
Look at one of the projects set up with the VC++-GUI and open the *.vcproj-file.
Alternatively, there is nmake , the Microsoft make-implementation.
Look for help on it in MSDN.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Try here.
"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
|
|
|
|
|
Hi guys,
I'm currently figuring how to use of genetic algorithm to produce a image recognition application for my project.
Simply to say, is something like handwriting recognition or neural netwrk.
But to all my researches and understanding, GA are only applicable to path finding alghorithm and optimization. GA works well with binary. My intention was to make use of pixel count by "1s" for blank pixel and "0s" for black pixels.
Can anyone give me guidances or any tips/ related projects as references. Thanks
Ray Luee
|
|
|
|
|
A genetic algorithm does, loosley speaking, try to find a global maximum by looking at a number of random spots in the "solution space".
These spots are called individuals, and how "good" they are is determined.
In the next step ("generation"), it exchanges the worst individuals by some new individuals near the position of the best individuals known so far.
You have no guarantee whatsoever that you will find the global maximum, but you will find one or more local maxima.
Also, you will need to determine what is a "good" and what is "bad" fast and reliably - its called the "fitness function", and it is evaluated for each individual in each generation.
Can you give a suitable fitness function? Then a GA might work very well for you.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|