xsharp.eu • VO code vs. X# code
Page 1 of 1

VO code vs. X# code

Posted: Tue Aug 31, 2021 8:42 am
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

VO code vs. X# code

Posted: Tue Aug 31, 2021 10:29 am
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

VO code vs. X# code

Posted: Tue Aug 31, 2021 11:39 am
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

VO code vs. X# code

Posted: Tue Aug 31, 2021 6:41 pm
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