Friday, July 18, 2008

Darwin Race of Languages - Day 4


So I've been defeated by COM and WMI. To me, what's missing in the Delphi world are comprehensive tutorials and documentation like you can find with MSDN and Sun (for Java). What I ended up trying to do was look at existing code that uses WMI in Delphi, and attempt to reverse engineer it. I have a reasonable understanding of the objects and techniques used in the sample code, but when I got stuck, I had no idea what was causing the problem. Unfortunately, the time ran out for the competition before I could make anymore headway. 

Earlier in the competition, I posted about my usual steps when learning something new, for the Darwin Race of Languages, I got stuck on step 2, developing the proof of concept, by reverse engineering existing examples.

If anyone is interested in looking at the code I was working on, the entire project is in a zip file here. Note that I'm not sure if all the imports will be correct on anyone elses pc, as the paths were local to my pc. I can't really call the code "my code", since it was mostly a cut and paste from someone named ciuly. I also used as reference, this project from Planet Source Code, which interestingly enough had errors, but ran on my workstation. When I attempted to extract the code and place it in my project, I ran into the same EOleException that I had in ciuly's example. That leads me to believe that the issue lies somewhere in my project, but not in the sourcecode. 

2 comments:

  1. I'd love to have a look at what you've tried, but there's a couple of things missing.

    5.0\imports\activeds_tlb.pas
    5.0\imports\WbemScripting_tlb.pas
    Desktop\CpuSysTemp\Unit1.pas

    And maybe some more things. I can import the tlbs myself probably, but I haven't a clue about whats in unit1 of course. Maybe you can add these files too?

    ReplyDelete
  2. The tlb's were pretty standard I'm guessing. Unit1.pas was just a file I was using for code reference, it's not used for anything. The sample code is posted here http://www.ciuly.com/delphi/wmi/cpuSystemTemperature/

    I also followed the instructions from ciuly.com on which libraries to import (activeds and WbemScripting).

    ReplyDelete

Note: Only a member of this blog may post a comment.