|
Example:
in_addr *addr = (in_addr*)*host->h_addr_list;<br />
<br />
CString s;<br />
s.Format("%d.%d.%d.%d", addr->s_b1, addr->s_b2, addr->s_b3, addr->s_b4);
Regards,
BB
|
|
|
|
|
Hiya, thanks for that and tried it but it says that s_b1 is not a member of in_addr. Which it isn't.
I put it in exactly as suggusted. But S_un is the member of in_addr .i.e
addr->S_un
What can I do to fix this??
Thanks again,
grahamoj
|
|
|
|
|
OK, I mispelled this. I guess you may use:
s.Format("%d.%d.%d.%d", addr->S_un.S_un_b.s_b1, addr->S_un.S_un_b.s_b2, addr->S_un.S_un_b.s_b3, addr->S_un.S_un_b.s_b4);
Regards,
BB
|
|
|
|
|
Hi ... you may try this code snippet ....
the result should be something like 123.456.789.123 ...
hope it will help you
struct hostent * pHost = gethostbyname(szHostName);
if(pHost != NULL)
{
for(int i = 0; (pHost->h_addr_list[i]!= NULL); i++ )
{
CString csIP = "";
for(int j = 0; j < pHost->h_length; j++ )
{
if( j > 0 ) csIP += ".";
CString addr = "";
addr.Format("%u", (unsigned int)((unsigned char*)pHost->h_addr_list[i])[j]);
csIP += addr;
}
AfxMessageBox( csIP );
}
}
|
|
|
|
|
use inet_ntoa fucntion:
char szIP[16];
struct hostent *host = gethostbyname( szHostName );
struct in_addr *InAddr = (struct in_addr*)host->h_addr_list[0];
strcpy(szIP,inet_ntoa(*InAddr));
|
|
|
|
|
Anyone ever done this? Specifically, I have a crapload (well, five of the little beasties anyway) of 122x32 LCD panels that use the SED1520 controller, and I wanna play with them, maybe monitor case/cpu/gpu temperatures.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
When you use overloaded methods and generate a COM proxy, how do you access each overload of the method? Can you even do it? (I'm wanting to host script.)
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I don't think you can overload methods in COM.
|
|
|
|
|
That's the point - what happens? But I suppose the answer is that only the default method def is used in the COM interface definition. (Sigh)
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
|
|
I'm trying to prevent the root node of my subclassed CTreeCtrl from being collapsed. The root node is guaranteed to have children. I've reflected TVN_ITEMEXPANDING to the control and am returning TRUE in its handler to prevent the root from being collapsed, but the user seems to be able to collapse it anyway.
BOOL CProjectTreeCtrl::OnItemExpanding
(NMHDR* pNMHDR, LRESULT* pResult)
{
NMTREEVIEW* pNMTreeView = (NMTREEVIEW *) pNMHDR;
HTREEITEM hItem = pNMTreeView->itemNew.hItem;
if (pNMTreeView->action == TVE_COLLAPSE)
if (hItem == m_hRoot)
return (TRUE);
return (FALSE);
}
I can get around the problem by handling TVN_ITEMEXPANDED , but that's ugly because the node collapses then expands.
Any clues as to what I'm doing wrong? Thanks,
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Thanks, Nick but I'm already able to re-expand the collapsed node by calling Expand() . I was hoping to prevent the about-to-be-collapsed node from collapsing.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You have to set *pResult = TRUE; and the notification handler has to be void!
void CProjectTreeCtrl::OnItemExpanding(NMHDR* pNMHDR, LRESULT* pResult)<br />
{<br />
NMTREEVIEW *pNMTV = (NMTREEVIEW*)pNMHDR;<br />
*pResult = pNMTV->action == TVE_COLLAPSE && pNMTV->itemNew.hItem = m_hRoot;<br />
}
Regards,
BB
|
|
|
|
|
Of course, of course, of course!!! Thank you, thank you, thank you! (Lesson learned: don't try to code when you're sick!)
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You're welcome. I've just added a sample code, but I guess you've already fixed it. OK then - yet another reason to feel more healthy )
Regards,
BB
|
|
|
|
|
I need a sample from the Aug 2001 Platform SDK CD. I don't have the CD available to me, but need it fairly urgently. It's the customdial sample, and should be located in the
\Samples\NetDs\RAS\CustomDial sample
directory on the CD. I'd appreciate it if somebody could email this to me.
________________________
http://www.webreaper.net
|
|
|
|
|
Mark, I've made it available here[^]. (You didn't post your email address ).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks very much.
________________________
http://www.webreaper.net
|
|
|
|
|
Glad you got it- I was about to email it to you myself.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
How can I search for a string by columns in the listview using FindItem.
Thanks
|
|
|
|
|
Hmm, I think you might have to use GetItemText() instead.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I wrote the following program to test what I think is a bug in the implementation of VC++ 6 templates. For some reason the first call's parameters are ignored and the second call is repeated twice.
<br />
#include "stdafx.h"<br />
#include <stdio.h><br />
<br />
template<class DATAType,DATAType data>Test()<br />
{<br />
printf("Sizeof DATAType %d\n",sizeof(data));<br />
printf("Data = %d\n",data);<br />
}<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
Test<char,0>();<br />
Test<int,1>();<br />
return 0;<br />
}<br />
The output is:
Sizeof DATAType 4
Data = 1
Sizeof DATAType 4
Data = 1
I had a friend compile this on g++ and it worked as expected.
Sizeof DATAType 1
Data = 0
Sizeof DATAType 4
Data = 1
|
|
|
|
|
and if you reverse the order of the calls, it uses the char version of the function twice.
cool.
definitely looks like a bug, to me.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|