Click here to Skip to main content
16,018,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralVisual Studio VC++ 6.0 on Windows Vista Pin
André Dewispelaere23-Jan-08 2:52
André Dewispelaere23-Jan-08 2:52 
QuestionRe: Visual Studio VC++ 6.0 on Windows Vista Pin
David Crow23-Jan-08 3:01
David Crow23-Jan-08 3:01 
GeneralRe: Visual Studio VC++ 6.0 on Windows Vista Pin
Chris Losinger23-Jan-08 3:02
professionalChris Losinger23-Jan-08 3:02 
GeneralHash function c++ Pin
Ming Luo23-Jan-08 2:31
Ming Luo23-Jan-08 2:31 
QuestionRe: Hash function c++ Pin
David Crow23-Jan-08 2:53
David Crow23-Jan-08 2:53 
GeneralRe: Hash function c++ Pin
CPallini23-Jan-08 3:19
mveCPallini23-Jan-08 3:19 
GeneralStack unwinding Pin
George_George23-Jan-08 2:01
George_George23-Jan-08 2:01 
QuestionGetComputerNameEx didn't return DNS name Pin
amdopteron23-Jan-08 0:55
amdopteron23-Jan-08 0:55 
Hello!

Following problem:
GetComputerNameEx called with parameter ComputerNamePhysicalDnsHostname didn't return the DNS name - it returns the NETBIOS name.

Do you have an idea whats wrong with the code??

Thanks in advance.

Greetings
Amd Opteron

Here is the code:

#define _WIN32_WINNT 0x0501

#include <cstdio>
#include <cstdlib>
#include <windows.h>
#include <tchar.h>

int _tmain(int argc, TCHAR *argv[]) {
TCHAR szHostname[MAX_COMPUTERNAME_LENGTH + 1];
TCHAR szHostname2[MAX_COMPUTERNAME_LENGTH + 1];
TCHAR *szDnsName;
DWORD dwSize;

GetComputerName(szHostname, &dwSize);

GetComputerNameEx((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsHostname, NULL, &dwSize);
szDnsName = new TCHAR[++dwSize];
GetComputerNameEx((COMPUTER_NAME_FORMAT)ComputerNamePhysicalDnsHostname, szDnsName, &dwSize);

dwSize = sizeof(szHostname2) / sizeof(TCHAR);
DnsHostnameToComputerName(szDnsName, szHostname2, &dwSize);

_tprintf(_T("'%s'\n'%s'\n'%s'\n"), szHostname, szDnsName, szHostname2);

delete[] szDnsName;
return EXIT_SUCCESS;
}
GeneralRe: GetComputerNameEx didn't return DNS name Pin
jhwurmbach23-Jan-08 1:31
jhwurmbach23-Jan-08 1:31 
GeneralRe: GetComputerNameEx didn't return DNS name Pin
David Crow23-Jan-08 3:08
David Crow23-Jan-08 3:08 
GeneralRe: GetComputerNameEx didn't return DNS name Pin
amdopteron23-Jan-08 7:15
amdopteron23-Jan-08 7:15 
QuestionRe: GetComputerNameEx didn't return DNS name Pin
David Crow23-Jan-08 8:11
David Crow23-Jan-08 8:11 
GeneralRe: GetComputerNameEx didn't return DNS name Pin
amdopteron25-Jan-08 3:23
amdopteron25-Jan-08 3:23 
JokeUndefined class name! Pin
Hakan Bulut23-Jan-08 0:34
Hakan Bulut23-Jan-08 0:34 
GeneralRe: Undefined class name! Pin
CPallini23-Jan-08 0:56
mveCPallini23-Jan-08 0:56 
GeneralRe: Undefined class name! Pin
Nitheesh George23-Jan-08 17:02
Nitheesh George23-Jan-08 17:02 
GeneralRe: Undefined class name! Pin
Hakan Bulut24-Jan-08 0:33
Hakan Bulut24-Jan-08 0:33 
GeneralCheck Variable is CString or Integer (RTTI in MFC/ATL) Pin
QuickDeveloper23-Jan-08 0:26
QuickDeveloper23-Jan-08 0:26 
GeneralRe: Check Variable is CString or Integer (RTTI in MFC/ATL) Pin
Cedric Moonen23-Jan-08 1:02
Cedric Moonen23-Jan-08 1:02 
GeneralRe: Check Variable is CString or Integer (RTTI in MFC/ATL) Pin
jhwurmbach23-Jan-08 1:09
jhwurmbach23-Jan-08 1:09 
GeneralRe: Check Variable is CString or Integer (RTTI in MFC/ATL) Pin
Naveen23-Jan-08 17:12
Naveen23-Jan-08 17:12 
Questiongood code to return const reference to function local object? Pin
George_George23-Jan-08 0:24
George_George23-Jan-08 0:24 
AnswerRe: good code to return const reference to function local object? Pin
Cedric Moonen23-Jan-08 0:59
Cedric Moonen23-Jan-08 0:59 
GeneralRe: good code to return const reference to function local object? Pin
George_George23-Jan-08 1:43
George_George23-Jan-08 1:43 
GeneralProblem with 'Delete' key. Pin
Sanjay K22-Jan-08 23:57
Sanjay K22-Jan-08 23:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.