Community
Showing results for 
Search instead for 
Do you mean 
Reply

Updating dll on the fly!

Accepted Solution Solved
Copper Super Contributor
Posts: 71
Country: Canada
Accepted Solution

Updating dll on the fly!

[ Edited ]

Hello Forum,

 

I am a bad developer haha so I am hoping someone can help me with this. I created a .dll that when put in the plugins folder renames one of the menu items in ACT! to something different. Heres my questions, I want to make it more dynamic so that a user can login into ACT! go to say the tools menu click a button that says Rename Menu for example, then a window pops up where you can type in what you want to change the menu Item to, when they press ok it then updates the dll to rename the menu item to what ever they typed in. That way they can change the menu item if they want and I do not have to create a new dll each time to put in the plugins folder. So what I am looking for really is a way to add a menu item that when clicked pops open a window with a text box where a user can type in some text, that text will then be sent to my other dll which will set the value of a string to that value. I already have the code to rename the menu item based on a strings value I just need that other stuff. Any help is greatly appreciated.

 


Accepted Solutions
Solution
Accepted by topic author MattRobillard
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Please HELP! Updating dll on the fly!

Why not save the menu string to a text file on the hard drive. This way you can save any user changess to a file then recall the file when you get loaded the next time ACT restarts

 

    Public Shared Function GetTextFromFile(ByVal FullPath As String) As String

        Dim strContents As String
        Dim objReader As StreamReader
        Try

            objReader = New StreamReader(FullPath)
            strContents = objReader.ReadToEnd()
            objReader.Close()
            Return strContents

        Catch Ex As Exception
            Throw Ex
        End Try

    End Function

    Public Shared Function SaveTextToFile(ByVal strData As String, ByVal FullPath As String) As Boolean

        'Dim Contents As String
        Dim bReturnValue As Boolean = False
        Dim objReader As StreamWriter
        Try
            objReader = New StreamWriter(FullPath)
            objReader.Write(strData)
            objReader.Close()
            bReturnValue = True

        Catch Ex As Exception
            Throw Ex
        End Try

        Return bReturnValue

    End Function

 

-- Jim Durkin

 

 

 

 

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Please HELP! Updating dll on the fly!

I'm certain there are probably a plehtora of ways this could potentially be accomplish, but the first thing that comes to my mind is using your existing dll to call a windows form app and just pass in the string value from a text box as a parameter to you're method that creates the menu item. At this point could either set a flag to change the behavior of the existing menu item, or remove it and replace it with the newly named one.

Matthew Wood
Act! SDK Support
Community Moderator
Copper Super Contributor
Posts: 71
Country: Canada

Re: Please HELP! Updating dll on the fly!

That makes sense, unfortunetly I have no clue how to do any of that, any developers that can give me some guidance I can pay you for your time I just need some help im lost.

Solution
Accepted by topic author MattRobillard
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Please HELP! Updating dll on the fly!

Why not save the menu string to a text file on the hard drive. This way you can save any user changess to a file then recall the file when you get loaded the next time ACT restarts

 

    Public Shared Function GetTextFromFile(ByVal FullPath As String) As String

        Dim strContents As String
        Dim objReader As StreamReader
        Try

            objReader = New StreamReader(FullPath)
            strContents = objReader.ReadToEnd()
            objReader.Close()
            Return strContents

        Catch Ex As Exception
            Throw Ex
        End Try

    End Function

    Public Shared Function SaveTextToFile(ByVal strData As String, ByVal FullPath As String) As Boolean

        'Dim Contents As String
        Dim bReturnValue As Boolean = False
        Dim objReader As StreamWriter
        Try
            objReader = New StreamWriter(FullPath)
            objReader.Write(strData)
            objReader.Close()
            bReturnValue = True

        Catch Ex As Exception
            Throw Ex
        End Try

        Return bReturnValue

    End Function

 

-- Jim Durkin

 

 

 

 

Copper Super Contributor
Posts: 71
Country: Canada

Re: Please HELP! Updating dll on the fly!

That did the trick, thanks!

Copper Super Contributor
Posts: 59
Country: USA

Re: Please HELP! Updating dll on the fly!

And if you want to simplify and use .net methods to read and write the file, you can use:

 

System.IO.File.ReadAllText(path)

System.IO.File.WriteAllText(path,contents)

Hugo Vale
Datastream Custom Solutions
http://www.datastreamcs.com