|
The region thing may be interesting, but the point of what I said is it is buried in a function, so all you have to do is pass in the HDC that holds the bitmap.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I have created a dlgbox with combo box. In the style properties of it i have selected option drop list. But when i run the dlgbox, i could select the data only when i write the first letter of it and after i could choose other thanks to the keyboard.So, my problem is that i couldn't select the data directly with the combobox, e.g, when i click on the combobox it doesn't show all the data we could choose. WHY?
thanks in advance
gerald
|
|
|
|
|
You need to change the dropdown height. In the dialog editor, click on the combo's arrow button and drag the resize handles to increase the height.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi All,
We've developed a fair sized application in Visual C++ 6.0. The App is supposed to run on all Windows (NT, 9x, 2000) platforms. Primarily we developed the App on Windows NT and it runs just fine. But when we run it on Windows 98, strange things happen. The system font i.e. the font in all Windows gets changed and strange messages, which are in the resource file from the past but we don't use, appear. We are deleting all GDI objects that we create in the App. We'll highly appreciate any idea about the reasons or pointers to any helpful articles.
Thanks,
Asif
|
|
|
|
|
We are deleting all GDI objects that we create in the App.
This is not enough. Probably your objects are selected into some device context when you're deleting them. MFC objects are freed, but their GDI counterparts are not. The result is GDI resource leak.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks Tomasz. It worked. The problem was the code like the following:
font.DeleteObject();
pDC->SelectObject(pFontSave);
We just reversed the order of the two lines and the thing is working. In the beginning we were assuming that the CGDIObject destructor deletes the associated GDI object and since we were using local variables we were sure that the destructor was called. Then we called DeleteObject() but it doesn't work while the object is selected in a DC.
Thanks again.
Asif
|
|
|
|
|
Assuming that 'font' variable is a local, you don't even need to call DeleteObject() manually, destructor will do it for you when object goes out of scope. The problem is that DeleteObject will fail if object to be deleted is still selected in some DC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi Tomasz,
One thing I always asked myself: do SaveDC/RestoreDC work the same?
I suppose so, as long as you call RestoreDC before objects destruction.
Is this right?
Paolo.
|
|
|
|
|
do SaveDC/RestoreDC work the same?
Yes, RestoreDC should de-select objects selected after SaveDC. The real question is: what's the performance impact of SaveDC/RestoreDC? Without a profiler session, I can't give you any real advice. I think that using SaveDC/RestoreDC in small functions called in tight loops could cripple the performance, but that's only a guess.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
That's what we thought and we always select the saved objects before leaving the scope. But the thing just wasn't working in Windows 95. It only worked after we excplicitly called DeleteObject().
|
|
|
|
|
Hello !!
I want to take the system into sleep state aand wake the system after say 10 seconds..
I am using the API SetSystemPowerState(). I have used Setwaitabletimer for 10 seconds to fire an signal after 10 seconds so as to wake the system and come out of sleep state.The system is going into sleep state and then returning from sleep after 10 seconds(indicator lights on the monitor changes but nothing appears on the screen) but nothing on the screen is visible afterwards. Only when I press a key or move the mouse does the monitor gets refreshed. Is there some problem in the permissions set???
Can you please help.
I have used the following:
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hToken));
LookupPrivilegeValue(NULL,SE_SHUTDOWN_NAME ,&tkp.Privileges[0].Luid);
AdjustTokenPrivileges(hToken,FALSE,&tkp,sizeof(TOKEN_PRIVILEGES), &oldtp&dwSize);
Sandeep
|
|
|
|
|
Could it be a systems setting?
I remeber of something like "Restore desktop after sleep/suspend mode" for NT4 and Win95. (Don't know the exact option, I'm Italian).
It should be somewhere in the PowerSavings options.
Paolo
|
|
|
|
|
When I create a Dialog Based Application the second dialog of the wizard allows me to choose the language of my resource file. I get the default of US English and choices of Spanish and others.
Later if I add other dialogs to the same project they are defined as Australian resources and placed in another section of the RC file.
What I want to know is how do I get Australian English into the wizard?
Should I make all the resources US English?
If so how? It just magically makes them Australian.
I know I could manually edit the RC file and move them to which ever section I desire, but this in a pain in the arse I can do wihtout. What do others do about this? Or doesn't anyone else worry about this and leave it to the default dished out?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Right click on any resource (dialog, menu, whatever) in the Resource View, then select properties. There's a combobox with languages - just select the appropriate one. VC++ uses your locale settings as the default value.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz
thanks very much for the help, that's two in a row now, it might become a habit. This seems to be one of those little things that someone who has used VC++ since 1995 circa Version 4 should already know, but I don't.
Are these tricks something that you found by trial and error, someone showed you or there's a list of them somewhere.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Hi,
I need BCGLibrary version 5.1 for my final essay. I'd like to add some functions into BCGlibarary myself but later versions doesn't have source. Do you have it?
Thank in advance
Ngo Khai Hoa
|
|
|
|
|
|
Hi,
I may have a solution to your problem. When Stas I was very sad because as I am only 16 I wasn't able to meet the price he wanted for the software. But lucky for me I had a read of his registration page to see what the price was. As I was reading through I came to three registration forks (on the page http://www.bcgsoft.com/register.htm): Commercial (full price), Shareware (discount), Freeware / Student Developer (FREE) <- Do you hear? FREE!
So you can get the full software (along with the source) for nothing. There are only two conditions - You must be student (which it sounds like you are, [and who care anyway?]), and you put a little note in your splash screen that goes something like 'Bits of this software were mad by Stas Leven' or something.
I hope thats helpful
Joel Holdsworth
'My cup of tea's caught fire!'
|
|
|
|
|
Hi,
I may have a solution to your problem. When Stas I was very sad because as I am only 16 I wasn't able to meet the price he wanted for the software. But lucky for me I had a read of his registration page to see what the price was. As I was reading through I came to three registration forks (on the page http://www.bcgsoft.com/register.htm): Commercial (full price), Shareware (discount), Freeware / Student Developer (FREE) <- Do you hear? FREE!
So you can get the full software (along with the source) for nothing. There are only two conditions - You must be student (which it sounds like you are, [and who care anyway?]), and you put a little note in your splash screen that goes something like 'Bits of this software were mad by Stas Leven' or something.
I hope thats helpful
Joel Holdsworth
'My cup of tea's caught fire!'
|
|
|
|
|
Using MFC VC++ 6, CHTTPConnection and CInternetSession.
Anyone have examples on how to get an html page over an SSl connection i.e. https://myserver/ssl/getdata.asp
I'm using GetHttpConnection and OpenRequest methods on the above objects.
Thx
|
|
|
|
|
There is a flag INTERNET_FLAG_SECURE, which you can pass to CHttpConnection::OpenRequest(). Article Q168151 could help as well.
One and only example I know about SSL is from Platform SDK: \Samples\WinBase\Security\SSL.
Regards,
Martin
|
|
|
|
|
Does anyone have an "Easy" way of hiding the menu bar that appears in an MDI. I need to be able to programatically bring up and down the menu. Ie. for example hiding the menu bar at program start and then having a "special" hotkey to enable the menu. Thanks for any help
|
|
|
|
|
If you're not using MFC, this is enough to hide the menu:
SetMenu(hwnd, NULL);
DrawMenuBar(hwnd);
With MFC, you will have to override CDocument::GetDefaultMenu or CMDIChildWnd::OnUpdateFrameMenu.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks for the help I've been able to get this far:
void CMainFrame::OnButtonKillmenu()
{
// Remove and destroy the old menu.
SetMenu(NULL);
CMenu* old_menu = CMenu::FromHandle(m_hMenuDefault);
old_menu->DestroyMenu();
m_hMenuDefault = NULL;
gbMenuBar = false;
}
void CMainFrame::OnButtonRestoremenu()
{
// Load the new menu.
m_NewMenu.LoadMenu(IDR_MFCTYPE);
ASSERT(m_NewMenu);
// Add the new menu
SetMenu(&m_NewMenu);
// Assign default menu
m_hMenuDefault = m_NewMenu.GetSafeHmenu(); // or m_NewMenu.m_hMenu;
DrawMenuBar();
gbMenuBar = true;
}
This allows a button to remove/restore the menu bar but when I use a hot-key (ie. Cntrol->N for a new Document) The menu bar returns. Any ideas?
|
|
|
|
|
This should work in MFC app:
class CChildFrame : public CMDIChildWnd
{
void OnUpdateFrameMenu(BOOL bActivate, CWnd* pActivateWnd, HMENU hMenuAlt);
};
void CChildFrame::OnUpdateFrameMenu(BOOL bActivate, CWnd* pActivateWnd, HMENU hMenuAlt)
{
if (m_bNoMenu)
{
GetMDIFrame()->SetMenu(NULL);
}
else
{
CMDIChildWnd::OnUpdateFrameMenu(bActivate, pActivateWnd, hMenuAlt);
}
}
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|