Microsoft Dynamics GP Technical Airlift 2013 … – MSDN Blogs

A blog dedicated to everything to enable Developing for Microsoft Dynamics GP by David Musgrave and the Microsoft Dynamics GP Developer Support Team. Search Form. Search this blog. Search all blogs. Options. Blog Home · About · Email Blog Author · Share this · RSS for posts · Atom · RSS for comments. Tags Developing for Dynamics GP on Facebook This blog at Dynamics GP Support Blog: http://aka.ms/DynamicsGP. SDT Portal: http://aka.ms/SDT

More:
Microsoft Dynamics GP Technical Airlift 2013 … – MSDN Blogs

August 27, 2013 · David Musgrave · No Comments
Tags: , , , , , , ,  · Posted in: Blogs I Follow Total Views: 319

Accessing Microsoft Dynamics GP Default Settings from Visual Studio Tools

Rarely you will hear the Dex.ini file being called the Microsoft Dynamics GP defaults file. However, the Dex.ini contains keys (and their associated values) that define how Microsoft Dynamics GP behaves in some cases. For example, SQLLastUser=sa stores the login of the last user who accessed the system on that specific instance of Microsoft Dynamics GP, in this case, ‘sa’. Likewise, AutoInstallChunks=TRUE, allows Microsoft Dynamics GP to bypass prompting the user for new code (chunk file) to be installed at the time of launching the application. There are other settings controlling how certain features behave.

You can find a list of Dex.ini settings here.

Recently, I was helping a good friend of mine up in Maine who attended my Dexterity class in Boston and this time he wanted to know how to read the path for the Microsoft Dynamics GP help file. Of course, there’s a simple (predefined) method for this as my good friend Patrick Roth with the Escalation Engineering team in Fargo pointed out, if you are familiar with some of Microsoft Dynamics GP form procedures:

string strPath = “”;
strPath = Dynamics.Forms.MainMenu.Functions.GetDynamicsHelpPath.Invoke();
MessageBox.Show(strPath);

So, let’s assume you had no clue this function existed. How would you address this issue? Frankly, I can think of at least 3 ways to do this:

1) Using a hybrid method whereby you create a Dexterity dictionary to wrap the Defaults_Read() Dexterity sanScript function into a user-defined global function. This method presents a challenge as you need to use the Dictionary Assembly Generator (DAG.EXE) to create an assembly you can reference from your VST project. In addition, you may or may not want to add an entirely new dictionary into the picture, when delivering your final solution. However, in case you are interested, this is the implementation:

GetDexIniSetting function

For more information on developing hybrid applications with Dexterity and Visual Studio Tools take a look at my articles:

Developing Microsoft Dynamics GP hybrid integrating applications
Hybrid development for the Managed Code developer
Hybrid development for the Managed Code developer (cont.)

2) You could use the Continuum API from Visual Studio Tools to access the Defaults_Read() sanScript function. The Continuum API is the Component Object Model (COM) API that is available for Microsoft Dynamics GP. The Continuum API documentation is available for download here. In this method, all you have to do is add a reference to the interop.Dynamics.dll COM library, which hosts the Continuum API.

// Created by Mariano Gomez, MVP
// This code is licensed under the Creative Commons 
// Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode

public string GetDexIniSetting(string searchKey)

   ParameterHandlerClass myParamHandler = new ParameterHandlerClass();
            
   try
    Dynamics.Application gpApp = (Dynamics.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Dynamics.Application"));
     if (gpApp == null) 
       return "";
     else
     
       string passthrough_code = "";
       string compile_err;
       int error_code, result;

       result = gpApp.SetParamHandler(myParamHandler);
       myParamHandler.IN_Key = searchKey;

       passthrough_code += "local boolean err_val;";
       passthrough_code += "local string dex_key_val, dex_key;";
       passthrough_code += @"err_val = OLE_GetProperty(""IN_Key"", dex_key); "; 
       passthrough_code += "dex_key_val = Defaults_Read(dex_key);";
       passthrough_code += @"err_val = OLE_SetProperty(""OUT_KeyVal"", dex_key_val);";

       gpApp.CurrentProductID = 0; 

       error_code = gpApp.ExecuteSanscript(passthrough_code, out compile_err);
       return myParamHandler.OUT_KeyVal;
     
   }
   catch
    MessageBox.Show("Failed to initialize gpApp");
     return "";
   
 }

public class ParameterHandlerClass

  public string IN_Key  get; set; 
  public string OUT_KeyVal  get; set; 
}

In the above code, we define a parameter handler class
with couple properties for the key that will be read from the Dex.ini and the key value to be retrieved.

In our GetDexIniSettings method, we instantiate our class and use the Continuum SetParaHandler() method to load the IN_Key property value. We then setup our pass-through code and invoke sanScript’s OLE_GetProperty() function to retrieve the value of the IN_Key from our VST application via some old fashioned OLE automation. The OLE_SetProperty() function then returns the value to our class property, OUT_KeyVal.

That’s it!

3) The third method uses some classic C# reflection to get the path of the AddIns. It then converts this to the path of the Data folder and the dex.ini file, and then uses the Pinvoke() method to read the key in the dex.ini and return the value.

DllImport("kernel32.dll", CharSet = CharSet.Unicode)
 static extern uint GetPrivateProfileString(
 string lpAppName,
 string lpKeyName,
 string lpDefault,
 StringBuilder lpReturnedString,
 uint nSize,
 string lpFileName);

//get path which should be the addins folder
String strPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

//look for Addins path
if (strPath.EndsWith(@"AddIns", true, System.Globalization.CultureInfo.InvariantCulture) == true)
 //and if we find one replace with the data folder
  strPath = strPath.Replace(@"Addins", @"DataDex.ini");

else
 //if not in addins then we must be in the root GP folder (like GP 2013 does with GP addins) so tack on Data
  strPath = strPath + @"DataDex.ini";

 
StringBuilder sb = new StringBuilder(100);
uint res = GetPrivateProfileString("General", "Pathname", "", sb, (uint)sb.Capacity, strPath);
MessageBox.Show(sb.ToString());

// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

The above method comes courtesy of my good friend Patrick Roth with the Escalation Engineering team at Microsoft.

All the above methods are generic in nature and can read more than just a specific key. It’s good to know that there’s more than one way to do things. If you are going all hybrid, there’s a code for that! If you want to be self-contained, there’s a code for that! If you want to deviate completely from sanScript because you hate it or don’t know it, there’s a code for that! Whatever route you choose it must work to your benefit.

As a good Australian friend of mine would say, “The right solution is the one that works!”.

Until next post!

MG.-
Mariano Gomez, MVP
IntellPartners, LLC
http://www.IntellPartners.com/

Read More:
Accessing Microsoft Dynamics GP Default Settings from Visual Studio Tools

August 27, 2013 · Mariano Gomez · No Comments
Tags: , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 420

The Dynamics GP Blogster: Accessing Microsoft Dynamics GP …

http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode public string GetDexIniSetting(string searchKey) { ParameterHandlerClass myParamHandler = new ParameterHandlerClass(); try { Dynamics.Application gpApp = (Dynamics. Application)Activator.CreateInstance(Type. No comments: Post a Comment · Older Post Home. Subscribe to: Post Comments (Atom) …. Dynamics Confessor Blogspot · Bootstrapper Error – Dynamics GP Forum member named 

Visit link:
The Dynamics GP Blogster: Accessing Microsoft Dynamics GP …

August 27, 2013 · Mariano Gomez · No Comments
Tags: , , , , , , ,  · Posted in: Blogs I Follow Total Views: 319

Siri Hates Being Compared To Google Glass | Cult of Mac

vaidymohan. Look at what I got from my Siri… http://www.flickr.com/photos/5. …. Your Facebook News Feed is about to liven up. Photo: Facebook. A few months after Apple birthed Live Photos into existence with the release of …

Read the article:
Siri Hates Being Compared To Google Glass | Cult of Mac

August 26, 2013 · Buster Heine · No Comments
Tags: , , , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 80

12 New Languages and Bi-directional Text Support with Management Reporter 2012 CU6

In the article below, Jill Carter provides details of this new enhancement in the latest release of CU6 for Management Reporter 2012.

Link:
12 New Languages and Bi-directional Text Support with Management Reporter 2012 CU6

August 26, 2013 · Sivakumar V · No Comments
Tags: , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 282

Reasons to attend GP Technical Airlift!

Jay Manley has a series of articles to explain reasons to attend the Dynamics GP Technical Airlift, which is happening from September 18-20, 2013 at Fargo, ND. Here is the link to those articles by Jay Manley. Reason of the Day to attend GP Technical…( read more )

Read more here:
Reasons to attend GP Technical Airlift!

August 26, 2013 · Sivakumar V · No Comments
Tags: , , , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 299

Reason of the Day to attend GP Technical Airlift #12

Microsoft and eOne Solutions are pleased to announce a one day only Extender training class, exclusively for partners on September 17th, 2013, prior to the Tech Airlift event. eOne, who has assumed  responsibility for sales and support (while continuing their testing and development efforts), is offering the class in order to give partners the skills needed to make GP fit their customers’ businesses, without writing code. In the training, eOne will cover every aspect of Extender 2013. Among the areas covered are:

  • Creating a basic window and form including the field types and options available.
  • Adding the Extender resource to SmartList.
  • Creating Templates on Windows and Forms.
  • Adding logic to your Windows and Forms using Actions.
  • Creating inquiries for Windows.
  • Adding extra Windows on Forms.
  • Adding your Forms to Menus.
  • Reporting on the Extender data using tools such as SmartList, Report Writer, and external sources.
  • Using tools such as SmartConnect and SmartView to access the Extender data.

There will be multiple exercises provided to help in the learning process.

Please note that there is limited seating available for the training, so we encourage you to sign up as soon as possible. You can sign up here or email abbey.cooper@eonesolutions.com for more information and details on the training.

Come to have fun, come to learn, just come to Fargo!

Are you signed up?
YES?  Great!  We’ll see you here!!

No?  What are you waiting for!!  Get signed up NOW!  And get your co-workers signed up for the other tracks!

http://gptechnicalairlift.com/

 

Jay Manley

See the original post:
Reason of the Day to attend GP Technical Airlift #12

August 26, 2013 · Jay Manley MSFT · No Comments
Tags: , , ,  · Posted in: Blogs I Follow Total Views: 300