|
hxhl95 wrote: ...but my VC++ 6.0 compiler tells me that it can't find the file. Why?
Is your SDK's Include folder known by the IDE (it's not by default)? If you use an absolute path with dnsapi.lib, does that satisfy the linker?
"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
|
|
|
|
|
Yeah, the IDE knows the include folder's path. I added it in.
Apparently though, everything works without Dnsapi.lib. MSDN told me that DnsQuery needed dnsapi.lib, but I guess not.
So one question remains: Is there any way to obtain the local domain?
|
|
|
|
|
hxhl95 wrote: ...but I guess not.
So what other library do you suppose its hiding in?
hxhl95 wrote: So one question remains: Is there any way to obtain the local domain?
hxhl95 wrote: So one question remains: Is there any way to obtain the local domain?
You can use NetWkstaGetInfo() for this.
"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
|
|
|
|
|
About NetWkstaGetInfo():
LPWKSTA_INFO_100 netinfo = NULL;<br />
if (NetWkstaGetInfo(NULL,100,(LPBYTE*)netinfo)!=NERR_Success){<br />
MessageBox("Error");<br />
return;<br />
}
I get the messagebox each time. Any clues as to why the function isn't getting the info properly? I debugged, and past the NetWkstaGetInfo line, netinfo points to 0x00000000...Definitely not correct.
Thanks for all your help.
|
|
|
|
|
If NetWkstaGetInfo() is failing, have you called GetLastError() .
"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
|
|
|
|
|
GetLastError returns 0...I've never used it before, but I understand what it does.
I think I might've found out why I'm not able to obtain network information. I tried using the nslookup command in cmd, and it tells me that it can't find server name for my IP.
Really, I don't think my router and computer are that screwed up.
|
|
|
|
|
hxhl95 wrote: GetLastError returns 0
Which indicates that NetWkstaGetInfo() is not failing. That is, of course, assuming you are calling it correctly.
"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
|
|
|
|
|
LPWKSTA_INFO_100 netinfo = NULL;<br />
PDNS_RECORD dnsRecord;<br />
if (NetWkstaGetInfo(NULL,100,(LPBYTE*)netinfo)!=NERR_Success){<br />
DWORD anError=GetLastError();<br />
CString errormsg="Error: Unable to obtain network information. Error code ";<br />
errormsg+=stringify(anError).c_str();<br />
MessageBox(errormsg,"Error",MB_OK | MB_ICONWARNING);<br />
return;<br />
}<br />
<br />
if (!DnsQuery(netinfo->wki100_langroup, DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &dnsRecord, NULL)){<br />
MessageBox("Error: Unable to obtain local SMTP server","Error",MB_OK | MB_ICONWARNING);<br />
return;<br />
}<br />
<br />
m_smtpserver=dnsRecord->Data.MX.pNameExchange;<br />
UpdateData();<br />
DnsRecordListFree(dnsRecord,DnsFreeRecordList);<br />
NetApiBufferFree(netinfo);
I even debugged it, and after the NetWkstaGetInfo call, netinfo points at 0x00000000.
|
|
|
|
|
hxhl95 wrote: if (NetWkstaGetInfo(NULL,100,(LPBYTE*)netinfo)!=NERR_Success){
DWORD anError=GetLastError();
So at this point right here, anError is equal to 0 ?
"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
|
|
|
|
|
Nevermind. Solved it. I was missing an & before the netinfo, like this: NetWkstaGetInfo(NULL,100,(LPBYTE*)&netinfo) . I wonder why though.
Although NetWkstaGetInfo is returning NERR_Success now, I am still having trouble. After the NetWkstaGetInfo call, netinfo->wki100_langroup is simply "H". I know that since I put MessageBox(netinfo->wki100_langroup) right after the NetWkstaGetInfo call.
So with the "domain" being H, the DnsQuery call fails.
Any pointers? Thanks a lot for your help.
|
|
|
|
|
hxhl95 wrote: After the NetWkstaGetInfo call, netinfo->wki100_langroup is simply "H".
Which is what normally happens when Unicode is confused with ANSI. Look at netinfo->wki100_langroup in the debug window.
"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
|
|
|
|
|
001570C8 48 00 4F 00 4D 00 45 00 00 00 AD BA D2 70 15 00 A8 70 15 00 D4 70 15 00 00 00 00 00 0D F0 AD BA 4C H.O.M.E...??..+..?.......??
0x001570C8 is where netinfo->wki100_langroup is. I doubt that my local domain is "HOME". I was expecting something like shawcable.net.
And how would I convert unicode to ANSI? I haven't a clue as to what LMSTR is, and it's not on MSDN.
Thanks again for your help.
|
|
|
|
|
Try using the ,su sumbol in the debug watch window.
"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
|
|
|
|
|
Interesting. I never knew that existed.
But I'm still getting "HOME" as the wki100_langroup value. And then DnsQuery fails, because HOME isn't an actual domain.
Is wki100_langroup the NAME of your domain, that you can set? If it is, I don't want that. I want to obtain the local domain. I think the host of my IP would work too for obtaining the SMTP server, wouldn't it?
|
|
|
|
|
Hi All,
I need to generate a makefile from Visual C++ 2003 [for an ATL project].
Do you know how to do it?
Thanks in advance
--
=====
Arman
|
|
|
|
|
|
Hello I have a problem with CComboBox I use MSVS 6.0
I made a MFC application and i have create 4 Dialogs (New Class -> Form )
Now i design a CComboBox and I press ClassWizard and Add Variable IDC_COMBO -> m_Combo (CCombo control)
when i type m_Combo.EnableWindow(FALSE) it works (become disable)
but when i try to add a variable (m_Combo.AddString("asdads") )
Combo Box appears empty (i click on it and no options) any help ? :/
|
|
|
|
|
Maybe something went wrong in the class wizard, try to run your project in debug mode and also check the return value of AddString()... is it CB_ERR then something went wrong.
|
|
|
|
|
It was working correct :/ I just haven't resized the pop up area :/
|
|
|
|
|
|
if you have no question to ask, and if your only intention is to flood the board with crap, i'll have to report you to bob.
|
|
|
|
|
Don't be rude, buddy, at least he recovered his English. IMHO it is a major achievemnt.
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]
|
|
|
|
|
CPallini wrote: IMHO it is a major achievemnt
IMO, it was a must.
now, what is his question ?
|
|
|
|
|
Be patient, I think questions are covered by lesson two of his English recovering course.
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]
|
|
|
|
|
Be closed condition even you hardly pal, timely become to chance more by force.
|
|
|
|