|
The code works with me, and it returns the name of my computer.
Whether the Netbios-name is any different from the DNS-Hostname is determined by your administrator.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
amdopteron wrote: GetComputerNameEx called with parameter ComputerNamePhysicalDnsHostname didn't return the DNS name - it returns the NETBIOS name.
It simply returns the name that was established at system startup, when the system read it from the registry. That must be the NetBIOS name in your case.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This should be the corresponding registry key:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"Hostname"="your-hostname"
On my machine stands there the NetBIOS name and NOT the DNS name.
Do you know a way how to tell Windows to set this key to the proper value?
|
|
|
|
|
amdopteron wrote: Do you know a way how to tell Windows to set this key to the proper value?
Unfortunately no, as I'm not familiar enough with NetBIOS and DNS. What does gethostname() do for you?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
gethostname() from the WinSock library also returns the NetBIOS name...
Any idea?
|
|
|
|
|
class CCombObj : public CObject <br />
{<br />
public:<br />
DECLARE_SERIAL( CCombObj )<br />
<br />
class CProCombObj : public CCombObj
modified 13-Mar-13 6:01am.
|
|
|
|
|
The error message in fact is clear: CCombObj symbol is undefined in the source currently under compilation. Maybe you've included definition for class CProCombObj but not for CCombObj .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Error is clear. because from the code u have given CProCombObj is a nested class in CCombObj. ie the complete definition of CCombObj is unknown for the complier when it find the following class declaration statement.
class CProCombObj : public CCombObj
{
the complier need to get complete information about a class while using inheritance to construct the VTable. so that is why it showing the error.
i think this will help u
|
|
|
|
|
Is there something wrong? I have a class by using manually GUI add class to generic class for a while the class to class that deriveded from CObject base class. The compiler has already this job be complated for the user's defination these classes just as in base defination?
modified 13-Mar-13 6:00am.
|
|
|
|
|
hi
i want to check whether variable in given generic array(like CArray) is CString or integer etc.I tried using IsKindOf but it doesn't work for CString.so is there any method for Runtime type Identification??
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
Correct me if I'm wrong but your array is a template array. So you have to declare something like this:
CArray<CString> myArray;
So, you know exactly what you declared, isn't it ?
|
|
|
|
|
QuickDeveloper wrote: I tried using IsKindOf but it doesn't work for CString
Use the (standardized) RTTI-feature of C++!
The only reason that IsKindOf exists is that MFC predates the C++-Standard.
Something like
CString* pCStr = dynamic_cast<cstring*>(vec[i]);
if( !pCStr)
{
...must be something different...
}
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
QuickDeveloper wrote: so is there any method for Runtime type Identification??
typeid()
|
|
|
|
|
Hello everyone,
1. Returning non-const reference to function local object is not correct. But is it correct to return const reference to function local object?
2. If in (1), it is correct to return const reference to function local object, the process is a new temporary object is created (based on the function local object) and the const reference is binded to the temporary object, and the life time of the temporary object is extended to the life time of const reference?
Or no need to create such a temporary object, just let the const reference binded to the function local object itself?
thanks in advance,
George
|
|
|
|
|
George_George wrote: 1. Returning non-const reference to function local object is not correct. But is it correct to return const reference to function local object?
You mean something like that ?
const int& Test()<br />
{<br />
int Temp = 42;<br />
return Temp;<br />
}
If that's what you mean then the answer is no, you can't do that (well technically you can but it is totally unsafe). The scope of the Temp variable is still limited to the Test function. So, outside your function you will hold a reference to an object that has been destroyed (when going out of scope at the end of the function).
You have to keep in mind that when you use reference, no copy of the object is being made (on the return or by passing a reference as an argument to a function).
|
|
|
|
|
Great reply, Cedric!
My question is answered.
regards,
George
|
|
|
|
|
Hi All,
I am developing a 'Text editor' kind of application. I have derived a class from 'CView' and i am doing all text editor relevant operations with this.
If i select some text and if i press 'Delete' button then my tool is deleting the selected text. But if i do the same thing without selecting the text then it is not deleting the characters.
That means without selecting some text delete operation is not working...
Can any one please tell me how can i handle this ???
Thanks & Regards
Sanjeeva Kumar
|
|
|
|
|
But if i do the same thing without selecting the text then it is not deleting the characters.
Can you tell me is the cursor is focused in edit box when you are deleting the text in edit box.
|
|
|
|
|
Hi Shashi,
Yes. cursor is focused in test editor.
I think i have not written code for handling the delete key event.
Please tell me if you know how to handle this ???
Thanks in advance
Sanjeeva Kumar.
|
|
|
|
|
Sanjeeva Kumar K wrote: I think i have not written code for handling the delete key event.
But did you not earlier state that, "If i select some text and if i press 'Delete' button then my tool is deleting the selected text."?
In your deletion code, are you first checking to see if any text is selected?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have written code for deleting characters only if some text is selected.
If i simply press the 'Delete' button then this function is not invoked.
do i need to handle it separately ???
Regards,
Sanjeeva Kumar.
|
|
|
|
|
Sanjeeva Kumar K wrote: do i need to handle it separately ???
I would think so.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think u don't need to override the WM_KEYDOWN message. it will all happen automatically.
or if u need to override for some reason then call base implementation in overridden function
eg: If you are using the CEdit then you need to call the CEdit::OnKeyDown in ON_WM_KEYDOWN Message Handler function. Or if you are using a Win32 then u need call the Old Window procedure in your own window proc. i mean leave the deleting to the default message handler. that's it.
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
ON_WM_KEYDOWN(OnMyEditeyDown)
END_MESSAGE_MAP()
void CMyEdit::OnMyEditeyDown( UINT nChar,
UINT nRepCnt,
UINT nFlags )
{
CEdit::OnKeyDown(nChar,nRepCnt,nFlags);
// to Do
}
i think this will help you
|
|
|
|
|
Thanks Nitheesh. I will try this.
|
|
|
|
|
Hi all,
For a long time I'm worried about this and still don't found the correct way.
Say I have a function as follows.
void addData(string name, char gender)
{
}
But I can't send name and gender to addData() function within a single function. One function find the name and another function find the gender.
void getName()
{
}
void getGender()
{
}
How can I send those values to the addData() function using two functions as shown above.
I appreciate your help all the time...
Eranga
|
|
|
|