Question

Is there a way to get CreateOleObject to work in a Delphi Form Application? I know it requires ComObj, which I'm guessing might mean it is Console Application use only. If I cannot use it in form applications, is there an alternative I can use?

To give context, I am trying to get the HWID of a computer for identification reasons. According to a guide (That uses Console), I need to do the following:

objSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
objWMIService   := objSWbemLocator.ConnectServer('localhost','root\cimv2', '','');

That is fine in Console, but I need to work with forms so it will be more easily accessible to my users.

So to reiterate; is there a way to implement this in a non-console application? If not, are there alternatives?

Was it helpful?

Solution

CreateOleObject works just fine from forms applications. This is a non-problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top