OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-07-2007, 09:41
zoid
Guest
 
Posts: n/a
Default HowTo "Invoke"

Another question:

As i heard

Code:
Application.FrameWork.Automation.Invoke "7da36c72-627c-4782-b51a-01718a43551b"
should invoke a command from the gui. I found the id in the DrawUI.xml file, but there is no method called automation.invoke in my application.framework.

I am using vb6 with corel x3 libraries.
Reply With Quote
  #2  
Old 05-07-2007, 09:54
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

use vgcore typelib
c:\Program Files\Corel\CorelDRAW Graphics Suite 13\Programs\vgcoreauto.tlb

{95E23C91-BC5A-49F3-8CD1-1FC515597048}
"Corel - Vector Graphics Core 13.0 Type Library"
Reply With Quote
  #3  
Old 05-07-2007, 10:03
zoid
Guest
 
Posts: n/a
Default

Just looked at the project references and the vgcore lib hast the highest possible priority (after the standard VB libs) and is also checked (path is also right)

I also recognized that the autocompleter doesn't even have a "FrameWork" , but if I type it in by hand he knows some additional methods:

-CommandBars
-MainMenu
-Name
-StatusBar
-ImportWorkspace

... but no Automation.Invoke , and also no autocompletion after automation possible.
Reply With Quote
  #4  
Old 05-07-2007, 10:09
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

no autocompletion is ok since the object is marked hidden - check your ClassBrowser docker options for "Show hidden"

Edit:
sorry, this is a new method of DrawX3
you should use
Code:
SendMessage AppWindow.Handle, &H111, 65536 + 33885, 0
to know the values for UI elements you can use api spy or check Strings resource in c:\Program Files\Corel\Corel Graphics 12\Languages\EN\Programs\VGCoreIntl.dll

Last edited by wOxxOm; 05-07-2007 at 10:17.
Reply With Quote
  #5  
Old 05-07-2007, 10:20
zoid
Guest
 
Posts: n/a
Default

Ok, normally i'm coding c/c++ applications, so I don't find everything on first click

I found the Class FrameWork in the VGCore Lib, but there's still no automation.invoke part :/

Using CorelDraw X3 13.0.0.576

Thx for your patience

€: Thx , will try that out now
Reply With Quote
  #6  
Old 05-07-2007, 10:28
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

check that you have hidden members shown.
Also C++ may not like that Invoke method has the same name as IUknown interface Invoke, though I'm not sure since I don't code in c

here's part of typelib:

Code:
[
      uuid({A2524E99-50C1-11D3-8EA3-0090271BECDD}),
      helpstring("Internal Automation - Do not use")
    ]
    dispinterface Automation
    {
        properties:
        methods:
            [id(0), restricted] void QueryInterface(
                            [in] GUID* riid, 
                            [out] void** ppvObj);
            [id(1), restricted] unsigned long AddRef();
            [id(2), restricted] unsigned long Release();
            [id(3), restricted] void GetTypeInfoCount([out] unsigned int* pctinfo);
            [id(4), restricted] void GetTypeInfo(
                            [in] unsigned int itinfo, 
                            [in] unsigned long lcid, 
                            [out] void** pptinfo);
            [id(5), restricted] void GetIDsOfNames(
                            [in] GUID* riid, 
                            [in] char** rgszNames, 
                            [in] unsigned int cNames, 
                            [in] unsigned long lcid, 
                            [out] long* rgdispid);
            [id(6), restricted] void Invoke(
                            [in] long dispidMember, 
                            [in] GUID* riid, 
                            [in] unsigned long lcid, 
                            [in] unsigned short wFlags, 
                            [in] DISPPARAMS* pdispparams, 
                            [out] VARIANT* pvarResult, 
                            [out] EXCEPINFO* pexcepinfo, 
                            [out] unsigned int* puArgErr);
            [id(7)] long GetNumItemsOnBar([in] BSTR guidBar);
            [id(8)] BSTR GetItem(
                            [in] BSTR guidBar, 
                            [in] long Index, 
                            [out] boolean* hasSubBar);
            [id(9)] long GetItemInstanceHwnd(
                            [in] BSTR guidParent, 
                            [in] BSTR guidItem);
            [id(10)] boolean GetSubBar(
                            [in] BSTR guidBar, 
                            [out] BSTR* guidSubBar);
            [id(11)] boolean ShowBar(
                            [in] BSTR guidBar, 
                            [in] boolean show);
            [id(12)] BSTR GetCaptionText([in] BSTR guidItem);
            [id(13)] void Invoke([in] BSTR guidItem);
            [id(14)] boolean IsEnabled([in] BSTR guidItem);
    };
Reply With Quote
  #7  
Old 05-07-2007, 10:41
zoid
Guest
 
Posts: n/a
Default

Do i get that right, I do not net the invoke command?

just the

SendMessage ... with the right params?
Reply With Quote
  #8  
Old 05-07-2007, 10:50
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

imho all the UI menu elements can be fired via SendMessage. That example I gave earlier addresses Simplify. All arguments are invariable except an ID being added: "+33885" which you can vary of course to invoke some other Draw command
Reply With Quote
  #9  
Old 05-07-2007, 10:55
zoid
Guest
 
Posts: n/a
Default

so

Code:
SendMessage AppWindow.Handle, &H111, 65536 + 33885, 0
&H111, 65536 and 0 are arguments to adress cdr and the id is the function number?

need to reassembly VGCoreIntl.dll now
Reply With Quote
  #10  
Old 05-07-2007, 11:04
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

:-) it's easier
AppWindow.Handle is of course Draw main window's handle
&h111 = 273 = WM_COMMAND
65536 = 1 in hiword of wParam, see below wNotifyCode
+ 33885 is loword of wParam = MenuCommand ID
0 = control's hwnd which is unused

no need to tweak dll, just use any resource browser and search for an exact menu command notation, including ampersand before highlighted letter

Quote:
WM_COMMAND
wNotifyCode = HIWORD(wParam); // notification code
wID = LOWORD(wParam); // item, control, or accelerator identifier
hwndCtl = (HWND) lParam; // handle of control

wNotifyCode
Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.

wID
Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator.

hwndCtl
Value of lParam. Identifies the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto uniquely identify a shape in VBA code jemmyell CorelDRAW/Corel DESIGNER VBA 9 11-02-2005 21:05


All times are GMT -5. The time now is 16:58.


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