Menu

Dev-C++ How To Get ID from WMI Win32 Classess

szczurek
2011-10-10
2012-09-26
  • szczurek

    szczurek - 2011-10-10

    Hi I need to write DLL with two functions via Dev-C++ to get two items:
    1/. "select UniqueId from Win32_Processor"
    2/. "select SerialNumber from Win32_DiskDrive"

    Both of the fuctions must return string values using using System.Management
    of WMI (Windows Management Instrumentation Win32 Classes).

    Has anybody any IDEA ?

    Best Regards,

     
  • Jim Pattee

    Jim Pattee - 2011-10-10

    You need to be more specific with your question.
    What do you need help with? the DLL? the functions? the Windows API?

     
  • szczurek

    szczurek - 2011-10-10

    Hi jimp03,

    I need help for writing functions in DEV-C++ that return string values:
    1/. first function CPU_ID ()
    2/. second function HDD_ID ()

    using WMI...

    I wrote examples how to get items from WMI.

    Here is description for the WMI Classes I need:

    1/. for CPU_ID() -> http://msdn.microsoft.com/en-us/library/windows/desktop/a
    a394373%28v=VS.85%29.aspx

    ( I am intresting only with UniqueId of Win32_Processor WMI class. How to
    return UniqueId for CPU as string value on DEV-C++? )

    2/. for HDD_ID() -> http://msdn.microsoft.com/en-us/library/windows/desktop/a
    a394132%28v=VS.85%29.aspx

    ( I am intresting only with SerialNumber of Win32_DiskDrive WMI class. How to
    return SerialNumber of HDD as string value on DEV-C++? )

    How to get above string values via DEV-C++ ?

    It is not EASY for ME, but VERY VERY useful.

    Rgds,

     
  • Jim Pattee

    Jim Pattee - 2011-10-10

    You wrote examples how to get items from WMI.
    What programming language were they written in? What development environment
    did you use?

     
  • szczurek

    szczurek - 2011-10-11

    Hi Again,

    I use C++ in my project. I need two functions in C++ what return string values
    of Processor ID and HDD ID.
    Next I would like to implement and export them in DLL using DEV-C++.

    I don't know how to call WMI under DEV-C++. What file should I include?
    Pls for any example how to write something like this http://www.codeproject.c
    om/KB/system/GetHardwareInformation.aspx
    using the DEV-C++

    Rgds,
    Piotr

     
  • Jim Pattee

    Jim Pattee - 2011-10-11

    Do the following if you haven't done so already.

    Install the WMI on your computer.
    Create a Dev-Cpp project file with paths to the WMI files.
    Write a "main" function (without the WMI) that compiles with the project file.

    Add the "using System.Management" statement and the "ManagementObjectSearcher
    searcher = new ManagementObjectSearcher("select * from " + Key);" statement.
    Check for an error in obtaining the "searcher" object.
    Compile without errors.

    Then you can obtain the data from the object using the "searcher" pointer .

     
  • szczurek

    szczurek - 2011-10-12

    Hi jimp03,

    Thank you for the answer. I have two additional questions to You:

    You wrote: "Do the following if you haven't done so already. Install the WMI
    on your computer."
    Question: What files, from what page should I download WMI files for Windows
    XP/7/Vista ?

    You wrote: "Create a Dev-Cpp project file with paths to the WMI files."
    Question: What project type should I create (DLL, empty or source project) and
    where can I set the path to the WMI files on DEV-C++?

    Best Regards,
    Piotr

     
  • szczurek

    szczurek - 2011-10-25

    Hi jimp03 again,

    You wrote:
    "Create a Dev-Cpp project file with paths to the WMI files. Write a "main"
    function (without the WMI) that compiles with the project file."

    question 1: How to write function main() without WMI files?

    You wrote:
    Add the "using System.Management" statement and the "ManagementObjectSearcher
    searcher = new ManagementObjectSearcher("select * from " + Key);" statement.
    Check for an error in obtaining the "searcher" object. Compile without errors.

    question 2: How to do this? Any example?

    I do not know how to compile WMI files in my project in DEV-C++

    Rgds,

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.