Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,075 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,798 people online right now. Registration is fast and FREE... Join Now!




sending msg frm pc to mobile

 
Reply to this topicStart new topic

sending msg frm pc to mobile, sending message from pc to mobile via vb.net

heena05
4 Mar, 2008 - 06:59 AM
Post #1

New D.I.C Head
*

Joined: 4 Mar, 2008
Posts: 1

vb

Imports System.messaging.MessageQueue(path="FormatName:direct=os:<machine> name>\system$;deadletter")
Public Class Form1
Inherits System.Windows.Forms.Form


#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region



csharp

public partial class Form1 : Form
{
private MessageQueue m_queue;

Public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
try
{
string deviceIP = String.Empty;
IPAddress[] addresses =
Dns.GetHostEntry("david-1").AddressList;
for (int i = 0; i < addresses.Length; ++i)
{
IPAddress addr = addresses[i];
if (addr.AddressFamily == AddressFamily.InterNetwork)
{
deviceIP = addr.ToString();
break;
}
}
if (deviceIP == String.Empty)
{
MessageBox.Show("Unable to retrieve Device IP");
Close();
return;
}

String strPath =
String.Format(@"FormatName:DIRECT=TCP:{0}\PRIVATE$\CallerID", deviceIP);
m_queue = new MessageQueue(strPath);

if (m_queue != null)
{
System.Type[] types = new Type[1];
types[0] = typeof(CallerIDClient.CallerID);
m_queue.Formatter = new XmlMessageFormatter(types);

try
{
m_queue.ReceiveCompleted += new
ReceiveCompletedEventHandler(MessageArrived);
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
Close();
}

Thread t1 = new Thread(PeekMessages);
t1.IsBackground = true;
t1.Start();
}
else
{
MessageBox.Show("Queue not created");
Close();
}
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}


private void PeekMessages()
{
while (true)
{
try
{
m_queue.BeginReceive();
}
catch (MessageQueueException ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}

public void MessageArrived(Object source, ReceiveCompletedEventArgs
args)
{
MessageQueue queue = source as MessageQueue;
Message message = queue.EndReceive(args.AsyncResult);

CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}

private void AddItem(String strID)
{
Message message = m_queue.PeekById(strID);
CallerIDClient.CallerID callerid = message.Body as
CallerIDClient.CallerID;
if (callerid != null)
{
ListViewItem lvi = new ListViewItem(callerid.Name);
lvi.SubItems.Add(callerid.Number);
listView1.Items.Add(lvi);
}
}
}

End Class


This post has been edited by PsychoCoder: 5 Mar, 2008 - 05:39 AM
User is offlineProfile CardPM
+Quote Post

bhandari
RE: Sending Msg Frm Pc To Mobile
4 Mar, 2008 - 07:05 AM
Post #2

D.I.C Addict
Group Icon

Joined: 31 Jan, 2008
Posts: 747


Dream Kudos: 900
My Contributions
code.gif
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Sending Msg Frm Pc To Mobile
5 Mar, 2008 - 05:29 AM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,032



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
What errors are you getting?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Sending Msg Frm Pc To Mobile
5 Mar, 2008 - 05:40 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Is there a question in there somewhere? Are you getting any errors? When posting a question for help, please include:


  • The code that is causing the problem
  • The error message you are receiving (if you are receiving an error)
  • If not receiving an error then provide a detailed explanation of what you are trying to do, what the code is doing, and what problem you are having

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:10PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month