Is there a way to secure the windows mobile so that it will not accept other SD Card Storage except for the one that is registered on that device? I am thinking that it is possible if I can Get the SD Card Serial Number. How to get Serial Number of Memory Card using VB.net Mobile? I can do this in windows-based app but can't find a way in Windows-Mobile... Need help.
For Each drive As DriveInfo In My.Computer.FileSystem.Drives
If drive.IsReady = True AndAlso drive.DriveType = IO.DriveType.Removable Then
Dim fso As Scripting.FileSystemObject
Dim oDrive As Scripting.Drive
fso = CreateObject("Scripting.FileSystemObject")
oDrive = fso.GetDrive(drive.Name)
Dim serialnumber = oDrive.SerialNumber
End if
Next
Related
I am using Agilent 34410A DMM for bunch of measuriments. I want to get the measurement data in the device via Excel VBA on ethernet port.
I can control device but whenever read I get timeout.
Where am I wrong.
Sub digread()
Dim IOaddress As String
Dim ReplyString As String
Dim a As Variant
'These variable are neccessary to initialize the VISA COM.
'Dim ioMgr As KeysightRMLib.SRMCls
' Dim ioMgr As .FmtdIOCls
Dim ioMgr As VisaComLib.ResourceManager
Dim Instrument As VisaComLib.FormattedIO488
' The following command line provides the program with the VISA name of the
' interface that it will be communication with.
' It is currently set to use GPIB to communicate
'Ioaddress = "GPIB0::5::INSTR"
' Use the following line for LAN communication (Connect "34410A", "TCPIP1::192.168.1.37::inst0::INSTR", "34410 Digital Multimeters / 2.35")
IOaddress = "TCPIP0::192.168.1.37::5025::SOCKET"
' "TCPIP1::192.168.1.37::5025::SOCKET", "34410 Digital Multimeters / 2.35")
' use the following line instead for USB communication
' IOaddress = "USB0::2391::1799::US00000002"
' Initialize the VISA COM communication
Set ioMgr = New VisaComLib.ResourceManager
Set Instrument = New VisaComLib.FormattedIO488
Set Instrument.IO = ioMgr.Open(IOaddress, NO_LOCK, 2000)
'Instrument.IO.Timeout = 3000
Instrument.WriteString ("READ?\n")
a = Instrument.ReadString() ' here timeout occours
I am having trouble getting the operatingsystem property for computers in Active Directory(AD). Here is the code I am having trouble with and the function that gets the property from AD. The hostname works perfectly but the OS_Name displays a blank message box.
Alternatively, I would also like help formatting the filter to make things easier down the road. My goal is to check the operating system and only process the Windows 10 Enterprise and Windows 7 Enterprise operating systems but I can't even display the operating system in a message box. Please help.
Dim enTry As DirectoryEntry = New
DirectoryEntry("GC://my.work.com/DC=AB27,DC=my,DC=work,DC=com")
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
mySearcher.Filter = ("(objectClass=computer)")
mySearcher.PropertiesToLoad.Add("dNSHostName")
mySearcher.PropertiesToLoad.Add("operatingSystem")
Dim ds As SearchResult
For Each ds In mySearcher.FindAll()
Dim OS_Name As String = GetProperty(ds, "operatingSystem")
Dim hostName As String = GetProperty(ds, "dNSHostName")
MessageBox.Show(hostName)
MessageBox.Show(OS_Name)
Next
Function GetProperty(ByVal searchResult As SearchResult, ByVal
PropertyName As String)
If searchResult.Properties.Contains(PropertyName) Then
Return searchResult.Properties(PropertyName)(0).ToString()
Else
Return String.Empty
End If
End Function
I expect the message for the operating system to display the operating system property. Instead it displays a blank message box.
When I use debug.writeline instead of a message box it leaves a blank line between each hostname as if it reads the OS but just adds a line to hold the space.
Not sure what is in your DirectoryEntry nor if why you have structured your filter is causing a problem but the following shows me my hostname and operating system...
Dim enTry As DirectoryEntry = New DirectoryEntry
Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
mySearcher.PropertiesToLoad.Add("dNSHostName")
mySearcher.PropertiesToLoad.Add("operatingSystem")
mySearcher.PropertiesToLoad.Add("operatingSystemVersion")
mySearcher.Filter = "(&(objectClass=computer)(operatingSystem=*server*))"
Dim resEnt As SearchResult
For Each resEnt In mySearcher.FindAll()
Dim OS_Name As String
Dim hostName As String
hostName = GetProperty(resEnt, "dNSHostName")
OS_Name = GetProperty(resEnt, "operatingSystem")
Next
I have the code below to send mail from a VBA macro using CDO. I get an error in the code:
Transport failed To connect to server Error
I am sending a mail from the Gmail SMTP service. Looks like the configuration is set correctly, but somehow it doesn't work.
Sub Email()
Dim CDO_Mail As Object
Dim CDO_Config As Object
Dim SMTP_Config As Variant
Dim strSubject As String
Dim strFrom As String
Dim strTo As String
Dim strCc As String
Dim strBcc As String
Dim strBody As String
strSubject = "Results from Excel Spreadsheet"
strFrom = "xxx#gmail.com"
strTo = "xxx#gmail.com"
strBody = "The total results are: 167"
Set CDO_Mail = CreateObject("CDO.Message")
Set CDO_Config = CreateObject("CDO.Configuration")
CDO_Config.Load -1
Set SMTP_Config = CDO_Config.Fields
With SMTP_Config
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxx#gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxx"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Update
End With
With CDO_Mail
Set .Configuration = CDO_Config
End With
CDO_Mail.Subject = strSubject
CDO_Mail.From = strFrom
CDO_Mail.To = strTo
CDO_Mail.TextBody = strBody
CDO_Mail.Send
End Sub
That code works totally fine for me (send from Gmail to Gmail) - so you need to check the following:
try it with port 587 as well as port 465 (further reading)
configure your sending account in Gmail for Access for less secure apps - there is a Turn On option per the following support page
Allowing less secure apps to access your account
Google may block sign-in attempts from some apps or devices that do not use modern security standards. Since these apps and devices are easier to break into, blocking them helps keep your account safe.
Some examples of apps that do not support the latest security standards include:
The Mail app on your iPhone or iPad with iOS 6 or below
The Mail app on your Windows phone preceding the 8.1 release
Some Desktop mail clients like Microsoft Outlook and Mozilla Thunderbird
...
Option 2: Change your settings to allow less secure apps to access your account. We don't recommend this option because it might make it easier for someone to break into your account. If you want to allow access anyway, follow these steps:
Go to the "Less secure apps" section in My Account.
Next to "Access for less secure apps," select Turn on. (Note to Google Apps users: This setting is hidden if your administrator has locked less secure app account access.)
CDO is pretty old now so assume that is an example of an app that doesn't support latest security standards.
Directshow Audio/Video Capture
In VB.Net, I can capture the video from connected device, but unable to recieve any sound, as speakers are connected. I can play movies and mp3s from MediaPlayer. But, confused, why the sound is not coming. Please guide me to set audio filters in the following code. Please help, kindly make relevant changes in the following code...
Public Function FindCaptureDevice() As IBaseFilter
Debug.WriteLine("Start the Sub FindCaptureDevice")
Dim hr As Integer = 0
Dim classEnum As IEnumMoniker = Nothing
'Dim classEnum1 As IEnumMoniker = Nothing
Dim moniker As IMoniker() = New IMoniker(0) {}
Dim source As Object = Nothing
Dim devEnum As ICreateDevEnum = CType(New CreateDevEnum, ICreateDevEnum)
hr = devEnum.CreateClassEnumerator(FilterCategory.VideoInputDevice, classEnum, 0)
DsError.ThrowExceptionForHR(hr)
Marshal.ReleaseComObject(devEnum)
If classEnum Is Nothing Then
Throw New ApplicationException("No video capture device was detected.\r\n\r\n" & _
"This sample requires a video capture device, such as a USB WebCam,\r\n" & _
"to be installed and working properly. The sample will now close.")
End If
If classEnum.Next(moniker.Length, moniker, IntPtr.Zero) = 0 Then
Dim iid As Guid = GetType(IBaseFilter).GUID
moniker(0).BindToObject(Nothing, Nothing, iid, source)
Else
Throw New ApplicationException("Unable to access video capture device!")
End If
Marshal.ReleaseComObject(moniker(0))
Marshal.ReleaseComObject(classEnum)
Return CType(source, IBaseFilter)
End Function
I am developing with vb.net to print barcode label using Brother Printer PT 98OOPCN. I am using Network Shared, not Peer to Peer.
There is my code
Dim objDoc As bpac.Document
objDoc = CreateObject("bpac.Document")
Dim PrinterName As String = "\\hostprinterserver\printer1"
If (objDoc.Open("Label_Barcode\Label_Ex.lbx")) Then
objDoc.GetObject("dateObject").Text = "10/23/2012"
objDoc.GetObject("barcodeObject").Text = "100123239734"
objDoc.SetPrinter(PrinterName, True)
objDoc.StartPrint("", PrintOptionConstants.bpoDefault)
objDoc.PrintOut(1, PrintOptionConstants.bpoDefault)
objDoc.EndPrint()
objDoc.Close()
End If
Is it possible to print with Brother SDK to Network Shared Printer?
if it is possible how to do that think?
Dim PrinterName As String = "printer1 on hostprinterserver'sIP"
For instance:
Dim PrinterName As String = "Brother PT-9600 on 192.168.1.45"
It worked for me!