Notices

Water Fountain General Chit/Chat

Reply
 
LinkBack Thread Tools
Old 02-13-06, 02:01 PM   #1 (permalink)
Aximsite Prospect
 
Join Date: Feb 2006
Posts: 10
Thanked 0 Times in 0 Posts
Any way to apply the ActiveSync fix programatically?

I have about 150 of these devices. I need to change the activesync settings and also shut off some buttons. Any way to do that programatically?

I am currently running a VB.Net8.0 autoRun.exe on an SD Card that loads the CF and required dlls to the device if needed. (See attached Code below. Targeted device PocketPC 2003, running on the WM 5.0 Axim X51, works well.)

Imports System.io
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports System.Threading.Thread
Imports System.Runtime.InteropServices
Public Class AutoRun
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu

#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)
MyBase.Dispose(disposing)
End Sub

'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.
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
'
'AutoRun
'
Me.ClientSize = New System.Drawing.Size(240, 268)
Me.Menu = Me.MainMenu1
Me.Text = "Form1"

End Sub

#End Region
Friend Loc As String
Public App_Path As String
Public Memory As String
Private Declare Function CreateProcess Lib "coredll.Dll" (ByVal strImageName As String, ByVal strCmdLine As String, ByVal pProcessAttributes As IntPtr, ByVal pThreadAttributes As IntPtr, ByVal bInheritsHandle As Integer, ByVal dwCreationFlags As Integer, ByVal pEnvironment As IntPtr, ByVal pCurrentDir As IntPtr, ByVal bArray() As [Byte], ByVal oProc As ProcessInfo) As Integer

Private Sub AutoRun_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim si(128) As Byte
Dim pi As New ProcessInfo
Dim value As OperatingSystem
Dim NewRelease As Boolean
Dim Net As New DirectoryInfo("\Program Files\.NET CF 2.0")

value = Environment.OSVersion
If value.Version.Major > 4 Then
NewRelease = True
End If



If IO.File.Exists("\Windows\Start Menu\CCClark_Rss.lnk") = False Then
Cursor.Current = Cursors.WaitCursor
If IO.File.Exists("\Windows\Start Menu\Calendar.lnk") = True Then
File.Delete("\Windows\Start Menu\Calendar.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Contacts.lnk") = True Then
File.Delete("\Windows\Start Menu\Contacts.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Messaging.lnk") = True Then
File.Delete("\Windows\Start Menu\Messaging.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Home.lnk") = True Then
File.Delete("\Windows\Start Menu\Home.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Help.lnk") = True Then
File.Delete("\Windows\Start Menu\Help.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Internet Explorer.lnk") = True Then
File.Delete("\Windows\Start Menu\Internet Explorer.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Windows Media.lnk") = True Then
File.Delete("\Windows\Start Menu\Windows Media.lnk")
End If
If NewRelease = True Then
If IO.File.Exists("\SD Card\SetSecurity.exe") = True Then
CreateProcess("\SD Card\SetSecurity.exe", "", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If


Dim wfolder As String = "\Windows\"
Dim Pfolder As String = "\Program Files\"

Loc = "\SD Card\CCClark_Rss_Files"
App_Path = "\SD Card\CCCLARK\"
Memory = "\SD Card\"

'Type of file Location of file File goes to
loadwin("dll", wfolder, "\Windows\")
loadwin("xml", wfolder, "\Windows\")
loadwin("bmp", wfolder, "\Windows\")
loadwin("lic", wfolder, "\Windows\")
loadwin("dll", Pfolder, Memory & "Program Files\CCClark\")
loadwin("bmp", Pfolder, Memory & "Program Files\CCClark\My Project\")
loadwin("Ico", Pfolder, Memory & "Program Files\CCClark\")
If IO.File.Exists("\Windows\Start Menu\File Explorer.lnk") = False Then
If IO.File.Exists("\Windows\Start Menu\Programs\File Explorer.lnk") = True Then
File.Copy("\Windows\Start Menu\Programs\File Explorer.lnk", "\Windows\Start Menu\File Explorer.lnk", True)
End If
End If
If File.Exists(Memory & "Clark Resource Folder\CCClark_Rss.lnk") = True Then
File.Copy(Memory & "Clark Resource Folder\CCClark_Rss.lnk", "\Windows\Start Menu\CCClark_Rss.lnk", True)
End If
Cursor.Current = Cursors.Default
End If

If IO.Directory.Exists("\Program Files\.NET CF 2.0") = False Then
If NewRelease = True Then
If IO.File.Exists("\SD CARD\2577\NETCFv2.wm.armv4i.cab") = True Then
File.Copy("\SD CARD\2577\NETCFv2.wm.armv4i.cab", "\NETCFv2.wm.armv4i.cab", True)
CreateProcess("WCELoad.exe", "\NETCFv2.wm.armv4i.cab", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
Else
If IO.File.Exists("\SD CARD\2577\NETCFv2.ppc.armv4.cab") = True Then
File.Copy("\SD CARD\2577\NETCFv2.ppc.armv4.cab", "NETCFv2.ppc.armv4.cab", True)
CreateProcess("WCELoad.exe", "\NETCFv2.ppc.armv4.cab", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If
Else
If IO.File.Exists("\SD CARD\powerstatus.exe") = True Then
File.Copy("\SD CARD\powerstatus.exe", "powerstatus.exe", True)
CreateProcess("WCELoad.exe", "\powerstatus.exe", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If
Application.Exit()
End Sub

Sub loadwin(ByVal type As String, ByVal folder As String, ByVal tofolder As String)
Dim strfiles() As String
Dim textname As String
Dim MyA() As String
Dim x As Integer
Dim txtlocdata As String

txtlocdata = "\SD Card\Clark Resource Folder"
strfiles = System.IO.Directory.GetFiles(txtlocdata & folder, "*." & type)

Try
For Each textname In strfiles
MyA = textname.Split(CChar("\"))
x = MyA.Length - 1
If Not (File.Exists(tofolder & MyA(x))) Then
Try
File.Copy(textname, tofolder & MyA(x), True)
Catch ex As Exception
End Try
End If
Next
Catch ex As Exception
End Try
End Sub

End Class

Public Class ProcessInfo
Public Process As Integer
Public Thread As Integer
Public ProcessID As Integer
Public ThreadID As Integer
End Class 'ProcessInfo

Last edited by CDurbin; 02-13-06 at 02:06 PM.
CDurbin is offline   Reply With Quote
Sponsor Ads
Old 02-20-06, 01:43 AM   #2 (permalink)
Aximsite Minor League
 
utmatt20's Avatar
Member
 
Join Date: Jan 2006
Location: Clearfield, UT
Posts: 228
Thanked 1 Time in 1 Post

Awards Showcase
Aximsite Bronze Contributors 
Total Awards: 1

Originally Posted by CDurbin
I have about 150 of these devices. I need to change the activesync settings and also shut off some buttons. Any way to do that programatically?

I am currently running a VB.Net8.0 autoRun.exe on an SD Card that loads the CF and required dlls to the device if needed. (See attached Code below. Targeted device PocketPC 2003, running on the WM 5.0 Axim X51, works well.)

Imports System.io
Imports System.Diagnostics
Imports Microsoft.VisualBasic
Imports System.Threading.Thread
Imports System.Runtime.InteropServices
Public Class AutoRun
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu

#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)
MyBase.Dispose(disposing)
End Sub

'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.
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
'
'AutoRun
'
Me.ClientSize = New System.Drawing.Size(240, 268)
Me.Menu = Me.MainMenu1
Me.Text = "Form1"

End Sub

#End Region
Friend Loc As String
Public App_Path As String
Public Memory As String
Private Declare Function CreateProcess Lib "coredll.Dll" (ByVal strImageName As String, ByVal strCmdLine As String, ByVal pProcessAttributes As IntPtr, ByVal pThreadAttributes As IntPtr, ByVal bInheritsHandle As Integer, ByVal dwCreationFlags As Integer, ByVal pEnvironment As IntPtr, ByVal pCurrentDir As IntPtr, ByVal bArray() As [Byte], ByVal oProc As ProcessInfo) As Integer

Private Sub AutoRun_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim si(128) As Byte
Dim pi As New ProcessInfo
Dim value As OperatingSystem
Dim NewRelease As Boolean
Dim Net As New DirectoryInfo("\Program Files\.NET CF 2.0")

value = Environment.OSVersion
If value.Version.Major > 4 Then
NewRelease = True
End If



If IO.File.Exists("\Windows\Start Menu\CCClark_Rss.lnk") = False Then
Cursor.Current = Cursors.WaitCursor
If IO.File.Exists("\Windows\Start Menu\Calendar.lnk") = True Then
File.Delete("\Windows\Start Menu\Calendar.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Contacts.lnk") = True Then
File.Delete("\Windows\Start Menu\Contacts.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Messaging.lnk") = True Then
File.Delete("\Windows\Start Menu\Messaging.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Home.lnk") = True Then
File.Delete("\Windows\Start Menu\Home.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Help.lnk") = True Then
File.Delete("\Windows\Start Menu\Help.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Internet Explorer.lnk") = True Then
File.Delete("\Windows\Start Menu\Internet Explorer.lnk")
End If
If IO.File.Exists("\Windows\Start Menu\Windows Media.lnk") = True Then
File.Delete("\Windows\Start Menu\Windows Media.lnk")
End If
If NewRelease = True Then
If IO.File.Exists("\SD Card\SetSecurity.exe") = True Then
CreateProcess("\SD Card\SetSecurity.exe", "", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If


Dim wfolder As String = "\Windows\"
Dim Pfolder As String = "\Program Files\"

Loc = "\SD Card\CCClark_Rss_Files"
App_Path = "\SD Card\CCCLARK\"
Memory = "\SD Card\"

'Type of file Location of file File goes to
loadwin("dll", wfolder, "\Windows\")
loadwin("xml", wfolder, "\Windows\")
loadwin("bmp", wfolder, "\Windows\")
loadwin("lic", wfolder, "\Windows\")
loadwin("dll", Pfolder, Memory & "Program Files\CCClark\")
loadwin("bmp", Pfolder, Memory & "Program Files\CCClark\My Project\")
loadwin("Ico", Pfolder, Memory & "Program Files\CCClark\")
If IO.File.Exists("\Windows\Start Menu\File Explorer.lnk") = False Then
If IO.File.Exists("\Windows\Start Menu\Programs\File Explorer.lnk") = True Then
File.Copy("\Windows\Start Menu\Programs\File Explorer.lnk", "\Windows\Start Menu\File Explorer.lnk", True)
End If
End If
If File.Exists(Memory & "Clark Resource Folder\CCClark_Rss.lnk") = True Then
File.Copy(Memory & "Clark Resource Folder\CCClark_Rss.lnk", "\Windows\Start Menu\CCClark_Rss.lnk", True)
End If
Cursor.Current = Cursors.Default
End If

If IO.Directory.Exists("\Program Files\.NET CF 2.0") = False Then
If NewRelease = True Then
If IO.File.Exists("\SD CARD\2577\NETCFv2.wm.armv4i.cab") = True Then
File.Copy("\SD CARD\2577\NETCFv2.wm.armv4i.cab", "\NETCFv2.wm.armv4i.cab", True)
CreateProcess("WCELoad.exe", "\NETCFv2.wm.armv4i.cab", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
Else
If IO.File.Exists("\SD CARD\2577\NETCFv2.ppc.armv4.cab") = True Then
File.Copy("\SD CARD\2577\NETCFv2.ppc.armv4.cab", "NETCFv2.ppc.armv4.cab", True)
CreateProcess("WCELoad.exe", "\NETCFv2.ppc.armv4.cab", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If
Else
If IO.File.Exists("\SD CARD\powerstatus.exe") = True Then
File.Copy("\SD CARD\powerstatus.exe", "powerstatus.exe", True)
CreateProcess("WCELoad.exe", "\powerstatus.exe", IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, New [Byte](128) {}, pi)
End If
End If
Application.Exit()
End Sub

Sub loadwin(ByVal type As String, ByVal folder As String, ByVal tofolder As String)
Dim strfiles() As String
Dim textname As String
Dim MyA() As String
Dim x As Integer
Dim txtlocdata As String

txtlocdata = "\SD Card\Clark Resource Folder"
strfiles = System.IO.Directory.GetFiles(txtlocdata & folder, "*." & type)

Try
For Each textname In strfiles
MyA = textname.Split(CChar("\"))
x = MyA.Length - 1
If Not (File.Exists(tofolder & MyA(x))) Then
Try
File.Copy(textname, tofolder & MyA(x), True)
Catch ex As Exception
End Try
End If
Next
Catch ex As Exception
End Try
End Sub

End Class

Public Class ProcessInfo
Public Process As Integer
Public Thread As Integer
Public ProcessID As Integer
Public ThreadID As Integer
End Class 'ProcessInfo
Seems simple enogh.
utmatt20 is offline   Reply With Quote
Reply

Tags
activesync, apply, fix, programatically

Sponsor Ads

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:28 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright © 2003-09 LeckMedia, LLC