|
Is it possible to retrieve all clients IP in my LAN in my program??
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
http://www.codeproject.com/treectrl/networktreectrl.asp
Article by Paolo Messina.
-Gile
|
|
|
|
|
Thanks!
I will post a message if I have problems!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
I'm curious if it helped? I would try to make a UDP broadcast into the LAN and let my clients answer on it with a short "hello i'm here".
|
|
|
|
|
Well... I have checked the code now and don't see anything that can give me the IPs...
Moak.. do you know how to do that?!
Sample code maybe!?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hej Rickard,
have a look into the winsock FAQ, there should be an example with UDP programming. Basically you send out a short UDP package ("ping") to everyone in the LAN (broadcast), your clients listen to it and answer with another package telling that they are alive and understand your protocol ("pong"). So you will get and collect the "pongs" and get IPs of all alive clients in the LAN. Unfortunately, UDP broadcasts will be usually filtered out on routers (at least from your ISP for heaven's sake), so maybe you will only reach client in the current LAN interface. Just give it a try.
If you need a "deep LAN broadcast" try multicast (much more modern than UDP broadcast AFAIK) or setup a central directory server or a kind of superpeer where all clients register, then you get all clients IPs in the LAN. Actually I prefer the true P2P decentralized solution, but that is your decision.
Code, sorry Im not far now still working on my GUI (again), in a few week I will hopefully find time to do UDP too. Mee me on IRC
/Moak
|
|
|
|
|
Moak
Why not sign in on CodeProject!?
Thanks for your help! I will look up some more info about that now! (Danke! )
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hi,
How to use the function SetDlgMsgResult ?
The follows are an example, but I can't understand their meaning,
#define adgHANDLE_DLGMSG(hwnd, message, fn)
case (message): return (SetDlgMsgResult(hwnd, uMsg,
HANDLE_##message((hwnd), (wParam), (lParam), (fn))))
Jeffrey Richter said:
The normal HANDLE_MSG macro in WINDOWSX.H does not work properly for dialog boxes because DlgProc's return a BOOL instead of an LRESULT (like
WndProcs). This adgHANDLE_DLGMSG macro corrects the problem.
My Question is, the parameter list in SetDlgMsgResult(HWND hwnd, int msg, LONG result) puzzles me. Which parameter replaces which parameter, and where does this action take place, in memory of window?
Thank you.
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
There is no API or MFC call named SetDlgMsgResult. SetDlgMsgResult seems to be one of Richter's custom functions too
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
Nish [BusterBoy] wrote:
There is no API or MFC call named SetDlgMsgResult. SetDlgMsgResult seems to be one of Richter's custom functions too
Following words are copied from MSDN. I have to declare that I've installed SDK in my system.
SetDlgMsgResult
This macro maps to the SetWindowLong function.
SetDlgMsgResult (
HWND hwnd,
int msg,
LONG result );
Parameters
hwnd: Handle to the dialog box.
msg:Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus four.
result:Specifies the replacement value.
In my point of view, the value of parameter result is used to set the parameter msg. But set value in this way(set to an zero-based offset) is strange to me. I want thorough understanding of this function.
Thank you,
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
Oh sorry!
My MSDN must be really old
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I have checked the preface of this book. It's named Window95, a developer's guide written by Jeffrey before 1997. It's a Win32 SDK programming guide which includes several key techniques such as subclassing and superclassing, hooking etc.
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
Thanks for the info Nicholas
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Include htm, html, css, asp and so on.
thank you very much.
zl
|
|
|
|
|
|
One node at a time, probably recursively.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
So Christian, I will have to write it? There is nothing that can do the job in MSXML; give it two XML structures and to compare them. Any idea?
Thank you
Vance
|
|
|
|
|
If you are not a .NET or VB hater, here is how:
dim doc1 as XmlDocument = new XmlDocument()
dim doc2 as XmlDocument = new XmlDocument()
doc1.LoadXml("file1.xml")
doc2.LoadXml("file2.xml")
if doc1.OuterXml = doc2.OuterXml then
' the same
else
' different
end if
|
|
|
|
|
What about if the nodes are out of order, or white space
|
|
|
|
|
Ok, you need to state clearly what you mean by "compare"?
1. Do you want to check if the two files are exactly the same? You don't need XML to do that.
2. Do you want to see if the two files will generate exactly the same XML document? My sample does that.
3. Do you want to check if the two files have the same set of nodes but may be in different order, and each node may have the same number of children but may be in different order? What about attributes, you want to compare that too?
4. ...?
So what is it that you want?
|
|
|
|
|
Number 3 is what I am looking for to solve...
|
|
|
|
|
You need to write a recursive function. At least I hope you do, because that's what I ended up doing....
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
3. Do you want to check if the two files have the same set of nodes but may be in different order, and each node may have the same number of children but may be in different order? What about attributes, you want to compare that too?
A simple recursive function will probably not solve this problem. Consider the following extreme case:
< node ...>
< node ...>
< node ...>
< node ...>
...
< /node>
< /node>
...
< /node>
< node ...>
...
< /node>
< node ...>
< node ...>
< node ...>
...
< /node>
...
< /node>
< /node>
...
< /node>
That is, all nodes have the same name but its content may be different. If factor into the effort of comparing attributes (they can also be the same but in different order), camparing two nodes will be a nightmare (at least). It takes someone with your determination to do it.
What do we call the kind of problems we are too stupid to solve? NP-Complete?
|
|
|
|
|
It's pretty clear to me he does not want operator=. You can do that in C++ as easily as your VB example.
He wants to do a difference of the two XML documents, to see what is the same and what is different. That's how I read it, anyhow.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
I have CPropertySheet inside CDialog instead the control with ID - IDC_PROPSHEET_WINDOW.
I have 7 identical CPropertyPage, but with different labels.
The code of realization is given below.
But if tabs are placed more than in one line, there is the mistake of drawing connected by that the top line of tabs is visible only.
Code of realization in OnInitDialog() the following.
m_sheet.AddPage(&m_pageMyPage1);
m_sheet.AddPage(&m_pageMyPage2);
m_sheet.AddPage(&m_pageMyPage3);
m_sheet.AddPage(&m_pageMyPage4);
m_sheet.AddPage(&m_pageMyPage5);
m_sheet.AddPage(&m_pageMyPage6);
m_sheet.AddPage(&m_pageMyPage7);
m_sheet.Create(this, WS_CHILD | WS_VISIBLE);
m_sheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
TC_ITEM item;
item.mask = TCIF_TEXT;
TCHAR szText [100];
CString sTitle;
for (int i = 0; i < 7; i++)
{
sTitle.Format(_T("Long label %d"), i);
lstrcpy(szText, sTitle);
item.pszText = szText;
m_sheet.GetTabControl ()->SetItem (i, &item);
}
RECT rect;
HWND hwnd;
GetDlgItem(IDC_PROPSHEET_WINDOW, &hwnd);
ASSERT(hwnd);
if (hwnd)
{
::GetWindowRect(hwnd, &rect);
ScreenToClient(&rect);
m_sheet.SetWindowPos(NULL, rect.left, rect.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
}
Most likely a problem that at addition CPropertyPage they have small length of labels and hold in one line.
And when I change label of the tab on the text with greater long tabs occupy more than one line.
Thus control ceases correctly them to display.
One of decisions, by default in label of the template CPropertyPage to place the text of long not less maximal length of the future label, then all is drawn normally.
Whether there are some more decisions of this problem?
Best regards,
Eugene Pustovoyt
|
|
|
|