|
you can list all your IP Addresses by doing this :
<font style="color:blue;">struct</font> hostent* infohost;
<font style="color:blue;">char</font> HostName[256];
<font style="color:blue;">char</font>** addrs;
<font style="color:blue;">char</font>* Host;
gethostname(HostName, 255);
Host = HostName;
infohost = gethostbyname(HostName);
addrs = infohote -> h_addr_list;
<font style="color:blue;">while</font> (*addrs) {
printf("IP : %s\n", inet_ntoa( *(struct in_addr *)* addrs));
addrs++;
}
don't forget to check errors.
Your main IP Address while being in a TCP network is in general the first, but not necessarily...
TOXCCT >>> GEII power
|
|
|
|
|
<br />
#include "stdafx.h"<br />
#using <mscorlib.dll><br />
#using <System.Windows.Forms.dll><br />
using namespace System;<br />
using namespace System::Windows::Forms;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
String* hostName = SystemInformation::ComputerName;<br />
System::Net::IPHostEntry* hostEntry = System::Net::Dns::GetHostByName(hostName);<br />
Console::WriteLine(S"Host name : {0}", hostEntry->HostName);<br />
for (System::Int32 i = 0; i < hostEntry->AddressList->Length; ++i)<br />
{<br />
Console::WriteLine(hostEntry->AddressList->Item[i]);<br />
}<br />
return 0;<br />
}<br />
Sincerely,
-Ron
|
|
|
|
|
Or, if you don't like console output:
<br />
#include "stdafx.h"<br />
#using <mscorlib.dll><br />
#using <System.Windows.Forms.dll><br />
using namespace System;<br />
using namespace System::Windows::Forms;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
#pragma push_macro("new")<br />
#undef new<br />
String* hostName = SystemInformation::ComputerName;<br />
System::Net::IPHostEntry* hostEntry = System::Net::Dns::GetHostByName(hostName);<br />
for (int i = 0; i < hostEntry->AddressList->Length; ++i)<br />
{<br />
Text::StringBuilder* sb = new Text::StringBuilder();<br />
sb->Append(hostName);<br />
sb->AppendFormat(S" IP Address {0} = ", __box(i));<br />
sb->Append(hostEntry->AddressList->Item[i]->ToString());<br />
MessageBox::Show(sb->ToString());<br />
}<br />
return 0;<br />
#pragma pop_macro("new")<br />
}<br />
Sincerely,
-Ron
|
|
|
|
|
I got a question regarding storing of settings in the registry.
My application continously stores settings in the registry during runtime, before each value is saved I open the specific registry key and after the value is saved operation i close it.
This causes a frequent opening and closing of a specific registry key.
Is it more suitable for my application to open the registry key at start and to close the key whenever my application is due to shut down? Will there be somekind of vulnerability/benefit using this method, which one is prefered?
|
|
|
|
|
If you have a bunch of open/write/close calls, you might notice a small performance hit, if any, but you must weigh that against the registry cache not being flushed if your application were to terminate abnormally. The registry API does not necessarily write information to the registry immediately; it can take as much as several seconds for the cache to be flushed to the hard disk.
Microsoft Outlook hits the registry about once every 1-2 seconds, with a call to RegCloseKey() each time.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I am very new in windows programming but i want to do something to may be strange.
I want to build an application-Web Browser (or somehow extend the functionality of IE (plugin)) that in every request browser makes adding two additional headers.
for example: a request that makes IE is
GET http://www.google.com.gr/ HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-
powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwav
e-flash, */*
Accept-Language: el
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705
; .NET CLR 1.1.4322)
Host: www.google.com.gr
Proxy-Connection: Keep-Alive
I want to add two more headers(at the end):
Profile: "http://139.91.70.5/index.html1","1-]Ό╓π╦^◄_ϊ~N<°;╪║"
Profile-Diff-1: <rdf xmlns="http://www.w3.org/TR/1999/PR
-rdf-syntax-19990105#" xmlns:prf="http://www.w3.org/TR/WD-profile-vocabulary#">
<description about="Hardware"> <modifications>
a)Can i change every request that IE makes enhance it with a plugin that doing that(adding the two headers)..?
b)Can i build an application from the scratch reusing the Web Browser Control (for the the HTML parsing and rendering of the sites) and enhance my_application with this functionality i describe above..?
c)I also saw in the MSDN documentation something about Winlnet (CHTTPSESSION), but i don't know if i can use such a think.(if i am able to use it, can i change the request that leaves from my client(adding the headers) and can i parse and render the html site that the server will return to my_client and present it properly?)
Does anybody knows anything else i can do..??
Please help me...
Thanks in advance!!!
Manos Moschous
|
|
|
|
|
I have a MFC application with a COM interface. When I start the application via COM (i.e. a vbscript) its user interface is blocked until the call has returned. Is there any way to work around this problem?
|
|
|
|
|
|
How do I do that????
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
No cast is necessary:
int i = 12345;
unsigned int ui = i;
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The plugin´s name?
Quotation "I forgot the name of it, but there is a compiler plugin for VC++ that distributes the compiling across the network, so that build times are near zero, with only linking occuring at the requester. I recall hearing about game companies using it for their massive builds, diminishing hour long builds to less than a minute."
Gywox
|
|
|
|
|
I cannot remember how you make any new document inside an MDI app maximized by default...
I want the window to default to maximized state I do not want to set it to maximized state inside some function like:
CView::OnInitialUpdate() and call
CChildFrame* pFrame = (CChildFrame*)GetParentFrame();
pFrame->MDIMaximize();
All these techniques still cause serious flicker when opening new windows...or navigating...
Is this possible?
TIA
How do I print my voice mail?
|
|
|
|
|
Override PreCreateWindow() in your child frame class and make sure cs.style includes WS_MAXIMIZE .
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
There is a SDI app that I want to shut down after 1 second (it's a frame capture app).
I have tried PostMessage but haven't been able to figure it out yet.
Does anyone have a suggestion ?
Ta.
Elaine
The tigress is here
|
|
|
|
|
PostMessage(WM_CLOSE, 0, 0);
|
|
|
|
|
Yes, but where in the application, remembering that I will need to start a timer ?
The tigress is here
|
|
|
|
|
Check Sleep
or call SetTimer, and you will receive a message WM_TIMER that you need to handle
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm trying to modify the style(CBS_SORT) of a combo box control inside a dialog box at run time. Its seems its not updating? I added the ModifyStyle function inside the InitDialog of the Dialogbox. Is there something I'm missing?
Thanks
|
|
|
|
|
as i tested before, it can not be changed at runtime, may be i (and u) lost something.
my poor solution is:
use 2 combo-boxes, hide one and show one as requested.
includeh10
|
|
|
|
|
I’ve got a .dll from my supplier that I am trying to create a instance of. (I’m not realy good att dll’s).
How may I search for errors when my call to: CreateInstance(…) fails
I know it would return a HRESULT and that the value is 1 on those cpu-s which it don’t work on. The call work properly on my developing machine.
I surely have registered the dll on those cpu-s the call fails.
Pleased for any suggestions…
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
I’ve got a .dll from my supplier...
Does the DLL's supplier have any suggestions?
d00_ape wrote:
I surely have registered the dll on those cpu-s the call fails.
What about any controls that the DLL uses that might need to be registered?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The supplier is unfortunately not contactable in about three weeks…
I've checked dependencies using "Dependency Walker" and all seems OK.
...and justice for all
APe
|
|
|
|
|
d00_ape wrote:
The supplier is unfortunately not contactable in about three weeks…
So how about contacting them before the three weeks are up?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
sorry not "in". Ment after...
...and justice for all
APe
|
|
|
|
|
Have you called the CoInitialise(...) before createing the object ?
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|