ReleaseDC is not working
-
[edited - my brain works faster than my fingers] ReleaseDC() does not save information. Please provide more info. --- CPUA 0x5041 Sonork 100.11743 Chicken Little If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
-
If you want the data for a DC from a window to be persistent after you call ReleaseDC, then you need to create your window with the CS_OWNDC or CS_CLASSDC style.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
[edited - my brain works faster than my fingers] ReleaseDC() does not save information. Please provide more info. --- CPUA 0x5041 Sonork 100.11743 Chicken Little If a man is standing in the middle of the forest speaking and there is no woman around to hear him...is he still wrong?
I'm making a window that acts as a menu, see: this is my command: ShowMenu(BOOL bFromKey, int x, int y,CWnd* pParent, HMENU hMenu) and i have a CMenu named m_pMenu i convert the hMenu into a CMenu: m_pMenu->m_hMenu = hMenu; this is ok, now i create my window using the CreateEx command, after my window is created i call another class called DrawMenuItem, this one get the size of all the menuitems stored in the m_pMenu, after get the size of the items, i assing the size to the window using the MoveWindow, after this the window is showed using the ShowWindow, then i call the ReleaseDC to make m_pMenu free for use for every class, but here's the problem when the menu is showed it call the OnPaint, in this i paint the background and i draw the menu text for the menuitems, but the m_pMenu is empty in this, why if it's supposed to be the m_pMenu of the ShowMenu command?
-
If you want the data for a DC from a window to be persistent after you call ReleaseDC, then you need to create your window with the CS_OWNDC or CS_CLASSDC style.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
I'm making a window that acts as a menu, see: this is my command: ShowMenu(BOOL bFromKey, int x, int y,CWnd* pParent, HMENU hMenu) and i have a CMenu named m_pMenu i convert the hMenu into a CMenu: m_pMenu->m_hMenu = hMenu; this is ok, now i create my window using the CreateEx command, after my window is created i call another class called DrawMenuItem, this one get the size of all the menuitems stored in the m_pMenu, after get the size of the items, i assing the size to the window using the MoveWindow, after this the window is showed using the ShowWindow, then i call the ReleaseDC to make m_pMenu free for use for every class, but here's the problem when the menu is showed it call the OnPaint, in this i paint the background and i draw the menu text for the menuitems, but the m_pMenu is empty in this, why if it's supposed to be the m_pMenu of the ShowMenu command?
So let me get this clear, you are painting the background and text in the menu, but ... A) you never see the text appear on the menu B) you see the text appear on the menu, but the next time it appears the text is gone First, I would say that if you are painting the background in the OnPaint handler, then you need to handle the OnEraseBkgnd handler as well and simply return TRUE in your implmentation of this function. second if your answer to the above statement is choice A, I would say make sure that you are drawing in the proper coordinates for you window. It is possible that you have miscalculated the region that you should be drawing and you are not drawing on a region where the menu window exists. If your answer is B, then I will have to ask some more questions. Good Luck!
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life! -
Based on your reply to PJ Arends response, the styles of your window are not the problem. I responded to the other thread, I hope that helps you.
Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!