Posts tagged ‘Eventhandlers’

Its late. You’ve been scouring the web for that perfect present for your Aunt Bess in Idaho. You finally find it at presents4aunties.com. The site looks a little rough on the edges, weird colors and such. But they have that gift you know will make Aunt Bess add you to her will. You purchase the gift, log off and head to bed. Tired but happy.

The next day, coffee in hand, you turn on your computer. That’s strange you say, its awfully slow this morning. Finally its booted and ready to go. You open your browser to check the Cow Tipping Blog for the latest posts.
What’s this you say, My Homepage is now longer the Log , but a site trying to sell me a DVD of the Surfs vs the Terminator!
Oh well you say, not quite fully awake. You type in the URL for your Log and wait. And wait, and wait. Finally its up! You start to read the mornings postings. You’re into the second post about the upcoming Cow Tipping Championship in Vegas when a Popup appears and says you need to go to heartburn.com for the new revolutionary cure for heartburn. Click here now it says and receive a free gift, the secret cure for Baldness!

Weird you think, you click the X to close it.

You don’t realize by clicking the X that a small hidden piece of code has just been downloaded to your computer.
You finish the Log postings and decide to check your Bank Account. You type in the URL and wait, and wait. Finally the Bank Logon appears. You log in, completely unaware of the code, which is actually a Key logger, is recording your every keystroke. The Transaction is there for Aunties gift, you’re so happy. You log off and remember you forgot to email that document for your Boss. That’s ok you say, I can log in from here and send it! Technology is so great ! You log into your work portal and access your email program, find the document, attach it to the email form and send it. You vaguely remember it had something to do with the updated personal info list for all of the employees at your job. It includes their Addresses, email addresses and Direct Deposit Account numbers, also their Logon Names and Passwords to access the Computers at work.

Darn you say as another Popup appears, what’s wrong with this computer?

Well at least you didn’t forget the Bosses Document. Wouldn’t want to get in trouble with the Boss. You’ve a great job, working for the Trans Global Bank after all. Offices all over the world don’t you know.

Well time to check your Anti-Virus program for updates. Hmm it says no updates kneed ed . You notice the Misspelling but what the heck, those things happen. Gee the computer is really slow! You decide to reboot, hoping that will fix it. Gripes, now it wont even boot! At least there’s a little extra money in the ole Bank Account to get it fixed.

The above is fiction. No animals were harmed. But its scary huh to think it could happen.
Granted it’s a worse case scenario, but I wonder…

Be smart out there people, learn how to use your Anti-Virus and Anti-Spyware programs. Keep em updated, and it they don’t work well for your surfing habits, find programs that will. Keep your computer protected, your well being may depend on it.

There is a good chance that if you are actively online with your computer system that in some way spyware will get installed. All it takes is just clicking on the wrong site or by signing up for some web programs. Pretty much everyday there is a new form of spyware that has been created by someone or some company that is seeking information. Also with the easy availability of high speed internet services it has made the spread of spyware even faster and easier.

Spyware was originally designed to monitor and transmit back information to its “home” or creator without the user’s knowledge sometimes. This data would used to send back advertising ads usually popup to your computer. Over time spyware has changed and grown and now it has four biggest types of “malicious software” and threat to computers worldwide along with viruses, Trojans and worms.

So what are the major dangers with spyware running in the back ground on your computer system?
To start spyware can cripple your computer and slow your computer to a crawl this is due to the way installs itself and configured to start whenever you boot up your computer system and runs all the time. The spyware steals both your computer resources and also your computer internet bandwidth. If network with multiple computers like a small business or home based business then the infected system with spyware can cause the over all network to slow down.

Another issue with spyware is the danger of invasion of privacy. Remember that these programs can collect all types of data from you computer system and then send back to its creator. Spyware usually collects information that can be used for advertising, marketing to see what websites you visit on a frequent bases. However there is a always that potential to user spyware to collect personal information such as financial, credit card and personal ID the purpose of identity thief or to gain access to those accounts along with email accounts and address books for spam purposes.

The latest way to infest you computer system have gotten even worse by using a bot net. This is where a computer or group of computers with a bot or “robot” software that works together to launch attacks on other computers to infect them with spyware. These bot nets currently focus more installing spyware programs on targeted victim computers.

Some of the most common forms of spyware are Bargain Buddy, Gain, b3b projector, Gator, n-Case, SaveNow, Search Toolbar, Webhancer and Search Assistant. These are just some the current spyware out today which can be difficult to uninstall toolbars to hijackers that take over you home page and pop-up windows generators.

Promoters of spyware or Adware say that they are doing nothing wrong because in some cases you agree to the terms of the service or EULA which states that you will provide this information to these companies.

Usually spyware will store files on your computer from a few cookies to .dll files and registry entries installed on your computer. Spyware is like another type of programs on your computer and when they run it used your computers systems memory and processor to keep it running which ties up valuable system resources on your computer.

Although some people may not mind generating data for these companies but even if it is the friendliest type of spyware these types of programs can lead to issue and can even compromise the computer security.

In my experience as an IT professional that on some systems that are so infected with spyware the only way to get the computer running normally was to completely reinstall the operating system because if a system is that impacted it takes hours and hours to remove the spyware and even then some of the worse types might still be on the computer.

Spyware along with other malicious software can cause serious issues and problems with how your computer operates and although there are some spyware removal program that you can run that will help protect and remove these types of programs. A couple of programs that I recommend are Ad-Aware from Lava Soft and Spyware Doctor 3.2 from PC tools. But even with these programs I always recommend the full backup of your computer system because there are still other malicious software program and hardware issue such as hard drive failures that can occur. By running regular backups on your computer system you ensure the protection of your data.

In conclusion spyware on your computer can be a lot of trouble for the person computer or if you operate a small business or home office. The best idea is to keep your computer system free of spyware and to run software protection just incase your computer is imfected.

Hopefully this article has been informative and helpful to you. If you’re looking for more Business computing information and solutions then be sure to check our website listed below.

WithEvents and Handles clause requires form us to declare the object variable and the event handler as we write our code, so linkage is created upon compilation. On the other hand, with AddHandler and RemoveHandler, linkage is created and removed at runtime, which is more flexible.

Let’s assume that we want to load several MDI child forms, allowing each of them to be loaded only once, and of course to know when one of the child forms is closed. Since we have several forms to load we would like to use the AddHandler and RemoveHandler keywords so we can be flexible and write the minimal code we can.

Let’s get dirty.

1. In each MDI child form we have to declare a public event.
Public Event FormClosed(ByVal f As Form)

2. In each MDI child form we have to use the Form_Closed method which handles the MyBase.Closed class and raise the FormClosed event.

Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Closed
RaiseEvent FormClosed(Me)
End Sub

3. On our MDI form we need to declare two member variables. The first’s of type Form and the second’s type is ArrayList.
Private m_f(0) as Form
Private m_sLoadedChildForms As New ArrayList

4. We need to implement a method the will search the MDI child forms that are loaded. We’ll also use this method when we unload the MDI child forms.

Private Function SearchChildForm(ByVal strSearchForm As String, _Optional ByVal idxEventHandler As Long = -1) As Long
Dim i As Long = 0
For i = 0 To m_sLoadedForms.Count – 1
If m_sLoadedForms.Item(i) = strSearchForm Then
Dim j As Long = 0
For j = m_f.GetLowerBound(0) To m_f.GetUpperBound(0)
If m_f(j).Name = strSearchForm Then idxEventHandler = j
Next j
Return i
End If
Next
Return -1
End Function

5. We need to implement a method to load the mdi child forms and use the SearchChildForm method in order not to load the same mdi child form second time.

Private Sub LoadChildForms(ByVal f As Form)
If m_f.GetUpperBound(0) > 0 Then
ReDim Preserve m_f(m_f.GetUpperBound(0) + 1)
End If
m_f(m_f.GetUpperBound(0)) = f I
f Not SearchChildForm(m_f(m_f.GetUpperBound(0)).Name()) >= 0 Then
m_f(m_f.GetUpperBound(0)).MdiParent = Me
AddHandler m_f(m_f.GetUpperBound(0)).Closed, _
AddressOf UnloadChildForm
m_f(m_f.GetUpperBound(0)).Show()
m_sLoadedChildForms.Add(m_f(m_f.GetUpperBound(0)).Name)
Else
If m_f.GetUpperBound(0) > 0 Then
ReDim Preserve m_f(m_f.GetUpperBound(0) – 1)
End If
End If
End Sub

6. At last we need to implement a method to take out our mdi child form from the array list so we can load it again if we want.

Private Sub UnloadForm(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim i As Long
Dim s As String = sender.GetType().Name
Dim IndexForEventHandler = -1
i = SearchChildForm(s, IndexForEventHandler)
If i >= 0 Then m_sLoadedForms.RemoveAt(i)
If IndexForEventHandler >= 0 Then
RemoveHandler m_f(IndexForEventHandler).Closed, AddressOf UnloadForm
m_f(IndexForEventHandler) = Nothing
End If
End Sub