VO code vs. X# code

This forum is meant for anything you would like to share with other visitors
Post Reply
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VO code vs. X# code

Post by wriedmann »

Hello,
today I had to add functionality to read a files owner in one of my VO applications.
I have found the following C code:
https://docs.microsoft.com/en-us/window ... ect-in-c--
Is is a long piece of code, and some of the needed functions are not avaiable in the Win32 API library. Therefore it will take at least a hour or two to implement this in plain VO using Windows API (define functions, structures, write and test the code).
In X# this is a one-liner:

Code: Select all

cOwnerName := System.IO.File.GetAccessControl( cFileName ):GetOwner( typeof( System.Security.Principal.NTAccount ) ):ToString()
So the fastest solution was to add it to a COM library and use it in VO through COM. Time needed: 10 minutes.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

VO code vs. X# code

Post by ic2 »

Hello Wolfgang,

I do the same, there are a lot of C# code samples which directly work. I always notice however that there is a lot not present in .Net where I would expect it to be standard. You often need someone else's code to accomplish something.

What do you do with this function I was wondering?

Dick
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VO code vs. X# code

Post by wriedmann »

Hi Dick,

in most cases it is much easier to accomplish something in .NET - maybe because the platform is much younger.
I need that function to show who has created a file in my application (because he is the owner of the file).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

VO code vs. X# code

Post by ic2 »

Hello Wolfgang,

I agree with your remark about .accomplishing something in Net. And I never actually realized that the owner (which in Explorer is my Windows login name) is the creator of the file. Interesting.

Dick
Post Reply