Announcement

Collapse
No announcement yet.

Need to have a form in a vb app to pop up over the network when clicking a button.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to have a form in a vb app to pop up over the network when clicking a button.

    I have spend days trying to figure this out and I have had very little luck. See I have created a VB App in Visual Studio 2008 that has 3 forms. The purpose of this application is to be used as a notification system to all users on the network as to any computer related issues or other issues that they would need to know immediately. In the app one of the form is called "alert form" and that is the form I need to push out to all computers. The other part of the app is for IT to create the message or use one of the canned messages that I made.

    I really need some assistance in how to push this alert form out to the network. PLEASE HELP...

    I have included the coding of all three forms. The first form is The Option screen which lets you pick the priority by color and whether you want a already created statement or create a statement of your own to be send.
    It includes a send notification button on this form if you choose a already created statement. Otherwise there is a button on it to create your own statement which then opens the manual message form. After you put in your manual message there is again a send notification button.

    The send notification button then shows the scrollproject form and that is what I need to send over the network.

    I have attached the code for each form.
    Attached Files

  • #2
    Re: Need to have a form in a vb app to pop up over the network when clicking a button

    Originally posted by JenniferBarman View Post
    The purpose of this application is to be used as a notification system to all users on the network as to any computer related issues or other issues that they would need to know immediately.
    Your approach is the hard one. How about creating a simple service for the workstations that listens to a TCP/UDP traffic and displays the messages?

    Trying to display Winforms on remote a system requires (as far as I know) using psexec or some other form of trickery. Psexec uses the admin$ share to work its magic.

    Devil's advocate: what if the network crashes? How would you alert the users?

    -vP

    Comment


    • #3
      Re: Need to have a form in a vb app to pop up over the network when clicking a button

      Thank you so much for your response and so quickly!!

      Does anyone know of how I could use this psexec or/and help me understand admin/$ shares? I have full administrator rights on all systems, but I am not the best with understanding networking and how to incorporate this into my application. This would be used for letting users know if a certain system or server was down. If the network went down we would just have to call.

      Comment


      • #4
        Re: Need to have a form in a vb app to pop up over the network when clicking a button

        Alternative method..

        This script is ripped from several places and patched together for you. I did not come up with any of it (just the "taping" together). I suggest you test after hours!

        Important : You need to modify 2 lines in this code!!
        strDomain = "CHANGEME"
        strGroup = "computer"

        This is your local domain name and the AD Group to find computer names!

        Nutshell:

        1) This will first ask you for a message
        2) It will then traverse Active Directory for all computers
        3) Finally it uses WMI to run the local msg.exe file!

        Some quick notes..
        Again, This is quick and dirty.. cut and pasted in about 5 mins.. I tested it on my test domain.
        This will not work in a Terminal environment, but should work for any single user machines.

        This is also a great way to run local commands.. I use it to run bat files on remote machines without having to login to them via RDP.

        Code:
        ' --------------   somefilename.vbs ---------------
        Dim msgstr
        Sub sendmsg(strComputer)
          msg = "msg.exe console " & msgstr
          Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") 
          intReturn = objWMIService.Create(msg,,,intProcessID)
          set objWMIService = nothing
          ' You can trap for errors.. 0 = success
        End Sub
        ' --- Main Section ---
        Sub EntireDomain()
          Const ADS_SCOPE_SUBTREE = 2
          strDomain  = "CHANGEME"
          strGroup   = "computer"
          Set objConnection = CreateObject("ADODB.Connection")
          Set objCommand =   CreateObject("ADODB.Command")
          objConnection.Provider = "ADsDSOObject"
          objConnection.Open "Active Directory Provider"
          Set objCOmmand.ActiveConnection = objConnection
          objCommand.CommandText = _
              "Select Name, Location from 'LDAP://" & strDomain & "' " _
                  & "Where objectCategory='" & strGroup & "'"  
          objCommand.Properties("Page Size") = 1000
          objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
          Set objRecordSet = objCommand.Execute
          objRecordSet.MoveFirst
          Do Until objRecordSet.EOF
              Sendmsg(objRecordSet.Fields("Name").Value)
              objRecordSet.MoveNext
          Loop
        End Sub
         
        '---------
         
        msgstr = inputbox("Enter the Message you want to send","Network Message")
        if inputbox <> "" then
          EntireDomain()
        End If  
        '------------------------- End of File ---------------
        Enjoy!
        Hobie

        Comment

        Working...
        X