View Single Post
  #2  
Old 04-07-2006, 12:17
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

Code:
' this declare should be in MODULE of project (not Form and not Class) in the very top of code, before any other user-defined procedures or functions
'
Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd&, ByVal Msg&, ByVal wParam&, ByVal lParam&)

' this is an example to invoke UnsharpMaskDialog, provided bitmap shape is currently selected
Sub callUnsharpMask()
   SendMessage AppWindow.Handle, &H111, &H1D70F, 0
End Sub
Anatomy of SendMessage in this case is -
1. we notify main CorelDRAW application which is described by AppWindow object, Handle property
2. we send WM_COMMAND=273 = &h111 in hex notation which I like
3. we send 55055 code (d70f in hex) prefixed by &h1 which means that higher word equals 1
4. zero is obligatory parameter which is ignored internally

To investigate all possible values and their visual equivalents you may write a loop:
Code:
Sub enumCommands()
Dim i&, t!, s$, ss$
For i = 50000 To 60000
   t = Timer
   SendMessage AppWindow.Handle, &H111, &H10000 + i, 0
   If Timer - t > 0.1 Then
      ss = CStr(i) + vbTab + InputBox(CStr(i), "Enter description")
      Debug.Print ss
      s = s + ss + vbNewLine
   End If
Next
End Sub
To interrupt code execution press Ctrl-Break on keyboard
Reply With Quote