Click here to Skip to main content
Licence CPOL
First Posted 20 Apr 2005
Views 28,039
Bookmarked 18 times

Beam a File From Your Pocket PC Using VB.NET

By | 20 Apr 2005 | Article
How to beam a file from your Pocket PC.

Introduction

This is the code that enables you to beam a file via infrared from your Pocket PC.

Someone on a forum asked me how you beam a file with VB.NET. I couldn't find anything so I took a chance and used the actual Beam.exe to beam the file and it worked. Here's the code:

Imports System.Runtime.InteropServices
Public Class Wireless
<DllImport("CoreDll.DLL", SetLastError:=True)> _
Private Shared Function CreateProcess(ByVal imageName As String, _
                            ByVal cmdLine As String, _
                            ByVal lpProcessAttributes As IntPtr, _
                            ByVal lpThreadAttributes As IntPtr, _
                            ByVal boolInheritHandles As Int32, _
                            ByVal dwCreationFlags As Int32, _
                            ByVal lpEnvironment As IntPtr, _
                            ByVal lpszCurrentDir As IntPtr, _
                            ByVal si() As Byte, _
                            ByVal pi As ProcessInfo) As Integer
End Function
<DllImport("CoreDll.dll")> _
Private Shared Function GetLastError() As Int32
End Function
Public Shared Function CreateProc(ByVal ExeName As String, _
                              ByVal CmdLine As String, _
                              ByVal pi As ProcessInfo) As Boolean
    If pi Is Nothing Then
        pi = New ProcessInfo
    End If
    Dim si(127) As Byte
    Return CreateProcess(ExeName, CmdLine, IntPtr.Zero, _
                                     IntPtr.Zero, 0, 0, _
                                     IntPtr.Zero, _
                                     IntPtr.Zero, si, pi) <> 0
End Function 'CreateProc
End Class 'Externals
Public Class ProcessInfo
Public hProcess As IntPtr
Public hThread As IntPtr
Public ProcessId As Int32
Public ThreadId As Int32
End Class 'ProcessInfo
Wireless.CreateProc("\Windows\Beam.exe", filename, nothing)

The filename being the file that you are beaming.

Have fun!!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

VbGuru613

Web Developer

United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionWhat about BlueTooth beaming? Pinmemberbeardedfiend14:55 30 Sep '08  
Generalnice but... Pinmemberbobsugar2227:25 12 Jun '07  
GeneralRe: nice but... PinmemberVbGuru6137:34 12 Jun '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120515.1 | Last Updated 20 Apr 2005
Article Copyright 2005 by VbGuru613
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid