I import "winmm.dll" by using the following code.
MyUtils = public static class
private
protected
public
[DllImport("winmm.dll")]
class method timeBeginPeriod(period:Integer):Integer; external;
[DllImport("winmm.dll")]
class method timeEndPeriod(period:Integer):Integer; external;
end;
Access the methods as follows.
MyUtils.timeBeginPeriod(1); //within winform load event
MyUtils.timeEndPeriod(1); //within winform formclosing event
Under Windows 7, it works great as expected. Under mono on Linux System, it works as well but with one exception. As soon as the program is started, it pops up with a message box with the name of the dll that is imported and OK button as shown below. When I click the OK button, my program continues and runs as expected without any errors.
I've combed through my program to see if I am intentionally displaying the dll file name anywhere, but I simply can't find anything like that.
EDIT: Little bit more information, the reason I need to work with winmm.dll is I need to be able to adjust thread sleep granularity or default delay down to about 1 milliseconds or close to it - NOT to play movie or music file. The only way I able to adjust is through these methods timeBeginPeriod
and timeEndPeriod
. So that my program can successfully talk through serial port. My program is to be talking back and forth every few milliseconds nonstop 24/7/365 days. It is critical that its communication is 90% or more. After having imported the dll file, my programs communication is flawless on windows and linuxs except I am getting that annoying messagebox on Linux under mono.
I've never seen or heard of such an issue before. Does anyone why?
Thanks,