|
try changing
HBITMAP bitmap1 = CreateCompatibleBitmap(memDC,prc->left,prc->bottom);
to
HBITMAP bitmap1 = CreateCompatibleBitmap(hdc,prc->right,prc->bottom);
The default bitmap for a dc is monochrome - you want a bitmap compatible with the original dc.
|
|
|
|
|
Thanks alot mark all is working fine now. Big Help.
|
|
|
|
|
I have a CTreeCtrl and an associated CImageList. Is there any way I can load images into the CImageList at runtime (e.g. from an .ico file supplied by the user) without them being hardcoded into the executable files ?
-- modified at 14:21 Thursday 4th January, 2007
cheers,
Neil
|
|
|
|
|
You can add/remove images from image lists dynamically.
Check out CImageList::Add() (::ImageList_AddIcon()), ::LoadImage(), etc.
Mark
|
|
|
|
|
Yes - although if dealing with a lot of images it is better to initially size the ImageList control to hold a bunch of images.
The CImageList::GetImageInfo(...) function or the ImageList_GetImageInfo(...) macro can be used to write data into the images maintained by the ImageList control.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
see
here
Note: you can dynamically load an image using the LoadImage API.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yes you have many good function in CImageList Add,Remove,Replace
|
|
|
|
|
Thanks to everyone for the posts.
I know these functions, but they don't realy explain how to load icons from files or "external" data sources - this is what I meant by dynamic (the icons aren't already hardcoded as resources in the executables). I found the functions I was looking for, which are:
ExtractIcon() - load icon from disk
CreateIconFromResourceEx() - load icon from memory
Sorry, I think I should have explained what I was after a bit better..
cheers,
Neil
|
|
|
|
|
I think you need to SHGetFileInfo to get information about file and... and also if you dont know about CImageList and its functions search on the codeproject it has a lot of good articles
|
|
|
|
|
Good afternoon,
I would like to restrict access to Windows in my program. More especifically, I want to block some "key combinations" (Ctrl-Alt-Del, Alt-Tab, Windows key). Until now, I did not find anything to help me.
Can someone help me?
Thanks for the attention,
Paulo Cezar
PCFilho
Rio de Janeiro, Brazil
|
|
|
|
|
Maybe you can use SetWindowsHookEx(WH_KEYBOARD,...) and eat the keyboard messages.
|
|
|
|
|
But not all keyboard combinations are passed on by Windows.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks.
|
|
|
|
|
I think a global keyboard hook can catch everything except the SAS . If not a keyboard hook, then a CBT hook can... I am pretty sure one of them can catch everything except the SAS ...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I'm drawing a blank....what is "the SAS"?
Thanks,
Mark
|
|
|
|
|
Secure Attention Sequence, which is what's required for access to Ctrl-Alt-Del.
More
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
My program has some keyboard commands I've got to keep.
I would like to block only those commands which allow access to Windows.
Anyway, thanks for your help.
PCFilho
Rio de Janeiro, Brazil
|
|
|
|
|
Well don't eat ALL the keyboard messages
|
|
|
|
|
I've researched the matter today; studied the Visual Studio documentation; but couldn't make it work.
It seems that SetWindowsHookEx() uses a callback function KeyboardProc(). But I found the documentation too confuse, and did not find any example code to help.
Maybe it is just the Friday effect, or the effect of all those Christmas foods, but I just couldn't understand it.
So, I would really appreciate more help.
Thanks!
PCFilho
Rio de Janeiro, Brazil
|
|
|
|
|
I haven't written a keyboard hook so I have no code I can post but a quick search yielded
this article[^] and this article[^]
These should be helpful. Basically once you've installed the hook, in your hook proc you'll
need to look at the key code and if you want to eat the code, return TRUE, otherwise call the
next proc in the hook chain to let the message get processed as usual.
As others have noted, you won't be able to trap ctrl-alt-delete...the first article link above
explains this a bit
Mark
|
|
|
|
|
Thank you, Mark.
These articles are helping me very much...
King regards,
PCFilho
Rio de Janeiro, Brazil
|
|
|
|
|
hi, happy new year. i'm having a problem with some open source frameworks, and i think it's a compiler problem. when i compiled the FOX toolkit (www.fox-toolkit.org) using the bundled VC++ solution, i configure the build by adding some external libraries (namely zlib, bzip2, libpng, jpeglib, and libtiff), by defining some constants (as suggested in the instructions). here's where the problem is: the library built fine, but when i tried building one of the examples, the linker gave errors about the C runtime library already linked in, and multiply defined symbols. i've had this problem before (after building wxWdigets and using it for an application), and i had to delete the project, rebuild the libray and recode the application. i'd rather not fluke fixing the problem. how can i fix this o i know exactly what to do everytime the problem comes up? thanks.
|
|
|
|
|
I use
EnumChildWindows();
for get "handle" of control in target window.
then I want to use IsKindof() function that is member of CWnd for check it is CEdit object or not.
Can I do like this?
|
|
|
|
|
Use CWnd::Attach() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|