View previous topic :: View next topic |
Author |
Message |
fik Member
Joined: 11 Oct 2006 Posts: 303
|
Posted: Sun Jul 15, 2007 9:36 pm Post subject: Deled warning when i try to run my plugin |
|
|
I am trying to write a plugin, but I am having this warning come up 'CoInitialize has not ben called'. I have no idea after a lot of looking round what i am doing wrong or what this warning means. Any help most welcome. I am sure it's something silly I am doing. I think it has something to do with me trying to read a XML file into my plugin. |
|
Back to top |
|
|
jwatte DeleD PRO user
Joined: 26 Apr 2006 Posts: 513
|
Posted: Mon Jul 16, 2007 7:20 am Post subject: |
|
|
If you're calling the MS XML interface, you need to call CoInitialize() before you call MS.
However, I would recommend using XML-SCAN instead, which is part of my nuxporter plug-in. It's a lot less overhead, and faster. Also, if you start with the nuxporter project as template, you already get access to the DeleD scene, because it does the parsing for you. |
|
Back to top |
|
|
fik Member
Joined: 11 Oct 2006 Posts: 303
|
Posted: Mon Jul 16, 2007 10:22 am Post subject: |
|
|
Thanks for reply jwatte. Unfortunatly i am using Turbo Delphi and i am trying to make a importer so i cannot make use of your code as C++ eludes me at the moment. I am using MS XML and i can not find anything about coinitialize in borlands help. I am quiet new to delphi programming so i am no doubt missing it . |
|
Back to top |
|
|
Mr.Fletcher DeleD PRO user
Joined: 07 Aug 2004 Posts: 1772 Location: Germany
|
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Mon Jul 16, 2007 5:54 pm Post subject: |
|
|
Turbo Delphi most certainly supports coinitialize, it is part of the Windows 32 API. The reason why you cannot find it in the help is that the standard Delphi help does not contain the Win32 help, it's a separate helpfile with the older Delphi's, not sure about Turbo Delphi. Also, older Delphi's did suport Win32 context-help (i.e. type coinitialize in the IDE, put cursor in it, hit F1)... but again, the latest Delphi helpsystem might not support that (it is not as convenient as it used to be back in the good old .hlp days).
Anyway, back ontopic: To use coinitialize, use the unit ActiveX (or Ole2 if you are 'oldschool'). Every thread in your application should coinitialize( nil ) and couninitialize. Inside a .EXE, the Delphi RTL takes care of this, but inside a DLL (or if you use multiple threads), you have to do it yourself.
Hope that helps. Using a non-COM XML parser, like Mr Fletcher suggests, will also solve your problem... but knowing how coinitialize works is useful anyway! |
|
Back to top |
|
|
fik Member
Joined: 11 Oct 2006 Posts: 303
|
Posted: Mon Jul 16, 2007 6:21 pm Post subject: |
|
|
Thanks Mr.Fletcher But I don't seam to be able to get this to work in turbo as it wont allow 3rd party Packages.
Thanks Paul_Jan i think i understand now. will give it a go fingers crossed. |
|
Back to top |
|
|
Mr.Fletcher DeleD PRO user
Joined: 07 Aug 2004 Posts: 1772 Location: Germany
|
Posted: Mon Jul 16, 2007 9:04 pm Post subject: |
|
|
You can just use the units, you don't need to install it as packages. Just put them in a directory where the compiler finds them and ad LibXML (or how the unit is called) to the uses section. _________________ Behold! The DeleD Wiki! Please help us expanding it
DeleD on IRC |
|
Back to top |
|
|
fik Member
Joined: 11 Oct 2006 Posts: 303
|
Posted: Mon Jul 16, 2007 10:27 pm Post subject: |
|
|
I'll try that too Thanks |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Tue Jul 17, 2007 8:01 pm Post subject: |
|
|
Fik, if you are really stuck with some specific Delphi problem, you can always send me the source (paul [at] delgine [dot] com). I'll fix the problem and return the files to you... Just have to promote our favourite development language! |
|
Back to top |
|
|
fik Member
Joined: 11 Oct 2006 Posts: 303
|
Posted: Tue Jul 17, 2007 9:40 pm Post subject: |
|
|
Thanks for that offer Paul-Jan I think i have solved that problem now (did have some problem with couninitialize causing an error Think that Cured to). Will keep plugin away but if ..... |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Wed Jul 18, 2007 7:20 am Post subject: |
|
|
Ah good job. If there is any problems, just ask away. |
|
Back to top |
|
|
|