hello, I have been reading the thread opened by hiya about 'sending email', and I have been interested on the MX lookup, introduced by anonytmouse. Maybe that's a strange problem, but the first time I compiled the code (DevC++&&MingW) it worked well; ok, I copy it to another pc, try to run and there's no problem; then I shuted down both pc, restart them and there's the strange thing: on the pc where I compiled the code does not work the ms verification, and the second strange thing on the other pc it runs correctly. what's that trick? The only difference between both pc is that in the pc where still runs the program there's installed and running the ms messenger. I thought that may be I should use a function to load the dnsapi (something like the 'InitCommonControls()' for the 'commctrl.h' from the win32 api).
Then here comes the new strange thing; while my 2-days-old code still doesn't work, I have find a second sample (a bit different from the anonytmouse's post 'http://cboard.cprogramming.com/showthread.php?p=461428'), and now that is runnig well; that's how it looks like:
but still a new strange thing, I deleted the PDNS_...etc, and the for loop from that code, write instead the next:
DnsQuery("theserver", DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &result, NULL );
for(PDNS_RECORD i = result; i != NULL; i = i->pNext)
printf("%s, %i\n", i->Data.MX.pNameExchange, i->Data.MX.wPreference);
and (might be a magic tric that I cann't see), also works well, while the 2-day-old code doesn't work, and is the same as that new one. How can I solve that problem? Should I force the load of a library? The load of a dll?
But that's not all; I shut down the pc, restart it and: now none of both codes works!!! And the best thing, the 2-day-old code that I copied to a second pc is still working well, no worry about shutdown-restart pc.
I have been seraching on the msdn for something to init, or load, but I have find anything, there's no 'InitDnsApi()' function. Also I have find a second 'force-to-load' bit of code, that's:
but the program does not work. Have someone find in a simmilar strange cases?
typedef DNS_STATUS (WINAPI *f_DnsQuery)(
Thank's in advance