Strange error with my app and Add-in

Add-in Express™ Support Service
That's what is more important than anything else

Strange error with my app and Add-in
Gürcan YÜCEL

Posts: 54
Joined: 2004-08-16
I dont know its because of mt application or add-in. I have a strange error. I wrote add-in in D7 Ent with Add-in Express VCL 2.2 on W2k with appropriate service packs both for windows and office. Im using office 2000. There is some code in OnAddInInitialize event and OnAddInStartupComplete event. Both events coded some registry reading and add in toolbar button enable/disable routines. Up to here everythings work fine and no problem with add-in.

Before this our company developed an application in D6 for document management purposes.(executable). There is no special code. It calls COM+ routines. Also this executable has no problem and works fine for 3 years. We are storing documents in DB (MS SQL Server) and when the user tries to open document, we save blob to a file and SHELLEXECUTE it. Nothing special at the rest.

YES, everything works good up to here. Yesterday, our support team report a strange bug. The machine is W2k with administrator privilages. When the old program opened and stays in background, you can't open a word document in file system by double clicking. MS Word tries to open and in the splash dialog it freezes.!!!
When you shut down the D6 application MS Word gets alive and opens from splash screen. If there is no add-in registered, no problem, you can open word from file system or you can open document prom D6 application with shellexecute.

I tried to debug but cant do anything. Because, if MS word applicastion opens before D6 application, everyting works fine. Any idea?

I know its strange, I know its sounds impossible, but true. Im not a newbie in programming. Im writing since D1.:( If there is an idea to find a problem, drop me a message. Thanks.

By the way, in that machine, there is D6 and D7 installed.

NOTE: I add debug code on OnAddInInitialize event and OnAddInStartupComplete events. They dont fires up to close D6 application.

Posted 11 Nov, 2004 05:23:45 Top
Eugene Starostin


Hi Gürcan,

You are right, it is the strange problem. We will try to reproduce this. Could you please send us the code from both events you use.
Posted 11 Nov, 2004 08:56:50 Top
Dmitry Kostochko

Add-in Express team

Posts: 2875
Joined: 2004-04-05

You forgot to mention what MS Office is installed on the PC where Word freezes. Or is it your PC?

Does your "D6 application" connect to the Word immediately after running?
Posted 11 Nov, 2004 09:03:54 Top
Gürcan YÜCEL

Posts: 54
Joined: 2004-08-16
Hi again,
All happens both in my machine (D6+D7+W2K+SP4+O2K) and one of the test machine (W2K server+O2K).
D6 program is a single executable, no dll, no OLE, or other things. Simple COM+ application that connects remote data objects. If there is need, it gets the word document from DB, saves to file system and shellexecute to open it.
My Add-in simple add-in that do some stuff on word document. No connection with other applications and written with D7. Here is the events;
TempPath : array[0..255] of Char;
TmpStr : String;
//fills the global application object from registry
Application.Handle := GetActiveWindow;
// registry functions goes here
//more registry functions...
//get the tmp dir
TmpStr :=TempPath;;
//butonların hepsinin dil ayarlarını burada yap
//Get PopUps
PopUpFloating:= FloatingBar.ControlByTag(20).AsPopup;
BtnAbout:= FloatingBar.ControlByTag(10).AsButton;
BtnAbout.Caption:= STC[g_app.DefaultLangId,8];
BtnLogin:= PopUpFloating.ControlByTag(30).AsButton;
//gets more pre defined button variables to use in addin

// assign my prosc to word events.
// nothing special in this events. with the global variable, they dont run for the first time up to login.


I tried to debug. Here is the 2 scenerios;
1.Open D6 app. Connects to remote machine via COM+
2.Do some record assigments, insert, delete,upd. Nothing special.
3.In file system, double click to an ms office document. (this document is not related with D6. Just a document)
4.Word freezes. I put showmessage in both OnAddinInıtialize, OnAddinStartupcomplete but nothing displayd.
5.You can use D6 application. Nothing freezes on it.
6.Close D6 application. MS Word opens and event messages displayed.!!!
I unregistered Addin and tried same scenario. Everything works fine. Word opens correctly.

Second scenario;
1.Open MW Word document from file system.
2.Open d6 application.
3.Both application works fine.
4.Close word document (not word)
5.Open a document. Works fine
6.Close word app, It freezes again.
7.Close D6 app.
8.Word also closes.

I know, its very strange problem. Any idea?
Posted 12 Nov, 2004 03:25:49 Top
Dmitry Kostochko

Add-in Express team

Posts: 2875
Joined: 2004-04-05
Hi Gürcan,

Here you can find a simple add-in (Delphi 7) and a simple application (Delphi 6):

The application doesn't contain any COM+ routines. Please test these projects on your PC, and let us know about the results. If everything works well, add to the application and the add-in your code to prevent MS Word from working and send the projects back to us.
Posted 12 Nov, 2004 05:10:31 Top