Is there a way to center the message box over the current form ?

This is not a feature that is built into the MessageBox class and the message box is always centered over the desktop.  I have found some examples written in C# on how to do this but they run for many lines of code and my C# training is not far enough along to where I can translate them into Visual COBOL.  Has anyone written a routine for this in Visual COBOL ?  Our other option would be to write our own message class or use a third-party control that allows positioning.

Tags:

Parents
  • Verified Answer

    The ManagedThreadId will not work with this approach as it is strictly a managed solution and we are passing the threadId to native code at this point.

    From what I have read, you should be able to use GetCurrentThreadId without a problem.

    You could also try the following if your application is running on a single thread:

       set threadid to type Process::GetCurrentProcess::Threads[0]::Id

    Thanks

Reply
  • Verified Answer

    The ManagedThreadId will not work with this approach as it is strictly a managed solution and we are passing the threadId to native code at this point.

    From what I have read, you should be able to use GetCurrentThreadId without a problem.

    You could also try the following if your application is running on a single thread:

       set threadid to type Process::GetCurrentProcess::Threads[0]::Id

    Thanks

Children
No Data