Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

VO code vs. X# code 31 Aug 2021 10:42 #19482

  • wriedmann
  • wriedmann's Avatar
  • Topic Author


  • Posts: 3199
  • 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:
    docs.microsoft.com/en-us/windows/win32/s...a-file-object-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:
    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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    VO code vs. X# code 31 Aug 2021 12:29 #19483

    • ic2
    • ic2's Avatar


  • Posts: 1555
  • 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

    Please Log in or Create an account to join the conversation.

    VO code vs. X# code 31 Aug 2021 13:39 #19484

    • wriedmann
    • wriedmann's Avatar
    • Topic Author


  • Posts: 3199
  • 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

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    VO code vs. X# code 31 Aug 2021 20:41 #19485

    • ic2
    • ic2's Avatar


  • Posts: 1555
  • 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

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1