|
Thanks Randor, maybe i'll try it if i get too desperate.
I found an article about multiple resource and header files in one project on msdn site (http://msdn2.microsoft.com/en-us/library/6t3612sk.aspx), i'll post here if i have any luck including one RC file into the other.
|
|
|
|
|
open the RC you want to copy, select the elements you want to duplicate, and then drag n drop them to the target rc (within Visual C++, of course).
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Cannot do it in VS 6.0 - no drag and drop in there. No "import .rc files" either. I can add it to the project as a regular file but then i have tones of errors because it has to be in sync with resource.h file and it's not.
-- modified at 12:43 Tuesday 18th July, 2006
|
|
|
|
|
Hi,
When I press the enter key in a dialog box, the default is CDialog::OnOk (I guess).
What I usually do is catch the enter key message and make it a tab key.
But for this particular project, I want OnButtonAdd function to be executed if the focus is on an edit box and the Return key is pressed.
I tried this:
BOOL CApplyValue::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message== WM_KEYDOWN && pMsg->wParam==13)
{
CEdit *e;
e = (CEdit*)GetDlgItem(IDC_EDIT_All);
if (e->GetFocus() == this)
OnButtonAdd();
pMsg->wParam=9;
}
return CDialog::PreTranslateMessage(pMsg);
}
No error come up with this, but it doesent work. So I must be doing it wrong. Please can you tell me the right way.
Thanks,
Tara
Fortitudine Vincimus!
|
|
|
|
|
If the CEdit has the focus, then the Dialog never recieves the WM_KEYDOWN message. The message is being processed by the CEdit. You need to derive a class from CEdit and use your PreTranslateMessage code there.
|
|
|
|
|
When the edit control receives focus, use CDialog::SetDefID() on the Add button.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
CDialog::SetDefID()
Thats a wonderful thing I have learnt today. Thanks a lot.
Fortitudine Vincimus!
-- modified at 10:52 Tuesday 18th July, 2006
|
|
|
|
|
Tara14 wrote: Thats a wonderful thing...
Only if it works, though. Let us know.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes!! It did. It worked.
Because of this I also realised one more thing.
In the settings for a button in a dialog box resource, there is an option 'Default button'. If you select that option for any button, when the enter key is pressed that particular button is activated. Earlier, I had thought that the option 'Default button' had to do with its appearence!
Thanks.
Tara
Fortitudine Vincimus!
|
|
|
|
|
This is not the proper way of handling RETURN Key. If you have more than one edit box and if you want to handle RETURN in different ways for each edit box, then this method fails.
Check the below code:
BOOL CApplyValue::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message== WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
if (pMsg->hwnd == ::GetDlgItem(*this, IDC_EDIT1) //Replace with proper resource ID
{
//Do your processing for Edit box1
GetDlgItem(*this, IDC_EDIT2)->SetFocus(); //If you want to set focus to next edit box
}
else if(pMsg->hwnd == ::GetDlgItem(*this, IDC_EDIT2)
{
//Do your processing for Edit box2
}
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
|
|
|
|
|
Thanks a lot.
Fortitudine Vincimus!
|
|
|
|
|
Hi All,
When I use GetComputerNameEx in my code, I am getting an error stating that the function does not exist. But, its given in MSDN that the function is declared in Winbase.h. I got through Winbase.h also but I dont find such a function declared. Can you please suggest if I shld include any other header file??
NOTE : I have already included Windows.h(which in turn includes Winbase.h) in my code.
Awaiting your earliest response.
Thanks..
|
|
|
|
|
What Win OS you are using...
for GetComputerNameEx(..) minimum requirement is Win XP or Win 2000 Professional
Do your Duty and Don't expect the Result
|
|
|
|
|
Windows XP Professional with service pack 2.
Is it specific to Visual Studio installation( I have Visual Studio 6) as I dont find the function in Winbase.h?
|
|
|
|
|
|
I need to get the HostName.DomainName (ComputerNameDnsFullyQualified) so I am using GetComputerNameEx. GetComputerName will give only the hostname.
|
|
|
|
|
Did you see MSDN
From the MSDN:
"To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later"
whitesky
|
|
|
|
|
Hi
I have tried giving #define _WIN32_WINNT 0x0501, but still it throws the same error.
|
|
|
|
|
Whats application type?I used this file wihout problem
whitesky
|
|
|
|
|
You must've missed the
#if (_WIN32_WINNT >= 0x0500) directive in that same header file.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You need a newer windbase.h - this wasn't supported in VC98.
winbase.h
WINBASEAPI
BOOL
WINAPI
GetComputerNameExA (
IN COMPUTER_NAME_FORMAT NameType,
OUT LPSTR lpBuffer,
IN OUT LPDWORD nSize
);
WINBASEAPI
BOOL
WINAPI
GetComputerNameExW (
IN COMPUTER_NAME_FORMAT NameType,
OUT LPWSTR lpBuffer,
IN OUT LPDWORD nSize
);
#ifdef UNICODE
#define GetComputerNameEx GetComputerNameExW
#else
#define GetComputerNameEx GetComputerNameExA
#endif // !UNICODE
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi All,
Pls send me the code or adress or information on sending and receiveing the messages between two applications.
Thanks in advance,
Ashok Reddy
Ashok
|
|
|
|
|
Interprocess Communications (IPC) comes in several flavors.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If it is a small amount of data you can also use WM_COPYDATA.
AliR.
|
|
|
|
|
Is it possible and if so how can I sense if the microfone is in use? Is there any good exemple?
|
|
|
|