C# Access internal objects with external code
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).
精彩评论