|
As the other Richard said, you've posted this in the wrong forum.
But you don't need to invoke Powershell in order to create and use a COM object. You can do that directly from C#:
Type t = Type.GetTypeFromProgID("Microsoft.Update.AutoUpdate");
dynamic a = Activator.CreateInstance(t);
DateTime lastSuccessfulUpdate = a.Results.LastInstallationSuccessDate;
text_LastWinUpd.Text = lastSuccessfulUpdate.ToString();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi!
Yeah if possible i want it in C# only.
I trid the code but i gives this:
0001-01-01 00:00:00 +00:00
|
|
|
|
|
What do you get when you run the Powershell code in Powershell on the same computer?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
2021-09-20 is the result from PS command
|
|
|
|
|
The Powershell script and the C# code return the same result for me. Are you definitely running them both as the same user on the same computer?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Works for me:
private DateTime GetLastUpdateSuccessDate()
{
Type t = Type.GetTypeFromProgID("Microsoft.Update.AutoUpdate");
dynamic a = Activator.CreateInstance(t);
DateTime lastUpdate = a.Results.LastInstallationSuccessDate;
return lastUpdate;
}
|
|
|
|
|
Hello All,
I am looking for an C code example to capture DISK IO utilization by a process. Please help me out to get the example.
Thanks.
|
|
|
|
|
|
I am looking for an API which gives DISK IO utilization of a process on windows box. Please share any information related to capture IO utilization.
|
|
|
|
|
Did you actually follow the link I gave you?
|
|
|
|
|
So what is wrong with GetProcessIoCounters function?
|
|
|
|
|
Hey everyone,
I'm a beginner in c++ and I'm trying to connect to my garmin watch via bluetooth. The watch is connected on w10, with bluetooth LE explorer i can see the UUID and service ID for the heartrate. I'm looking for a simple way to connect to it from c++ and read the data.
The last 2 days i've been trying even c++ builder, all kinds of libraries but can't connect.
I'm surprised i can't find simple examples online, bluetooth and windows doesn't seem to be quite simple.
Does anyone have an example on this?
|
|
|
|
|
|
So, I've gotten one stop further, I'm using this code: GitHub - urish/win-ble-cpp: Proof of Concept - BLE on Windows (for Web Bluetooth)[^]
I've put in my shortcodes for the service and charachteristic and the code manages to complete them for the right UUID's so I assume it connects!
these are the shortcodes and ID's, next up, how can i read the values from these?
auto characteristicUUID = Bluetooth::BluetoothUuidHelper::FromShortId(0x2A37);
|
|
|
|
|
Sorry, I cannot answer that. Once you have established a connection then the data passed between the stations will depend on the devices being used. Check the technical documents for the watch you are using.
|
|
|
|
|
Ok, I'm getting closer:
auto leDevice = co_await Bluetooth::BluetoothLEDevice::FromBluetoothAddressAsync(264540343013609);
auto naam = leDevice->Name;
auto servicesResult = co_await leDevice->GetGattServicesForUuidAsync(serviceUUID);
auto service = servicesResult->Services->GetAt(0);
auto characteristicsResult = co_await service->GetCharacteristicsForUuidAsync(characteristicUUID);
auto test = characteristicsResult->Characteristics->First();
auto characteristic = characteristicsResult->Characteristics->GetAt(0);
So firts line, i'm putting in the mac address manually, i check if the name corresponds and indeed it's my garmin. Then i put in the service and charateristic for the heart rate service. Now i'm stuck, how could I get the heart rate value out of this? I read somewhere that it's the first byte but don't know how to extract this
|
|
|
|
|
As I told you earlier, you need to check the documentation for your device. The format of the data it sends will only be documented by the manufacturer.
|
|
|
|
|
@Richard, I'm looking for people who have practical advise in this, I'm new to c++ and to everything i'm trying to do here, I've been struggeling for days. There is also not a lot to find on the internet regarding this. If you don't know the answer that's ok, you don't need to answer. I'm not posting on here to get 'check the documentation' answers.
|
|
|
|
|
As I keep pointing out, the format of the data that will be presented by the device is specific to that device. So the only way to find out what it is, and what format it is sent in, is to get the technical documentation for the device. It is not a C++ issue.
|
|
|
|
|
thanks for hijacking this question, you spend days and days trying to work stuff out, put a question up for help to get this... Don't you have anything better to do? Incredible
|
|
|
|
|
What do you mean? I have tried to help you and I have told you where to find the information you need.
|
|
|
|
|
Wim Van den Borre wrote: you spend days and days trying to work stuff out And Richard is trying to lessen that time by giving you some sage advice. This is how integrations work, if devices are spitting out data in certain format (and many times that format is specific to the vendor) it is up to YOU to determine (by looking at available vendor documentation) and code for this format.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Ow boy, i started by telling i'm a complete beginner and was looking for people who have experience in this. I'm not looking for dataformats, i'm looking to connect w10 bluetooth through c++ not a lot to find on the interwebz, so if anyone has had succesfull experience with this please answer this thread.
|
|
|
|
|
You're not going to find anyone who has experience SPECIFIC TO YOUR DEVICE. You're getting the correct advice, and as a beginner, you need to learn that the best source of information on a specific device is the manufacturer of that device.
|
|
|
|
|
years ago i made some mvc apps, the help i got on codeproject was incredible.
Seems this is down the drain, none of you 3 are even reading my question, in stead of thinking about an answer (why else would you responsd to a question?) it's rtfm and acting hurt.
|
|
|
|