|
We use PCs for "Cash Registers" with cash drawer pole display receipt printer what not.
And yeah, we were looking at imaging etc, but it just seemed like far too much effort for our 40 machines.
And I have it in the build instructions to make the change to this and many other settings. But with 10 pages of instructions it gets missed (a management issue), and we kludge in things all the time to prevent the user from fouling things up. So automatically handling it is appealing. But I was review 'notifications' in the area and it looks more complicated. I just want all notification OFF, doesn't appear that is a simple setting in the registry are.
Because these machines will be disconnected from the internet and win 10 hates that. Having the items in code ensures uniformity, whereas with humans. ugh
Thanks for the help, I did find several things and am testing.
|
|
|
|
|
You might glean some further ideas from windows 10 kiosk - Google Search[^]. I have not used this for many versions but it used to basically lock down the machine and run your desired app only.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am developing a program in vb.net to monitor and keep a record of all copied files using the fswatcher class. The program runs well without any bug but gives not output after running.
please help, this is what I have tried.
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Public watchfolder As FileSystemWatcher
Dim watchers As FileSystemWatcher()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btn_startwatch.Click
watchfolder = New System.IO.FileSystemWatcher()
Dim drives As String() = System.IO.Directory.GetLogicalDrives()
watchers = New FileSystemWatcher(drives.Length - 1) {}
Dim i As Integer = 0
For Each strDrive As String In drives
Dim df As New DriveInfo(strDrive)
If Not df.IsReady Then
Continue For
End If
watchfolder.Path = strDrive
watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.FileName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Attributes
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.CreationTime
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastAccess
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Security
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastWrite
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Size
AddHandler watchfolder.Changed, AddressOf logchange
AddHandler watchfolder.Created, AddressOf logchange
AddHandler watchfolder.Deleted, AddressOf logchange
AddHandler watchfolder.Renamed, AddressOf logrename
watchfolder.EnableRaisingEvents = True
btn_startwatch.Enabled = False
btn_stop.enabled = True
Next
End Sub
Private Sub logchange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
folderactivity.Text &= "file" & e.FullPath & "has been modified" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Created Then
folderactivity.Text &= "file" & e.FullPath & "has been created" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Deleted Then
folderactivity.Text &= "file" & e.FullPath & "has been deleted" & vbCrLf
End If
End Sub
Private Sub logrename(ByVal source As Object, ByVal e As System.IO.RenamedEventArgs)
folderactivity.Text &= "file" & e.OldName & "has been renamed to" & e.Name & vbCrLf
End Sub
Private Sub btn_stop_Click(sender As Object, e As EventArgs) Handles btn_stop.Click
watchfolder.EnableRaisingEvents = False
btn_startwatch.Enabled = True
btn_stop.Enabled = False
End Sub
End Class
|
|
|
|
|
You are setting the properties of your watchfolder instance instead those of the watchers list items. So only the last drive is watched.
Solution: Set the properties of your watchers list items and remove the watchfolder . Don't forget to iterate over the list in the stop button handler.
You are setting the path to the drive root but did not specify the FileSystemWatcher.IncludeSubdirectories Property (System.IO)[^]. So you will be only notified about changings in the root directory.
Solution: Set the IncludeSubdir property.
|
|
|
|
|
Thanks for the feedback, am quite new to visual basic so please if you don't mind is there a way you could break down the code more? Please
|
|
|
|
|
Most is already there. Create a list of file system watchers and add the watchers to that list:
Dim watchers As New List(Of FileSystemWatcher)()
Dim watchfolder As New System.IO.FileSystemWatcher()
watchfolder.Path = strDrive
watchers.Add(watchfolder)
For Each watchfolder In watchers
watchfolder.EnableRaisingEvents = False
Next It would be also a good idea to perform the initialisation only once at program start (without enabling the raise of events) and enabling the events in the start button handler (like in the above snippet for stopping).
A final tip:
If you have multiple drives I suggest to exclude the system drive (probably C:\) for testing and change files on the other drives because you will have a lot of notifications for your user directory, the project folder (when building), and the system folders (Windows background activities).
|
|
|
|
|
This is what I have done ,am not sure if it's what you had in mind
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Public watchfolder As FileSystemWatcher
Public watchers As New List(Of FileSystemWatcher)()
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btn_startwatch.Click
Dim drives As String() = System.IO.Directory.GetLogicalDrives()
Dim watchfolder = New System.IO.FileSystemWatcher()
Dim i As Integer = 0
For Each strDrive As String In drives
Dim df As New DriveInfo(strDrive)
If Not df.IsReady Then
Continue For
End If
watchfolder.Path = strDrive
watchers.Add(watchfolder)
watchfolder.NotifyFilter = IO.NotifyFilters.DirectoryName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.FileName
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Attributes
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.CreationTime
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastAccess
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Security
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.LastWrite
watchfolder.NotifyFilter = watchfolder.NotifyFilter Or IO.NotifyFilters.Size
AddHandler watchfolder.Changed, AddressOf logchange
AddHandler watchfolder.Created, AddressOf logchange
AddHandler watchfolder.Deleted, AddressOf logchange
AddHandler watchfolder.Renamed, AddressOf logrename
watchfolder.EnableRaisingEvents = True
btn_startwatch.Enabled = False
btn_stop.Enabled = True
Next
End Sub
Private Sub logchange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)
If e.ChangeType = IO.WatcherChangeTypes.Changed Then
folderactivity.Text &= "file" & e.FullPath & "has been modified" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Created Then
folderactivity.Text &= "file" & e.FullPath & "has been created" & vbCrLf
End If
If e.ChangeType = IO.WatcherChangeTypes.Deleted Then
folderactivity.Text &= "file" & e.FullPath & "has been deleted" & vbCrLf
End If
End Sub
Private Sub logrename(ByVal source As Object, ByVal e As System.IO.RenamedEventArgs)
folderactivity.Text &= "file" & e.OldName & "has been renamed to" & e.Name & vbCrLf
End Sub
Private Sub btn_stop_Click(sender As Object, e As EventArgs) Handles btn_stop.Click
For Each watchfolder In watchers
watchfolder.EnableRaisingEvents = False
btn_startwatch.Enabled = True
btn_stop.Enabled = False
Next
End Sub
End Class
|
|
|
|
|
I had nothing in mind. It is your project and you should know what you want to do.
But think about this:
Is it logical to call watchers.Add(watchfolder) first and then set the watchfolder properties?
If you - as a beginner - use existing code as base and want to modify it, it is essential that you understand what the existing code is doing. Then define your requirements (here: multiple watchers) and think about how this can be done (I suggested a list but there are also other solutions like an array).
Also always read the documentation of the used functions and classes. It helps understanding what the function is doing, contains usually example code, and often - most important - notes about what must be considered when using it. Here it is for example (as already noted by Dave):
Quote: The Windows operating system notifies your component of file changes in a buffer created by the T:System.IO.FileSystemWatcher. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer with the P:System.IO.FileSystemWatcher.InternalBufferSize property is expensive, as it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small yet large enough to not miss any file change events. To avoid a buffer overflow, use the P:System.IO.FileSystemWatcher.NotifyFilter and P:System.IO.FileSystemWatcher.IncludeSubdirectories properties so you can filter out unwanted change notifications. So watching a complete drive - especially the system drive - will not work as expected.
|
|
|
|
|
This isn't going to work as you expect.
The FSW wasn't really built to watch entire drives. When you get a larger number of changes, like copying thousands of files, it WILL miss files, especially while watching an entire drive.
Read the Remarks section of the FileSystemWatcher documentation[^] for more infomration.
|
|
|
|
|
Is there another way to track files copied to an external drive,(say USB for instance)?
|
|
|
|
|
You actually have no way of knowing that a copy operation is taking place.
A copy operation is nothing but a process opening a file for read and opening another file for write. The process then just reads a block of bytes from one file and writes that block of bytes to the other.
The Last Modified date is updated by the file system on the file being written. Once the operation is finished, the files are closed and the file system updates the Last Modified date on the file written.
That's it, there's nothing special about a file copy. It's no different from an app just writing whatever it needs to to a file on the same disk, say when Notepad saves a file. You can't tell the difference.
All you can tell is that a file was written to the disk. You have no way of knowing why that file was written.
|
|
|
|
|
Do not know if this is applicable but I found this in a search on the internet.
It sounds rather dangerous but perhaps it will help. Search on
Microsoft docs "File System Filter Drivers" which looks like a kernel level driver that may provide
what you want.
From the documentation:
A file system filter driver is an optional driver that adds value to or modifies the behavior of a file system. A file system filter driver is a kernel-mode component that runs as part of the Windows executive.
A file system filter driver can filter I/O operations for one or more file systems or file system volumes. Depending on the nature of the driver, filter can mean log, observe, modify, or even prevent. Typical applications for file system filter drivers include antivirus utilities, encryption programs, and hierarchical storage management systems
Information I found indicates this is not easy to implement. Again, unless you are experienced with
writing kernel-mode drivers (which I am not) this could be a dangerous path.
Other helpers, if I am wrong please correct me so as not to lead him astray.
|
|
|
|
|
It may not apply to "all drives"
No idea which problem is being solved, but if you have to watch all drives, I'll doubt your good intentions.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
How do i count the number of rows from the data grid view and the number of rows to make an integer . The number of rows will be save for preparation.
|
|
|
|
|
|
I suspect that English is not your first language, but this question is very unclear. Please give more information about what you are trying to achieve and we may be able to help you.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
The bigger issue is why are you still using VB6? It's been dead for quite a long time now.
Visual Studio Community Edition is free from here[^] and support VB.NET, C#, C++, ...
|
|
|
|
|
i am using a windows application to connect to a finger print scanning device.
at the moment i can connect to machine and download all the logs. (using this DLL Interop.zkemkeeper.dll)
from my PC, windows 7 32bit it is working but when i installed the application on windows server 2003
32bit i am not able to connect to reader.
i installed visual studio 2010 on server and tried to build the Application on the server to make sure no reference were missing.
but still i can not connect to the reader.
my question is why it connects and can even downloads all the logs from my pc but it doesnt work on server (windows server 2003 32bit)
reader IP 192.168.0.1 port: 4370.
Public axCZKEM1 As New zkemkeeper.CZKEM
code to connect to reader:
private sub ConnectToReader()
If txtIP.Text.Trim() = "" Or txtPort.Text.Trim() = "" Then
MsgBox("IP and Port cannot be null", MsgBoxStyle.Exclamation, "Error")
Return
End If
Dim idwErrorCode As Integer
Cursor = Cursors.WaitCursor
If btnConnect.Text = "Disconnect" Then
AxCZKEM1.Disconnect()
bIsConnected = False
btnConnect.Text = "Connect"
lblState.Text = "Current State:Disconnected"
Cursor = Cursors.Default
Return
End If
bIsConnected = AxCZKEM1.Connect_Net(txtIP.Text.Trim(), Convert.ToInt32(txtPort.Text.Trim()))
If bIsConnected = True Then
btnConnect.Text = "Disconnect"
btnConnect.Refresh()
lblState.Text = "Current State:Connected"
iMachineNumber = 1
axCZKEM1.RegEvent(iMachineNumber, 65535)
Else
AxCZKEM1.GetLastError(idwErrorCode)
MsgBox("Unable to connect the device,ErrorCode=" & idwErrorCode, MsgBoxStyle.Exclamation, "Error")
End If
Cursor = Cursors.Default
End Sub
|
|
|
|
|
Make sure you've registered the SDK on the 2003 server. Copy all of the SDK files to the %windir%\system32 folder, and then run:
regsvr32.exe %windir%\system32\zkemkeeper.dll
If that doesn't fix it, then you're going to need to tell us what errors you're getting.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you.
I copied the dll I was referring to but it didn’t work. Then I copied all the dll (5 or 6 files I think). Once I copied all those dlls now it is working.
|
|
|
|
|
Dim DateAsString As New ArrayList
this is the part i am using in form load to get all the dates for the Meeting.
private sub getalldate()
Dim connectionString As String = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=192.168.0.8"
Dim connection As SqlConnection = New SqlConnection(connectionString)
connection.Open()
Dim sql As String = "SELECT MeetingDate FROM Meetings"
Dim command As SqlCommand = New SqlCommand(sql, connection)
Dim reader As SqlDataReader = command.ExecuteReader()
If (reader.Read()) Then
If (reader.HasRows) Then
While reader.Read()
dateasstring.Add("#" & reader(0) & "#")
End While
End If
End If
reader.Close()
connection.Close()
end sub
private sub makedatesboldincalendar()
Dim num As Date
Dim dtArrSpecialDates() As Date
For Each num In dateasstring
dtArrSpecialDates = {num}
MonthCalendar1.BoldedDates = dtArrSpecialDates
Next
end sub
what happens is it makes date bold but only the last date it is getting from database. there are more than 10
entries in the Meetings table.
so, how can i highligh all the dates i am getting from database?
|
|
|
|
|
|
how can I make all the dates thats coming from the database as bold in the calendar?
|
|
|
|
|
Read the documentation and implement your code in the way shown.
|
|
|
|
|
Don't use ArrayList ; use List<DateTime> .
Don't convert the dates to strings; keep them as DateTime .
Don't loop over the array setting the BoldedDates for each element; just set the BoldedDates to the list of dates.
Don't call .Read before testing whether the data reader has any rows; you're skipping the first row.
Private AllDates As DateTime()
Private Sub GetAllDate()
Const connectionString As String = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDB;Data Source=192.168.0.8"
Const sql As String = "SELECT MeetingDate FROM Meetings"
Using connection As New SqlConnection(connectionString)
connection.Open()
Using command As New SqlCommand(sql, connection)
Using reader As SqlDataReader = command.ExecuteReader()
Dim dates As New List(Of DateTime)()
While reader.Read()
dates.Add(reader.GetDateTime(0))
End While
AllDates = dates.ToArray()
End Using
End Using
End Using
End Sub
Private Sub MakeDatesBoldInCalendar()
MonthCalendar1.BoldedDates = AllDates
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|