OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Unsharp Mask dialog box (http://forum.oberonplace.com/showthread.php?t=1608)

geHucKa 03-07-2006 15:10

Unsharp Mask dialog box
How I can show standard Unsharp Mask dialog box from my code?

wOxxOm 04-07-2006 12:17


' 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:

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
End Sub

To interrupt code execution press Ctrl-Break on keyboard

geHucKa 04-07-2006 17:38

Thanks. I understood basics of this method.

Alex 04-07-2006 21:42

Or you can use a program such as Spy++ to tap into application message loop and see what messages it receives. Filter WM_COMMAND only and start executing various menu commands and see what actual messages are sent to the application.

Unfortunately (or maybe fortunately for some), CorelDRAW is going away from standard windows UI implementation in sake of data binding. Many new commands in CorelDRAW 13 no longer send messages or have message handlers for. They use internal data binding mechanism which causes some internal code to be called directly when a menu or toolbar item is clicked. No WM_COMMAND is posted in this case...

All times are GMT -5. The time now is 15:18.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com