|
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Oh, I see! Thanks, now I'm not worried anymore!
|
|
|
|
|
Any quick function or class to get the IP address of the PC the program runs on ?
Thanks,
Shay
|
|
|
|
|
One way is to call gethostname() followed by gethostbyname() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
Does this code look reasonable ?
I did get my PC name on the netwrok but not actual IP address
<br />
char * hostname=new char[50];<br />
gethostname (hostname,50);<br />
<br />
hostent *host_info=new hostent;<br />
host_info=gethostbyname(hostname);<br />
char FAR** iplist=host_info->h_addr_list;<br />
char *ip=iplist[0];
|
|
|
|
|
char hostname[51] = { 0 };
gethostname(hostname, 50); will save you one delete[].
hostent* host_info = gethostbyname(hostname) will save you one memory leak.
char* ip = host_info->h_addr will save you some typing.
A better code snippet:
char hostname[51] = { 0 };
gethostname(hostname, 50);
hostent* host_info = gethostbyname(hostname);
char* ip = host_info->h_addr;
Good music: In my rosary[^]
|
|
|
|
|
Agreed, this is a nicer and cleaner code.
However, I still don't get the actual IP adress I want, all I get is what we call the "Connection-specific DNS Suffix" and not the actual numbers....
any help is good.
Shay
|
|
|
|
|
Shay Harel wrote:
all I get is what we call the "Connection-specific DNS Suffix" and not the actual numbers....
check [GetNetworkParams ] api is of any help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
check [GetNetworkParams] api is of any help?
Which member of the FIXED_INFO structure are you referring to?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DavidCrow wrote:
Which member of the FIXED_INFO structure are you referring to?
Sorry I got confused
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
You know what, I found that in the MSDN help, but I have one problem with it.
I need to include the Iphlpapi.h and my code will not link when I do that.
The web site say:Library -> Link to Iphlpapi.lib.
Where do I add this DLL to my code ?
Shay
|
|
|
|
|
Shay Harel wrote:
The web site say:Library -> Link to Iphlpapi.lib.
you Need PSDK for that, search MSDN.microsoft.com for that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
The only things that comes up is the Windows server 2003 PSDK and I don't know if I should load this one.
Do you have any specific link ?
Thanks again in advance...
|
|
|
|
|
If you are using VC++ v6, you will need to request the Platform SDK on CD. It is no longer available for download.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Working with a CDHtmlDialog...almost every 3rd or 4th time I display the dialog the dialog just does not display. It's intermittent and when I step through the code I can't catch what is causing it. InitDialog does not get called when it fails.
Similar to this problem I found here.[^].
Any ideas or suggestions?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Is there a way to incorporate the standard file copy dialog that Windows uses when you copy files (the animated paper flying from left to right, and an estimated time to finish) in my MFC program? I thought I ran across it once while looking for something else, it said all I had to do was instantiate the class, give it a range for the progress bar to slide, then when a unit of work was done, I'd step it and optionally give some text to display, like a filename if I was copying, or something else. I did some searching on a function I remember called StepIt() and that was just for a progress bar, not the dialog. If nothing like that exists, I'll have to make it but I'd like to know if I could tap into the some existing resource to use the standard dialog and animations in Windows. Thanks in advance.
|
|
|
|
|
|
As Chris has suggested, I'd use SHFileOperation() , but if you are feeling adventurous, you could write your own and use the AVI files located in your C:\Program Files\Microsoft Visual Studio\Common\Graphics\Videos folder.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thanks Chris and thank you David. I found the documentation for CAnimateCtrl previously which looks like it'd control the animation itself in the dialog and it mentioned those animations. For now I'd like it to get up and running so I'll probably use SHFileOperation() but once the app becomes more stable, I'll look into customization because I'm a big fan of reinventing wheels.
|
|
|
|
|
|
I looked into the suggestion and it looks like that it can only be used when you copy files. I was looking for something that looks like that but gives me more of a staged progress display. It looks like I will have to write my own dialog but I'm still in the process of conceiving of how I'll do it. I already have an array of events that handle all of the synchronization, I just have to figure out how to show the dialog and enabled it to do handle the events and display progress.
|
|
|
|
|
Anybody know of any code (free or payable) that will take a picture which is fine on screen and smooth it so it looks fine when stretched during printing? Normal stretching just makes everything blocky. Microsoft obviously have the code in Office products. Any ideas welcome!
|
|
|
|
|
|
I've converting to a DIB and using StretchDIBits.
|
|
|
|