another blog

Icon

About Microsoft Dynamics GP :-)

Getting the current open window in .net GP Add In

There are many ways of getting information of active window in GP, but it changes according to the developing tool we are working on.

1.Dexterity.(the best tool 🙂 <3)

2.VS Tools For Dynamics GP

2.Continuum API (and so adding reference of this API in Custom Visual Studio AddIn.)

1.Dexterity provide various function, with the help of the combination of those functions we can find the active window information. Or we can also use COM objects to do the same.All we need to do is to add a COM Type Library and then use the objects and properties.

2.VS Tools , with available dynamics objects and execute sanscript function, it’s far more easier to find active window in VSTools for Dynamics GP project then in standard visual studio application.

3.Standard Visual Studio App, even can give us clue of active window by adding continuum API reference to it. Below is a code I just tried with Visual Studio 2013.

Public Class Form1

Public GPApp As Dynamics.Application
Dim s1, s2, s3, s4 As String

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

GPApp = GetObject(“”, “Dynamics.Application”)
GPApp.GetDexActiveWindow(s1, s2, s3, s4)
MsgBox(s1)
MsgBox(s2)
End Sub
End Class

Details about this of GetDexActiveWindow() method is below.The GetDexActiveWindow() method returns 4 string parameters that tell us the Form technical name,window technical name, dictionary name and window title. Shown below is an example of this code:

Dim result As Boolean
Dim mystr1 As String
Dim mystr2 As String
Dim mystr3 As String
Dim mystr4 As String

result = eEnterpriseApp.GetDexActiveWindow(mystr1, mystr2, mystr3, mystr4)

MsgBox (“Form Name = ” & mystr1)
MsgBox (“Window Technical Name = ” & mystr2)
MsgBox (“Dictionary Name = ” & mystr3)
MsgBox (“Window Title = ” & mystr4)

 

classb

out put

There are other cool ways we can use to find active window name, title. I have used one by using batch file and command prompt commands from within Dexterity to find the active window. Good programmer use windows API to do the same. 😉  And Dexterity experts also trigger the application to provide them what they are looking for. 😀

below is the source and inspiration for this post.

inspiration

Advertisements

Filed under: Dexterity Development, Dynamics GP, dynamics-gp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: