Kana Dynamic IP Updater

Latest version: 3.1.0.15, beta version: 3.2.0.17

Windows Message

Question:

Can I get the messages broadcasted by Kana Dynamic IP Updater after an update or everytime its checking the IP address?

Answer:

After checking IP address and doing an update, Kana Dynamic IP Updater broadcasts Windows’ message to all top-level windows in the system. The message is broadcasted through POSTMESSAGE command. The structure and the name of the broadcasted message is explained below.

Message Name

The name of the message broadcasted by Kana Dynamic IP Updater is:

  • After checking IP address: DYNDNS_UPDATER_CURRENT_IP
    The message contains current IP address as detected by Kana Dynamic IP Updater
  • After update: DYNDNS_UPDATER_UPDATED_IP
    The message contains updated IP address.

Message Command

The message is broadcasted by Kana Dynamic IP Updater by using the following command:

PostMessage(HWND_BROADCAST, Message_Name, wparam, lparam)

  • the lower part of wparam contains the first part of IP address.
  • the higher part of wparam contains the second part of IP address.
  • the lower part of lparam contains the third part of IP address.
  • the higher part of lparam contains the last part of IP address.

So, the IP address can be recovered by using WParamLo.WParamHi.LParamLo.LParamHi.

Code Snippet

The following code snippet in Delphi shows how to get the IP address:

const
	Msg_Updated_IP = 'DYNDNS_UPDATER_UPDATED_IP';
	Msg_Current_IP = 'DYNDNS_UPDATER_CURRENT_IP';

var
	CurrentIPMsg : Cardinal;
	UpdatedIPMsg : Cardinal;

procedure TForm1.FormCreate(Sender: TObject);
begin
	CurrentIPMsg := RegisterWindowMessage(PChar(Msg_Current_IP));
	UpdatedIPMsg := RegisterWindowMessage(PChar(Msg_Updated_IP));
	Application.OnMessage := UserMessageHandler;
end;

procedure TForm1.UserMessageHandler(var MsgRec: TMsg;
	var fHandled: Boolean);
var
	IP1 : Word;
	IP2 : Word;
	IP3 : Word;
	IP4 : Word;
begin
	if (MsgRec.message = CurrentIPMsg) or
		(MsgRec.message = UpdatedIPMsg) then begin
		IP1 := LoWord(MsgRec.wParam);
		IP2 := HiWord(MsgRec.wParam);
		IP3 := LoWord(MsgRec.lParam);
		IP4 := HiWord(MsgRec.lParam);
		if MsgRec.message = CurrentIPMsg then
			EditCurIP.Text := Format('%d.%d.%d.%d', [IP1, IP2, IP3, IP4])
		else if MsgRec.message = UpdatedIPMsg then
			EditUpdIP.Text := Format('%d.%d.%d.%d', [IP1, IP2, IP3, IP4]);
		fHandled := True;
	end;
end;
  • Email this page
  • Print this page
  • A  A  A

Post a Comment

Leave your comment below
The comment is moderated. Only comments related to the post will be accepted.
Your name
Email address
Your comment

Read Comments No comment yet Comment feed

No comments yet.
  • Back to top
  • Last updated: Friday, December 10, 2010 10:24 pm
Printed:
Beta
You can get this information from:
http://www.kanasolution.com/products/dyndns-updater/dyndns-faqs/windows-message/
Close this window
Email This Information
To send the message, please fill the form below
Email To
Subject
Message
Your Email
Validation

Please enter the text on the following image in the verification box below. Click here if you cannot read the text. All alphabets are in upper case.

Verification image