|
If it is a DDB(device dependent bitmap) use GetDIBits(...) on the HBITMAP and get the
DIB with the format of your choice specified via the BITMAPINFO. Once got the DIB bits,
you can save to the file by putting the BITMAPFILEHEADER,BITMAPINFO and the bits itself
to a file in that sequence.
Vipin - MVP
|
|
|
|
|
|
hi,
strange problem with my colors: i want to display a tray icon but it always appears in black & white although the image HAS color. I've tried it with a 256 color bitmap, a 256 color icon, a 24 Bit color bitmap and a 24 Bit color icon (every variant with 16x16 Pixel) each time the same effect - JUST BLACK AND WHITE. Even with different functions for loading the images hasn't changed it. (tried LoadIcon, LoadImage and CreateIconIndirect )
any ideas what this may trigger ?
greets
|
|
|
|
|
Unless you're using Windows XP, tray icons always render using the standard 16 system colours, so you'll need to provide a 16 colour icon to stop it trying to convert it for you (which usually looks awful)
On XP, it renders the icons properly, using all available colours
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
you're right - windows converts my icon into 16 colors. but how do i can make sure to use only the standard 16 system colors ?
|
|
|
|
|
The simplest way is to copy your existing icon, add a new 16 colour icon to the resource in visual studio, and paste in your icon. This will create a 16 colour icon which you can then manually edit until it looks good enough (you can often redraw the icon yourself far better than windows will do itself when it remaps the icon at runtime)
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
hm, although i hoped that i didn't have to redraw the icon by my self it's seems there leads no way around.
16 colors are ridiculous however,
thanks anyway.
|
|
|
|
|
Hi,
I want to create a program that can monitor another processes memory usage..
Where it can find information about other processes memory usage??
WinAPI is large and wide and I am lost
|
|
|
|
|
|
You can also use OpenProcess and VirtualQueryEx
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Ok, thanks!
|
|
|
|
|
what is the difference between
Child thread
Worker thread
How do we create both threads /??
Vikas Amin
Embin Technology
Bombay
|
|
|
|
|
I believe they are the same thing.
Worker threads are child threads if they are in the same process.
A child thread closes when the main thread of the program closes.
this is this.
|
|
|
|
|
Conceptually, in MFC we got two type of threads:-
UI threads and worker threads.
Have a look at AfxBeginThread(...) documentation.
Vipin - MVP
|
|
|
|
|
Vipin Aravind wrote: Conceptually, in MFC we got two type of threads:-
UI threads and worker threads.
Specifically, however, they are thread with message pump, and thread without message pump.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
david, can you explain it a little more? you mean UI->with msg pump and worker without Msg pmup?
VuNic
|
|
|
|
|
one thread (with the message pump ) receives messages from Windows, the other not.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
A "worker thread" can do some UI stuff (e.g., PostMessage() and an occasional SendMessage() ), and a "UI thread" can do worker stuff, so the terms are mostly meaningless.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
vikas,
What are you working on? I have noticed that you have been posting very basic questions. one or two is fine, but you have posted many of them.
The questions you ask are generally asked my collage students, we can understand about them but you are a working professional working in Embin Technology.
You should really buy a good book and read it nicely and read it again so that you get good knowledge w.r.t windows development.
Take this as an advice, it will help you in your development career too.
coming to ur question,
Worker thread is (generally) a child thread of a process.
Windows actually has the concept of UI Thread (contains windows message queue and a message pump) and worker thread does not have a message queue.
Threads can be created using CreateThread(...) api, All threads that are created are always created as a worker thread i.e. no message queue, whenever someone posts a message to the thread or the thread creates a window, etc (anything that requires the thread to have a message queue) the message queue is created for the worker thread so effectivly the worker thread is now a UI Thread.
why windows does this?
Well the reason is very basic, to save memory, a worker thread which does not deal with any windows message do not need a message queue and so the memory is saved for the thread.
-Prakash
|
|
|
|
|
hmm..you are really caring
VuNic
|
|
|
|
|
I second what he said. I am really surprised too that someone employed somewhere to write such code actually does know so little about the subject.
~RaGE();
|
|
|
|
|
we can create UI(user interface) thread with the CreateThread() or AfxBeginThread ()api
we have to pass the class as a parameter to this function which is derived from the CWinThread and should be able to provide RUNTIME_CLASS.
CWinThread handles the Message pump.
and what we normaly create the threads are worker threads
(i.e passing the threadproc to AfxBeginThread() function)
Thanks and Regards
Laxman
FAILURE is the first step towards SUCCESS
|
|
|
|
|
Hi,
Can anybody tell me how to control the main form. I want to make the main form appear depending on a check that i am going to make. For example when running the exe, i need to check first if the username and password is already present in the Registry. If it is present then i wont show the login. If the login is not correct, i shouldn't get the main form but the login again.In which event of the main form should i do this check so as to make the main form appear depending on the result of this check.
Many Thanks,
Priya
|
|
|
|
|
Why the Borland question in a VC++ forum?
I think you need to tweak the ShowWindow() call in the app's InitInstance() method.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I think i gave you the link to borland c++ forum a few days back.
-Prakash
|
|
|
|