All About Dexterity OLE Container – Follow Up

August 6, 2010

Mr. Steve Endow over at Dynamics GP Land managed to unearth my All about the Dexterity OLE Container article in response to a question he fielded from a user who no longer used GP, but wanted to know if they could extract the content embedded in the note files.

In my 2008 article I explained the intrinsic details regarding how OLE notes where created and stored in GP and promised a follow up with a way to automate or access these files externally from GP. During the past two years I have never stopped researching (on and off of course) how these files could possibly be accessed. At the end of the day, it comes down to identifying the actual storage compression algorithm used.

As part of this research, I tested a few tools including Corel’s WinZip tool, which is often considered a very good tool for identifying obscure storage compression formats. However, I had no luck with WinZip. I also tried (successfully I may add) creating my own OLE container application, but failed to be able to open the Dexterity OLE Container files created by GP with it.

Over the course of my research, I came across an open source tool called 7-Zip written by Russian programmer Igor Pavlov. Pavlov managed to implement a number of compression algorithms in his tool, some even used in the early days of computing. So I decided to download 7-Zip, install it and give it a try.

To my surprise, 7-Zip was able to open a Dexterity OLE Container note file and display its content as shown below:


7-Zip shows a directory structure for the file including a contents file and an Embedding folder. I was then curious about the Embedding folder. As the name would suggest, it would probably hold the actual content of the notes itself. Earlier, I had attached a file called intellisense.txt to our favorite customer AARONFIT0001 to verify what I would see. So, on I went to open the Embedding folder, which now showed two files:


The larger file ( [1]OLE10Native ) seemed more promising than the smaller one, so I decided to edit it. All that’s needed is to press F4 or go to the file menu to edit the file. Upon editing it, the file displayed in the traditional NOTEPAD.


Note that the [1]OLE10Native file displays the actual text stored in the IntelliSense.txt file. Since this file was directly embedded into the note not as a link, it would suggest that changes to this file would not affect the actual file stored on my desktop. In addition, it should be noted that the path to the actual file is stored at both the header and footer levels. This is crucial for those of you attempting to migrate your OLE files from one location to another.

I then decided to perform another test by attaching something a bit more complex, a PDF file. This time though, I decided I would attach the file as a link and would display as an icon. When a file is attached as a link, changes made to the actual file, are reflected automatically in the container.

In exploring each file, the [1]Ole file had all the information on where to find the actual link to the file:

Once again, these links can be edited if you must migrate your notes to another directory on your network.

But the question still looms — What storage compression algorithm is used to store these files? Clearly, 7-Zip was able to open them and even expose the contents. I have a theory on the algoritm, but more on that in my next post — and trust me, you won’t have to wait 2 more years!

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/

Advertisements

"You have too many note windows open. Close a note window" Error Message

February 16, 2010

Recently, a system administrator reported a user getting this error and was asking what could be the possible cause for this.

Replicating the error is very simple, and for this, we need a Microsoft Dynamics GP window where many note windows can be entered/opened at once, take for example the Sales Transaction Entry window, which has access to 7 potential notes: the document type, the document number record note, the customer ID record note, the batch ID record note, the site ID record note, the currency ID record note, and the item number record note.

If you attempt to access all these notes at a time will prompt the system to error out when attempting to open a 6th note window. Taking advantage of the Windows 7 Aero interface, one could see why an end user will not realize they have 5 note windows opened at once.

But now to the technical issue…

To display notes — record level notes — the Dynamics GP development team has created five forms, righfully called Form_Note_1, Form_Note_2, Form_Note_3, Form_Note_4, and Form_Note_5. Each time a note is added, the code will check for the availability of one of these 5 forms to be able to open the corresponding note window so the user can either type a new note or read an existing one. If all note forms are opened at the same time, then an attempt to open a sixth note will fail with the error described at the beginning. The solution? Close an unused note window.

Why not create more note forms? 25 years and 11 major releases later, this is an expensive proposition. There is a lot of code in older Microsoft Dynamics GP forms that handle their own calls to validate which of the 5 note forms is open. In newer form objects, these call checks have been replaced by a single call to methods added to the NoteObj form, but unfortunately, “retrofitting” the entire Microsoft Dynamics GP application to work with the NoteObj form is a project in itself that would require tons of testing to make sure nothing gets broken in the process. Certainly, if all the application could be retrofitted to handle calls to the NoteObj form, then adding an extra note form is not so much of an issue anymore… but there lays the problem. Adding this extra form would also cause all third party developers and ISVs to retrofit their code to manage this extra form too. Then comes the philosophical question… what if we want to open a 7th note, or an 8th… do we keep adding more forms? How many note forms would be enough?

More information on Notes, Note Index and OLE Attachments can be found at:

Developing for Dynamics GP – Click here
The Dynamics GP Blogster (this site) – Click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC.
http://www.maximumglobalbusiness.com/


More on OLE attachments and record notes

October 2, 2009

Microsoft’s David Musgrave takes on OLE attachments and record notes based on a support case he tackled recently. David reviews the process use by Dynamics GP to retrieve the next note index value and how the system associates the note to a record. He explores the OLE container and how the file names are encoded along with the path.

Furthermore, he provides some Dexterity and SQL code to demonstrate how you would retrieve the hexadecimal value used to compose the notes file name. Be sure to read David’s article to get the complete scoop.


Related articles

All About the Dexterity OLE Container – click here
Understanding Notes and the Note Index Field @ Developing for Dynamics GP, click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


All about the Dexterity OLE Container

November 26, 2008

Much has been asked about the Microsoft Dexterity OLE Container lately and I wanted to address this topic by providing some background on the technology and how it is used from GP. In addition, I will address how to automate OLE externally from other applications.

Definition

In principle, OLE is a compound document technology from Microsoft based on the Component Object Model (COM). OLE allows an object such as a graphic, video clip, spreadsheet, etc. to be embedded into a document, called the Container Application. If the object is playable such as a video, when it is double clicked by the user, a media player is launched. If the object is allowed to be edited, the application associated with it (the Server Application) is launched.

An object can be linked instead of embedded, in which case the Container Application does not physically hold the object, but provides a pointer to it. If a change is made to a linked object, all the documents that contain that same link are automatically updated the next time you open them. An application can be both client and server, called an Object Packager, which is not something I will cover in this article.

History of OLE

OLE 1.0, released in 1990 and was capable of maintaining active links between two documents or even embedding one type of document within another. The server and client libraries, OLESVR.DLL and OLECLI.DLL, were originally designed to communicate between themselves using the WM_DDE_EXECUTE message. OLE 2.0 followed in the steps of OLE 1.0, sharing many of the same design goals, but was re-implemented on the COM platform. New features were automation, drag-and-drop, in-place activation and structured storage.

OLE custom controls were introduced in 1994 as a replacement for the Visual Basic Extension controls. In particular, any container that supported OLE 2.0 could already embed OLE custom controls, although these controls cannot react to events unless the container supports this. OLE custom controls are usually shipped in the form of a dynamic link library with the .ocx extension. In 1996 all interfaces for controls (except IUnknown) were made optional to keep the file size of controls down, so they would download faster.

The Dexterity OLE Container

The Dexterity OLE Container is part of the Dexterity Shared Components. In OLE compound document technology, it is the OLE client application (CONTAIN.EXE), which holds the linked or embedded objects. The Dexterity OLE Container first surfaced with the release of Dexterity 3.0 in 1993.

The Dexterity OLE Container can be opened via most record notes windows in the Dynamics GP application, by clicking on the paperclip button.

Dexterity OLE Container linked or embedded objects are stored in the path indicated by the OLEPath key in the DEX.INI file.

The following is a typical DEX.INI file layout:


[General]
.
.
OLEPath=C:\Notes\
.
.

When an object is linked or embed in the Dexterity OLE Container window for the first time, Dynamics GP will append the Intercompany ID‘\OLENotes to the OLEPath directory to create a unique physical storage directory for each object attached or embedded to a record note. In turn, the note index value associated to the record note serves as a file reference to the OLE object, this is an 8-character hexadecimal file name is created with the hexadecimal value of the note index.

For example, if the note index associated to the record is 16, a file name is created with the name 00000010.

The note index is also stored in the Records Notes Master table (SY03900) and a text is appended to the note in GP with the legend “OLE Link present”.


SELECT NOTEINDX, DATE1, TIME1, DEX_ROW_ID, TXTFIELD FROM SY03900

The query will produce the following resultset:


NOTEINDX DATE1 TIME1 DEX_ROW_ID TXTFIELD
--------------------------------------- ----------------------- ----------------------- ----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
16.00000 2008-11-28 00:00:00.000 1900-01-01 15:31:26.000 1 OLE Link present.

(1 row(s) affected)

The following is the physical file representation.

*Click on image to enlarge

NOTE: The next note index value is obtained from NOTEINDX column, in the company master table, DYNAMICS.dbo.SY01500.

Unfortunately, the Dexterity OLE Container application was designed only to work from within Microsoft Dynamics GP, hence no programmatic interface was created to support external integrations from other applications. There are no command lines to the CONTAINER.EXE application, however there are a few DDE commands available: Open, Close, Delete, Save. These correspond to the Dexterity OLE function library to control the OLE Container.

The Dexterity OLE Container does not make use of the Microsoft OLE Container Control, and was implemented as a C/C++ based application. Other sources have alluded to the fact that it was implemented based on an MSDN container sample.

Related Articles

KB article 268470 – “Sample: FramerEx.exe Is an MDI ActiveX Document Container Sample Written in Visual C++”, Microsoft Support.

Visual C++ Samples – OCLIENT Sample: Illustrates a Visual Editing Container Application. Microsoft Developer’s Network (MSDN).

Visual C++ Samples: DRAWCLI Sample: Illustrates Integrating Active Container Support with Application-Specific Features. Microsoft Developer’s Network (MSDN).

While the Dexterity OLE Container is not of much help as an external application, you can always run the CONTAIN.EXE application, then drag-and-drop any of the hexadecimal file references to the application’s desktop. In turn this will open the linked or embedded objects.

In my next installment, I will show you how to automate the OLE Container from other applications in order to read standard Dynamics GP OLE notes.

Until next post!

MG.-
Mariano Gomez, MIS, MVP, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Use Microsoft Dynamics GP to Take the Pain and Expense Out of CPA and Bank Audits

June 12, 2008

Check my new article as MS Dynamics World! The article exposes the use of window and record level OLE container objects (clip notes) in Microsoft Dynamics GP and how they can be leveraged to provide basic document management capabilities, directly supporiting accounting departments with CPA and bank audits.

Until next post!

MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


OLE Notes Path and Microsoft Dynamics GP Performance

May 19, 2008

Microsoft Dynamics GP’s performance may be affected if the OLE Notes path is not consistent among all workstations where Dynamics GP is installed. The performance behavior is consistent with that of slow network connectivity, which can lead to troubleshooting down the wrong path.

To verify each workstation’s OLE path, open the DEX.INI file (located under the Microsoft Dynamics GP installation folder for versions prior to 10.0 or in the Data folder under the installation folder for Dynamics GP 10.0 and above) and check the OLEPath setting (Click on image to enlarge).

MG.-
Mariano Gomez, MIS, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/