`
COM: Example 1 2004-01-15 -- Andy Ireland Newsgroups: softvelocity.public.clarion6 >From Carl Barnes on the SV Discuss Box: Hi Carl, I do not have access to the NG where you asked for my help. I will respond here without knowing what it is you need from me in entirety. >FWIW attached is my example of using the SVCom to Add a Shortcut. It's >Alexey's code converted. I enhanced to wrap it all in a Class and encapsulated all >interface calls into class methods. It's not really polished and finished, I >got it working and tried to use as many SV equates as I could. >While this works fine for me I'm not sure if I have handled the COM object >correctlty. Maybe if AndyI is in this group he could take a look. Ok. Code looks reasonable albeit that the save method is not native as it takes only one param which is a variant. Without seeing what they are doing in some of the calls, there is no way to know for sure if the code is correct. But if it works, I guess it must be. Incidently, COMIniter is COM (CoInitialize) not OLE (OleInitialize). OLE goes way beyond COM. The Objects will auto clean on destruct so in principle it looks fine. >A few reflections: >1. It's a damn lot of work. Some auto gen of the code would help. My >wrapping it all in a Class mainly takes care of type conversions. Attached. That's why we have helpers. Then it's a lot less work. For example.... sz = 'c:\winnt\calc.exe' hr = ShellLink.put_Path(_bstr(sz)) if hr ~= S_OK message(hr) return end Not too difficult at all. >2. The SVCOM looks like it's based on Plugware com with some of the names >changed. Yes, I wrote it, albeit an old obsolete copy that still has quite a few bugs. >3. At ThinkData are the docs to OutlookFUSe that provide some useful >overview of the COM classes but more is needed I have a doc somewhere but I lost a fair amount when my dev machine crashed. The only thing we never lost were the sources in source control. Russ has the best docs at this time on COM in clarion both from our ETC presentations and one of his classes. Regards Andy Printed December 3, 2024, 11:49 am This article has been viewed/printed 35425 times. Google search has resulted in 17 hits on this article since January 25, 2004. |