Hi Guys,
Need to reduce size of message box as shown in the fig,
Message box is created using MDL Function ( mdlDialog_dmsgsPrint (Text); )
Haven't tried this on DMSGS dialog box but on others.
The strategy is:
1. traverse all open windows/views/dialogboxes using:
mdlWindow_getFirst .... mdlWindow_getNext
2. for each found window check whether it is of a proper type and then extract its title and compare to string "Messages" using:
mdlWindow_is... .... mdlWindow_titleGet .... strcmp
3. once found, resize it using:
mdlWindow_extentSet
Cheers,
/Chris Z.
Chris's approach is a good and flexable one.
[START UPDATED RESPONSE]
2013/10/14 RH: Please note that the MicroStation (DMSG) Messages Window is a mult-purpose window that can be used by serveral applications. In fact, users may need to resize the window to see those messages at times and may not like having to resize the Messages Window or close it out every so often. There are a number of other alternatives available for application developers to present and log application level messages including the preferred method of utilizing MicroStation's Message Center messaging (MessageCenter.AddMessage) that administrators, users, and application developers alike should intuitively know to review for informational output or errors. In the message center you can assign a priority (Priority:=) appropriate to the information or error level you wish to present along with output that can readily be saved to a text file when needed. If you are simply debugging and do not want to present a dialog to the user you can use Microsoft VBA's Debug.Print functionality that reports to the Microsoft VBA Immediate Window (Alt+F11, Ctrl+G). Microsoft VBA's MsgBox() function can be used and present a priority to the user to respond to using a number of different standardized buttons (OK, Cancel, Retry, ...) that your code could present a number of options to a user so that your code can react in the most appropriate manner. Lastly, you may also want to consider creating your own application output in the form of a Dialog box Listview control that could be saved, filtered, copied to clipboard, or output to any variety of file types as needed.
[END UPDATED RESPONSE]
However if the dialog in question has a well-known/published id (in dlogids.h) like the one you are looking for, then you can use a rather direct approach. Here is some generic MicroStation VBA code you can use to resize a MicroStation Window (could also be modified slightly for View Windows) when providing a well known DialogID.
Sub TEST_WindowResize() WindowResize -94, 480, 90End SubSub WindowResize(lWindowID As Long, lWidth As Long, lHeight As Long) ' Find MicroStation Window by id and resize client rectangle Dim lRtc As Long, sCExpr As String sCExpr = "mdlWindow_extentSet(mdlDialog_find(" & lWindowID & ",0)," & lWidth & "," & lHeight & ")" lRtc = GetCExpressionValue(sCExpr) End Sub
Sub TEST_WindowResize() WindowResize -94, 480, 90End Sub
Sub WindowResize(lWindowID As Long, lWidth As Long, lHeight As Long)
' Find MicroStation Window by id and resize client rectangle Dim lRtc As Long, sCExpr As String sCExpr = "mdlWindow_extentSet(mdlDialog_find(" & lWindowID & ",0)," & lWidth & "," & lHeight & ")" lRtc = GetCExpressionValue(sCExpr) End Sub
Reference:
dlogids.h:120:#define DIALOGID_DialogMessages (-94)
HTH,
Bob