|
|
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();
|
|
|
|
|
m_inet.Execute(vURL,fun,fun1,fun2);
where
tagVARIANT fun1;
fun1=m_inet.OpenURL(vURL,vType);
tagVARIANT fun;
CString dwSize;
fun.pcVal="GET";
tagVARIANT fun2;
fun2=m_inet.OpenURL(vURL,vType);
VARIANT vURL ;
vURL.vt = VT_BSTR ;
vURL.bstrVal= (BSTR) ("http://www.codeguru.com/forum/images/cg-logo.gif") ;
It is giving "cannot coerce type" error and OnStateChangedInet1 gives state as 11.
|
|
|
|
|
aparnakamath wrote: It is giving "cannot coerce type" error and OnStateChangedInet1 gives state as 11.
What actually you want to achieve
"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 have to enumerate all toolbars attached to a window and programatically launch them(clicking), Cld you suggest a way to do this?
Currently am using EnumChildWindows() to get handle of the respective control attached to the window and GetWindowText() and can enumerate and launch all buttons attached to the window but not a toolbar.
e.g spy++ shows a toolbar on wordpad having class name ToolbarWindow32 and Toolbar window caption as ""
so i can't identify the particular toolbar to retrieve the handle of the toolbar in question and launch it using ::PostMessage(hwnd, BM_CLICK, 0, 0) as i can do all buttons etc attached to the window.
Waiting for a response.
Thanks.
Sincerely
Giftsana
|
|
|
|
|
|
Thank you for the reply.
Let me try it, but how do i identify the toolbar because ::GetWindowText() returns "" for a toolbar. so there is no means of identifying which toolbar is this to launch it i.e. simulating a button press?
Sincerely
Giftsana
|
|
|
|
|
Hello Michael
Thanks for the suggestion.
I used ::SendMessage(hwnd, TB_PRESSBUTTON, (WPARAM) (int) 222, TRUE) for programatically launching individual toolbar buttons using their controlid in this case (WPARAM) (int) 222, but the button click does not happen and it does not launch the asssociated button window. it greys the corresponding buttons and i can see the effect on the toolbar.
after getting the toolbar handle and indvidual toolbar buttons control id i want to perform a click on each button and launch their resp window programatically one after the other?
Am i missing something.Waiting for a suggestion.
Thanks in advance.
Sincerely
Giftsana
|
|
|
|