![]() |
Telelogic TAU (steve huntington) | ![]() |
Topic Title: "GENERAL" type of Add-in Topic Summary: Created On: 9-Mar-2007 09:07 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I implemented a Add-in with MFC DLL, when I set it "GENERAL" type in *.mod file, but it's not launched.
I think someting should be called before the add-in does work(i.e Add Command to MENU etc.  ![]() How can I get some API between TAU IDE and MFC DLL add-in? TAU help document has no anything about it. |
|
![]() |
|
![]() |
|
James
I've not done what you are trying, but I think the usual way to invoke your DLL would be as an agent. One way would be to use a tcl addin which provides the menu comamnds and then when the command is selected the script invokes the agent implemented in your DLL. Look at the InvokeAgent API call HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company Edited: 9-Mar-2007 at 10:42 by Ian Barnard |
|
![]() |
|
![]() |
|
Normally you also need a small Tcl script (I usually call it the same name as the addin) in the Script directory. This script sets up Tau menus, buttons, etc. Then when a Tcl menu is activated it can make a cal into the DLL for you. So the MOD file might look like this:
[Patterns] "scope"="PROJECT" "version"="1.0" "longname"="Patterns Templates" "description"="Provides Patterns for System and Software Architecture." "product"="elvis" [Patterns/Bin] "listBin"="" [Patterns/Script] "listScript"="load.tcl" [Patterns/Etc] "listEtc"="urn:u2:addins/Patterns/etc/Patterns.u2" Scope = GENERAL, you have to be careful because no u2 resources are loaded. That is mostly used for customizations that are always needed. In the above example I run a small tcl script when the add-in is loaded, that's where you can create menus, etc and where your DLL would be called from. Here's the load.tcl file (I know, I broke my own rule here...): package require commands package require dialogs global debugging set debugging 0 proc DebugOutput { s } { global debugging if { $debugging != 0 } { Output $s } } source [file join [std::GetInstallationDirectory] addins Patterns Script utils.tcl] source [file join [std::GetInstallationDirectory] addins Patterns Script PatternMenu.tcl] proc Init {} { output "Initializing Patterns addin...\n" set ProfilePath [file join [std::GetInstallationDirectory] addins Patterns etc Patterns.u2] output " Loading Pattern Library...\n" u2::LoadLibrary $ProfilePath } Init InitMenu output "Done.\n" this one uses a profile and other fancy stuff. Here's the InitMenu subroutine: proc InitMenu {} { AddCommand -variable vScan -name "Scan for User-Defined Patterns" -statusmessage "Scan model for user-defined patterns" -accelerator "" -imagefile "" -tooltip "" -OnActivateCommand "ScanUserModel" AddMenu -variable mScan -commands vScan -path {Patterns} AddCommand -variable vHelp -name Help -statusmessage "Help on Patterns Add-In" -accelerator "" -imagefile "" -tooltip "" -OnActivateCommand "PatternHelp" AddMenu -variable mHelp -commands {separator vHelp} -path {Patterns} -position last output " Creating dynamic menus...\n" # Find and scan the Pattern add-in model for patterns ScanPatternModel void # Scan user model for potential patterns ScanUserModel void } The key part is the OnActivateCommand, where you call a Tcl routine that can then invoke an external function. You can use std::ExecuteCOMClient to call into your DLL std::ExecuteCOMClient Invoke interactive COM client. Synopsis std::ExecuteCOMClient COMAddInProgId entityRef ?entityRef ...? Description This command is used for calling an interactive COM client that implements the interface ITtdInteractiveClient. The command takes two arguments, COMAddinProgId and one or more entityRefs, representing the programmatic id of the COM client and the model entities passed to it respectively. There are some built-in commands in Tcl for also calling external programs (like 'exec'). If you want to see what the Tau interpreter can do I usually put in something like this in the load.tcl script... std::Output "[info commands]\n" Then you can just put in a command with no arguments, it will display the parameters needed. Or, look them up on one of the many Tcl manual sites. /Greg ------------------------- Greg Gorman Vice President, Product Management Modeling and Test Products Telelogic AB |
|
![]() |
Telelogic TAU
» TAU/Developer
»
"GENERAL" type of Add-in
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.