开发者

C# Access internal objects with external code

开发者 https://www.devze.com 2023-03-05 16:48 出处:网络
I have a static progress bar that I\'d like to advance during external code execution. [DllImport(\"netapi32.dll\",EntryPoint=\"NetServerEnum\")]

I have a static progress bar that I'd like to advance during external code execution.

       [DllImport("netapi32.dll",EntryPoint="NetServerEnum")]
    public static extern int NetServerEnum( [MarshalAs(UnmanagedType.LPWStr)]string servername,
        int level,
        out IntPtr bufptr,
        int prefmaxlen,
        ref int entriesread,开发者_开发百科
        ref int totalentries,
        SV_101_TYPES servertype,
        [MarshalAs(UnmanagedType.LPWStr)]string domain,
        IntPtr resume_handle);

Is my call to my external function. This function takes quite a while to process on large networks as you might imagine so a progress bar would be nice. Anyone have any ideas?

THanks!


If you can modify the external method, you could add a callback to update progress. If not, you may have to just add an indeterminate state progress bar, as I'm not sure how you would otherwise obtain progress (let alone communicate it).

0

精彩评论

暂无评论...
验证码 换一张
取 消