|
hai,
iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem.
sathish
|
|
|
|
|
You can override 2 function OnOK() (for ENTER) and OnCancel (for ESC). In override function, you don't call base function from class CDialog
Example:
void CMyDialog::OnOK()
{
//CDialog::OnOK();
}
-----------------
conglt
|
|
|
|
|
|
By default the enter key means IDOK and esc key means IDCANCEL commands. So avoid this you have to override the followings functions as...
void OnOK() { /* nothing to do */ }
void OnCancel() { /* nothing to do */ }
Try it...
- NS -
|
|
|
|
|
The Esc key is automatically mapped to the IDCANCEL command. So you can get over that by overriding the handler to create an empty function.
Your Enter key is probably calling the OnOK handler because your OK button has the default focus. Again you could override the IDOK handler and bypass the default action, but you should provide an alternative means of exiting yoru dialog (calling the CDialog::OnOk(), or EndDialog() functions), else your program will have no means of quitting.
I Dream of Absolute Zero
|
|
|
|
|
Yes, I forgot that... You have to map WM_CLOSE and call EndDialog( 0 ) from there (OnClose fn) inorder to process the dialog close.
- NS -
|
|
|
|
|
|
deal with the message "WM_KEYDOWN" in the function "PreTranslateMessage"
like this:
BOOL CYourDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(pMsg->message == WM_KEYDOWN)
{
int nVitKey = (int)pMsg->wParam;
if(nVitKey == VK_RETURN)
return TRUE;
else if(nVitKey == VK_ESCAPE)
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
than when you press the "enter"and"ESC" the dialog will not terminate.
bambooshan
|
|
|
|
|
Hi bambooshan,
Is this my answer?or mosali satish
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
I am trying to write a very simple application that mixes MFC with C++ Managed. I have two questions:
1. Is it possible to build the mixed project with the MFC library statically linked. I get some errors of conflict which I don't get when building with dynamically linked.
2. I want to use .NET functions that ask for System::String^ str. When I supply these functions with CString I get error. I read every where that it suppose to work.
CString str = _T("Works");
CString str2 = _T("Doesn't Work");
String ^ stringEx = gcnew String( str ); // OK
strinEx = str2; // Is not working
Thanks.
eladbo
|
|
|
|
|
|
I work in a LAN, IP address of my computer is 192.168.0.111, default gateway is 192.168.0.1
How do I get real IP address of LAN when connect to Internet? (ex:203.162.1.123)
-----------------
conglt
|
|
|
|
|
Your LAN does not have an IP address. It is just a collection of computers, printers, routers, etc. Perhaps you are wanting the firewall's IP address instead.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: wanting the firewall's IP address instead.
you mean the proxy?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
Le Thanh Cong wrote: I work in a LAN, IP address of my computer is 192.168.0.111, default gateway is 192.168.0.1How do I get real IP address of LAN when connect to Internet? (ex:203.162.1.123)
try GetNetworkParams api
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I tried this function but only can get local information
-----------------
conglt
|
|
|
|
|
How can i programatically see from my program if it is running under a normal limited account, or under an administrator account under Windows? I need to see from inside the program if it been started by a user or by an admin ...
-- modified at 4:26 Tuesday 18th April, 2006
|
|
|
|
|
If application run under Active Directory, you can use ADSI to get object acording to current user, check user is a member of group Administrators or not
-----------------
conglt
|
|
|
|
|
BOOL IsUserAdmin(VOID)
/*++
Routine Description: This routine returns TRUE if the caller's process
is a member of the Administrators local group. Caller is NOT expected
to be impersonating anyone and is expected to be able to open its own
process and process token.
Arguments: None.
Return Value:
TRUE - Caller has Administrators local group.
FALSE - Caller does not have Administrators local group. --
*/
{
BOOL b;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup;
b = AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&AdministratorsGroup);
if(b)
{
if (!CheckTokenMembership( NULL, AdministratorsGroup, &b))
{
b = FALSE;
}
FreeSid(AdministratorsGroup);
}
return(b);
}
Taken from MSDN
|
|
|
|
|
Good, thanks
-----------------
conglt
|
|
|
|
|
Radu Sorin wrote: Taken from MSDN
try NetUserGetInfo api
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
while using putcollect() to insert a record to sql,program abnormal termination and provide warning message like the title upon,but "Insert table .." is ok. why?
m_Record->MoveFirst();
m_Record->Delete(adAffectCurrent);
m_Record->Move((long)12);
m_Record->AddNew();
m_Record->PutCollect("ID",_variant_t((long)23));
m_Record->PutCollect(L"[Cage Number]",_variant_t((long)18));
m_Record->Update();
Lee
|
|
|
|
|
vDataType = m_inet.OpenURL(vURL,vType);
I am not able to OpenURl with this method.Can u please suggest what has to be done..
Rgds,
Aparna
|
|
|
|
|
What goes wrong ? What does you call return ?
~RaGE();
|
|
|
|