|
Not that I know of, you can use the same technique you use in GDI though.
BTW, congrats on having post #100
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Not that I know of, you can use the same technique you use in GDI though
As if I know how to do that with GDI
James T. Johnson wrote:
BTW, congrats on having post #100
I guess no one would believe me if I said that it was entirely accidental
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Nish [BusterBoy] wrote:
As if I know how to do that with GDI
Ask (ok imply) and ye shall receive
Courtesy of MSDN
hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);
hbmScreen = CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
if (hbmScreen == 0)
errhandler("hbmScreen", hwnd);
if (!SelectObject(hdcCompatible, hbmScreen))
errhandler("Compatible Bitmap Selection", hwnd);
ShowWindow(hwnd, SW_HIDE);
if (!BitBlt(hdcCompatible,
0,0,
bmp.bmWidth, bmp.bmHeight,
hdcScreen,
0,0,
SRCCOPY))
errhandler("Screen to Compat Blt Failed", hwnd);
ShowWindow(hwnd, SW_SHOW); James
Simplicity Rules!
[Edit: You obviously won't need the calls to ShowWindow, you can just call Show and Hide on the form ]
|
|
|
|
|
James T. Johnson wrote:
Copy color data for the entire display into a bitmap that is selected into a compatible DC.
Bit confusing there. What's a bitmap object. Later I see that it is an object because you use two members, bmWidth and bmHeight. And how do I select it into a compatible DC?
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I don't know, like i said it was just a copy/paste of code in MSDN, I suppose you could replace bmp.bmWidth with GetDeviceCaps(hdcScreen, HORZRES); and bmp.bmHeight with GetDeviceCaps(hdcScreen, VERTRES);
James
Simplicity Rules!
|
|
|
|
|
Are you using MFC ? If you are, it's a lot simpler than this SDK sample makes it look.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
bmWidth, and bmHeight are the members of a BITMAP structure defined in WIN32. You can obtain this structre by calling GetObject for the WIN32 bitmap handle (HBITMAP).
Regards
|
|
|
|
|
HDC hDC = GetDC(NULL);
HDC hMemDC = CreateCompatibleDC(hDC);
SIZE size = { GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) };
HBITMAP hBitmap = CreateCompatibleBitmap(hDC, size.cx, size.cy);
if (hBitmap)
{
HBITMAP hOld = (HBITMAP) SelectObject(hMemDC, hBitmap);
BitBlt(hMemDC, 0, 0, size.cx, size.cy, hDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hOld);
Bitmap *pBitmap = Bitmap::FromHbitmap(hBitmap);
DeleteDC(hMemDC);
ReleaseDC(NULL, hDC);
if (pBitmap)
{
pBitmap->Save("./test.bmp");
pBitmap->Dispose();
pBitmap = 0;
}
DeleteObject(hBitmap);
}
|
|
|
|
|
|
Bitmap is a managed class in System.Drawing...
|
|
|
|
|
incidentally I spend two hours today in order to find that. I also wanted to know how to set XOR mode in drawing. Unfortunately it looks like that we have to rely on P/Invoke
|
|
|
|
|
Rama Krishna wrote:
Unfortunately it looks like that we have to rely on P/Invoke
No! Not P/Invoke. We can always use IJW if we are using MC++
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
XOR isn't supported under GDI+, from what I can infer it was because XOR was used as a hack because of speed/memory constraints and the proper way now is to ensure that what you are drawing is visible (grey's around the 128 area don't show up well at all when black is xor'd on it).
James
Simplicity Rules!
|
|
|
|
|
|
Nish [BusterBoy] wrote:
C++ IJW - Any good intro?
Well, seeing that there didn't seem to be any basic intro to IJW, I have written my own intro article.
http://www.codeproject.com/useritems/nishijw01.asp
Nish
p.s. There's not much there, just the basics. I might write a part 2 which covers things in more depth.
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Hi Nish,
Not sure whether the link contains what you want, nevertheless thought it would be useful. I think they have a section on Interop.
http://samples.gotdotnet.com/quickstart/latebreaking/
Also, you can search for the user samples section in gotdotnet, its got lots of interesting samples.
regards
Kannan
|
|
|
|
|
What exactly are you looking for?
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
What exactly are you looking for?
I was looking for an elementary introduction to IJW. I badly wanted to avoid using P/Invoke.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
Yeah. I saw your article after I posted my question
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Anyone have the Essential Guide To Managed Extensions For C++ book ? Is it worth ?
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
You're probably not surprised to know that I have this book also
Seriously, it's a good book and the authors are very knowledgable. However, I personally don't like the APress style of book writing. I much prefer the MS Press tutorial-style book on Managed Extensions. (Visual C++ .NET Step by Step).
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
Tom Archer wrote:
You're probably not surprised to know that I have this book also
Nope, neither the smallest fraction of the atom ( a quark )
Tom Archer wrote:
Visual C++ .NET Step by Step
The book's content totally overlaps with Essential Guide to blah blah ?
Don't worry posting the response fast, after all this kind of book is ranked bellow your's and Christopher Duncan's book .
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
According to this
mc++ gotchas
The Visual .Net debugger cannot inspect the values of unmanaged pointers !!
Tell my friends that John Lam from Wintellect is wrong and that we can debug properly unmanaged pointers on a MC++ project , please , pretty please ?
Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
|
|
|
|
|
Joao Vaz wrote:
Tell my friends that John Lam from Wintellect is wrong and that we can debug properly unmanaged pointers on a MC++ project , please , pretty please ?
Well.. I have no idea if John Lam is right or wrong. I'm only startig our with MC++ and I hope he is wrong as well
(-_-)
|
|
|
|
|
Well,
In the watch window unmanaged pointers don't show, you need to open a memory windows to inspected. At least is how I do it!
Al
|
|
|
|