Microsoft Product Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg
Showing posts with label COM. Show all posts
Showing posts with label COM. Show all posts

Wednesday, 29 September 2010

My first post over at Dynamics Latam

Posted on 13:41 by Unknown
My first post on COM interop and Dexterity is out over at Dynamics Latam! This will be an excellent venue for me to give back to Spanish speaking community Microsoft Dynamics GP in North, Central, and South America and will sure up other venues to spread the GP gospel.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in C#, COM, Dexterity, Events | No comments

Monday, 8 March 2010

VBA - Suppressing CTRL+Break or CTRL+C in VBA Customizations

Posted on 15:31 by Unknown
VBA is by far one of the best customization tools available to Microsoft Dynamics GP developers and as such it is widely used across a number of production environments to deliver functionality that ranges in various degrees of complexity.

However, one of the issues with VBA -- at least until now -- is the fact that an end user can inadvertly press CTRL+Break (older keyboards) or CTRL+C and stop the execution of a script. Now imagine if that script is say, some code developed to calculate 401K contributions when payroll is ran... the results will certainly not be pretty!

With this in mind, we can use a USER32.DLL library funcion to disable user input when critical VBA code is required to be executed in a block. The following shows how to implement such code:

BlockInput function

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As
Long



We can now use this function across any of our VBA customizations, as follows:

Sample Window_BeforeOpen code

Private Sub Window_BeforeOpen(OpenVisible As Boolean)
BlockInput True
' All the code you need to run here
...
' MAKE SURE TO RE-ENABLE THE INPUT
BlockInput False
End Sub


There are several applications for this code, but whatever you do, don't forget to re-enable the user input, otherwise you will end up with one dead mouse and keyboard!

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/
Read More
Posted in Code, COM, VBA | No comments

Sunday, 10 January 2010

Building a COM Interop Assembly to use with Microsoft Dexterity

Posted on 15:16 by Unknown
I am currently building some customizations for a customer of mine in the aerospace industry. My customer required a library of trigonometric functions that could be used to extend their Dexterity integrating applications.

To solve this problem, we turned to .NET to create COM interop assembly. The idea was to take advantage of the standard Math class methods available with the System namespace - System.Math . The following is an excerpt of the code we created:

TrigonometricFunctions.cs

//Created by Mariano Gomez, MVP
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace TrigonometricFunctions
{
public class TrigonometricFunctions
{
[GuidAttribute("8268A95E-6FCB-4FB2-88A1-1E38F49F4FB8"), ClassInterface(ClassInterfaceType.AutoDual)]
public class TrigFn
{
// dx in degrees
public double fSin(double dx)
{
double angle = Math.PI * dx / 180.0;
// returns sin(dx)
return Math.Sin(angle);
}

// dx in degrees
public double fCos(double dx)
{
double angle = Math.PI * dx / 180.0;
// returns cos(dx)
return Math.Cos(angle);
}

// dx in degrees
public double fTan(double dx)
{
double angle = Math.PI * dx / 180.0;
// returns tan(dx)
return Math.Tan(angle);
}

}
}
}


Once the functions in the TrigFn class were in place, we set up the assembly information in Visual Studio's marking the option to Make assembly COM visible.


So we did not have to register the assembly manually, we took advantage of Visual Studio's ability to register the assembly for COM interop under the Build settings. For purposes of demostration, I created a simple Dexterity form, as shown below:



The following is the code added to the '(L) Sine' button:

Sine button CHG script

{ script: l_Sine_CHG }

local TrigonometricFunctions oTrig;
local currency angle, sine;

oTrig = new TrigonometricFunctions.TrigFn();

'(L) Prompt' = "The Sine value is ";
'(L) Conversion' = oTrig.fSin('(L) Angle');

In the code above, TrigonometricFunctions is a data type created after adding the TrigonometricFunctions COM interop assembly as a library to our Dexterity application. The data type references the TrigonometricFunctions.TrigFn class.

References:

  • Using a .NET Assembly from a Dexterity-Based Application - Click here
  • Microsoft Dynamics GP 10.0 White Paper: Using a .NET Assembly from a Dexterity-based Application - Click here


  • Downloads:

    TrigonometricFunctions .NET project - Click here
    Dexterity Sample App - Click here

    Until next post!

    MG.-
    Mariano Gomez, MVP
    Maximum Global Business, LLC
    http://www.maximumglobalbusiness.com/
    Read More
    Posted in C#, Code, COM, Dexterity, Visual Studio 2008 | No comments
    Older Posts Home
    Subscribe to: Posts (Atom)

    Popular Posts

    • The Dynamics GP Blogster's best articles of 2012
      It's that time of the year again! Time to say goodbye to the outgoing year, 2012, and receive the new one, 2013, making all sort of reso...
    • What's new in Microsoft Dexterity 11.0
      The excitement around Microsoft Dynamics GP 2010 could not be any higher. Traffic on my site has doubled since I began releasing informatio...
    • Vote for your 2012 GPUG All Star
      The time has come again to vote for the next year's GPUG All Star awards. Surprisingly, I have been nominated to this award along with f...
    • How to add a "Cover Letter" page to a Microsoft Dynamics GP Word Template document
      I wrote an article almost a year ago showing a simple technique to add a  Terms and Conditions page to a Microsoft Dynamics GP Word Templat...
    • "Unable to access SnapIn config data Store" accessing Web Management Console
      For quite some time I had been running into this error when attempting to access the Microsoft Dynamics GP 2013 Web Management Console appl...
    • Running Windows 8.x Business Analyzer app on a laptop with SQL Reporting Services
      If you are a consultant, chances are you run your Microsoft Dynamics GP application demo environment on a laptop along with Microsoft SQL Se...
    • Adding more comment lines to POP Purchase Orders
      Just recently, I was asked by a customer to address an issue with their line item comments truncating at 4 lines. In essence, the customer w...
    • Extender Auto Open and Auto Close options not working in GP 2010
      Just recently, I came across an issue reported by a partner on Extender Auto Open and Auto Close options not working. Extender Auto Open a...
    • New Article on MSDynamicsWorld: Do's and Don'ts of Microsoft Dynamics GP Forums
      Many of you know me as an avid forum contributor - I can usually be found on the Microsoft Dynamics GP Partner Online Technical Community ...
    • Adding Customer Item User Defined fields to SOP Invoice
      Just recently I ran across a request to add the Customer Item user defined fields to the Sales Blank Invoice Form report in Report Writer. A...

    Categories

    • Ad Campaigns
    • ADO
    • Adobe Acrobat
    • Analytical Accounting
    • Architecture
    • Around the Blogosphere
    • Article
    • Azure
    • Bank Reconciliation
    • Best of 2009
    • Best of Series
    • Best Practices
    • Bing Maps Enterprise
    • Books
    • Business Alerts
    • Business Analyzer
    • C#
    • Code
    • COM
    • Community
    • Compliance
    • Connect
    • Continuum
    • Convergence
    • Corporate Performance Management
    • CRM
    • Database Maintenance Utility
    • Decisions Conference
    • DEX.INI
    • DEXSQL
    • Dexterity
    • Discussions
    • Drill-Down Builder
    • Dynamics GP 10
    • Dynamics GP 11
    • Dynamics GP 12
    • Dynamics GP 2010
    • Dynamics GP 2010 R2
    • Dynamics GP 2013
    • eConnect
    • EFT
    • Electronic Banking
    • Encumbrance
    • Events
    • Extender
    • Field Services
    • Fixed Assets
    • Forecaster
    • From the Newsgroups
    • FRx
    • Functionality
    • General Ledger
    • GPUG
    • Home Page
    • Human Resources
    • Humor
    • IMHO
    • Installation
    • Integration
    • Integration Manager
    • Internet Explorer
    • Inventory
    • Kinnect
    • Maintenance
    • Management Reporter
    • Manufacturing
    • Menus for Visual Studio Tools
    • Microsoft Office
    • Modifier
    • Multicurrency Management
    • Multitenancy
    • MVP Summit
    • MVPs
    • Named Printers
    • Navigation Pane
    • Notes
    • ODBC
    • Office Web Components
    • OLE Container
    • Online Services
    • OpenXML
    • Partner Connections
    • Payables Management
    • Payroll
    • Performance
    • PO Commitments
    • Printer Compatibility
    • Product Feedback
    • Project Accounting
    • Purchasing
    • Receivables Management
    • RemoteApp
    • Report Writer
    • Reporting
    • Roadmap
    • SafePay
    • Sales Order Processing
    • Season Greetings
    • Security
    • Service Call Management
    • SharePoint
    • SmartList and SmartList Builder
    • SQL Reporting Services
    • SQL Scripting
    • SQL Server
    • Support Debugging Tool
    • Tax Updates
    • Technical Conference
    • The Partner Event
    • The Technology Corner
    • Training
    • Translation
    • Troubleshooting
    • Upgrades
    • VAT
    • VB.NET
    • VBA
    • VBScript
    • Visual Studio 2008
    • Visual Studio Tools
    • Web Client
    • Web Services
    • Windows 7
    • Windows 8
    • Word Templates
    • XBox
    • XBRL

    Blog Archive

    • ▼  2013 (68)
      • ▼  December (2)
        • Visual Studio Tools for Microsoft Dynamics GP 2013...
        • Web Client Wednesday: Microsoft Dynamics GP on Azure
      • ►  November (8)
      • ►  October (5)
      • ►  September (5)
      • ►  August (3)
      • ►  July (8)
      • ►  June (5)
      • ►  May (5)
      • ►  April (2)
      • ►  March (11)
      • ►  February (6)
      • ►  January (8)
    • ►  2012 (101)
      • ►  December (8)
      • ►  November (6)
      • ►  October (15)
      • ►  September (16)
      • ►  August (9)
      • ►  July (4)
      • ►  June (4)
      • ►  May (6)
      • ►  April (4)
      • ►  March (11)
      • ►  February (4)
      • ►  January (14)
    • ►  2011 (158)
      • ►  December (7)
      • ►  November (17)
      • ►  October (7)
      • ►  September (8)
      • ►  August (8)
      • ►  July (12)
      • ►  June (12)
      • ►  May (13)
      • ►  April (23)
      • ►  March (21)
      • ►  February (10)
      • ►  January (20)
    • ►  2010 (168)
      • ►  December (15)
      • ►  November (11)
      • ►  October (12)
      • ►  September (24)
      • ►  August (13)
      • ►  July (12)
      • ►  June (8)
      • ►  May (17)
      • ►  April (14)
      • ►  March (9)
      • ►  February (16)
      • ►  January (17)
    • ►  2009 (5)
      • ►  December (5)
    Powered by Blogger.

    About Me

    Unknown
    View my complete profile