News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AddIn support

Started by Biterider, May 07, 2005, 06:06:23 PM

Previous topic - Next topic

Biterider

Hi KetilO
The last 2 days I have been working on my first AddIn for RadASM using ObjAsm32. I must say, that it was easier than I thought thanks to the smart organization you have chosen.
I have some questions and suggestions to do:

1.   The structure ADDINOPT should be in the RadASM.inc file. I don't know if there are more structures for AddIns, it is the only one I missed there.
2.   Add versioning to the RadASM.inc file
3.   When you modify any option of an AddIn, you send a WM_CLOSE message and then call the InstallDll and any other message between. Is it right?
4.   What about the return values of the DllProc calls?
5.   I don't know how to use some messages like AIM_CODEINFO. Do you have something like a reference or help file about it?
6.   I found a little typo in the "File Association" menu (Version 2.2.0.0)
7.   I experienced a problem adding items to the main menu. I follow the code from other AddIns, but some submenus don't let them change until you load the AddIn from within RadASM. The Edit submenu, i.e. don't expose this strange behaviour. (?)
8.   Can you publish the Menu ID to facilitate the insertion of new items in the right position?

I add in the attachment my code that for the moment simply minimizes the RadASM window when you successfully compile and run your application.

Regards,

Biterider


[attachment deleted by admin]

KetilO

Hi Biterider

1. Ok
2. Ok
3. Addin manager sends an AIM_CLOSE (WM_CLOSE) and then installs the addin again.
4. Normally return FALSE. Returning TRUE prevents other addins to get the message.
   Some messages returns a pointer to text.
5. If you respond to this message and returns a pointer to text the text will be shown in the info tool.
6. Will be fixed.
7. RadASM rebuilds some sub menus (make, tools, macro and help) when a project is loaded.
  Respond to AIM_MENUREBUILD and re insert your menu items.
8. You will find all the ID's in the language pack or the Flip Case addin (not updated latly).

If you need the names:


IDR_MDIMENU equ 999
IDM_FILE_NEWPROJECT equ 40001
IDM_FILE_OPENPROJECT equ 40002
IDM_FILE_CLOSEPROJECT equ 40003
IDM_FILE_DELETEPROJECT equ 40013
IDM_FILE_NEWFILE equ 40004
IDM_FILE_OPENFILE equ 40005
IDM_FILE_OPENHEX equ 40014
IDM_FILE_REOPENFILE equ 41021
IDM_FILE_CLOSEFILE equ 40006
IDM_FILE_SAVEFILE equ 40007
IDM_FILE_SAVEFILEAS equ 40008
IDM_FILE_SAVEALLFILES equ 40009
IDM_FILE_RECENT equ 40990
IDM_FILE_PAGESETUP equ 40010
IDM_FILE_PRINT equ 40011
IDM_FILE_EXIT equ 40012

IDM_EDIT_UNDO equ 41001
IDM_EDIT_REDO equ 41002
IDM_EDIT_EMPTY_UNDO equ 41022
IDM_EDIT_CUT equ 41003
IDM_EDIT_COPY equ 41004
IDM_EDIT_PASTE equ 41005
IDM_EDIT_DELETE equ 41006
IDM_EDIT_SELECTALL equ 41007
IDM_EDIT_FIND equ 41008
IDM_EDIT_FINDNEXT equ 41009
IDM_EDIT_FINDPREVIOUS equ 41010
IDM_EDIT_REPLACE equ 41011
IDM_EDIT_GOTOLINE equ 41012
IDM_EDIT_EXPANDBLOCK equ 41018
IDM_EDIT_FINDWORD equ 41101
IDM_EDIT_FIND_NEXT_WORD equ 41020
IDM_EDIT_FINDPROC equ 41102
IDM_EDIT_RETURN equ 41103
IDM_EDIT_BOOKMARK equ 44016
IDM_EDIT_NEXTBM equ 41105
IDM_EDIT_PREVIOUSBM equ 41106
IDM_EDIT_TOGGLEBM equ 41104
IDM_EDIT_CLEARBM equ 41107

IDM_EDIT_GOTOBM equ 41990
IDM_EDIT_GOTOBM0 equ 41300
IDM_EDIT_GOTOBM1 equ 41301
IDM_EDIT_GOTOBM2 equ 41302
IDM_EDIT_GOTOBM3 equ 41303
IDM_EDIT_GOTOBM4 equ 41304
IDM_EDIT_GOTOBM5 equ 41305
IDM_EDIT_GOTOBM6 equ 41306
IDM_EDIT_GOTOBM7 equ 41307
IDM_EDIT_GOTOBM8 equ 41308
IDM_EDIT_GOTOBM9 equ 41309

IDM_TAB1 equ 41401
IDM_TAB2 equ 41402
IDM_TAB3 equ 41403
IDM_TAB4 equ 41404
IDM_TAB5 equ 41405
IDM_TAB6 equ 41406
IDM_TAB7 equ 41407
IDM_TAB8 equ 41408
IDM_TAB9 equ 41409
IDM_TAB10 equ 41410

IDM_EDIT_BREAKPOINT equ 44017
IDM_EDIT_TOGGLEBP equ 41013
IDM_EDIT_CLEARBP equ 41014
IDM_EDIT_ADDVAR equ 41015

IDM_EDIT_ERROR equ 44018
IDM_EDIT_NEXTERROR equ 41016
IDM_EDIT_CLEARERRORS equ 41017
IDM_EDIT_BLOCK equ 44019
IDM_EDIT_BLOCKMODE equ 44015
IDM_EDIT_BLOCK_INSERT equ 44020
IDM_EDIT_HIDEBLOCK equ 43009
IDM_EDIT_OPEN equ 41019

IDM_VIEW_TOOLBAR equ 42001
IDM_VIEW_TOOLBOX equ 42002
IDM_VIEW_OUTPUTWINDOW equ 42003
IDM_VIEW_PROJECTBROWSER equ 42004
IDM_VIEW_PROPERTIES equ 42005
IDM_VIEW_TABTOOL equ 42006
IDM_VIEW_INFOTOOL equ 42008
IDM_VIEW_TOOL1 equ 42009
IDM_VIEW_TOOL2 equ 42010
IDM_VIEW_STATUSBAR equ 42007

IDM_FORMAT_INDENT equ 43001
IDM_FORMAT_OUTDENT equ 43002
IDM_FORMAT_COMMENT equ 43003
IDM_FORMAT_UNCOMMENT equ 43004
IDM_FORMAT_CONVERT equ 43990
IDM_FORMAT_SPCTOTAB equ 43501
IDM_FORMAT_TABTOSPC equ 43502
IDM_FORMAT_UCASE equ 43503
IDM_FORMAT_LCASE equ 43504
IDM_FORMAT_TRIM equ 43505
IDM_FORMAT_LOCKCONTROLS equ 43005
IDM_FORMAT_SENDTOBACK equ 43006
IDM_FORMAT_BRINGTOFRONT equ 43007
IDM_FORMAT_SHOWGRID equ 43008
IDM_FORMAT_ALIGN equ 43991
IDM_FORMAT_ALIGN_LEFT equ 43901
IDM_FORMAT_ALIGN_CENTER equ 43902
IDM_FORMAT_ALIGN_RIGHT equ 43903
IDM_FORMAT_ALIGN_TOP equ 43904
IDM_FORMAT_ALIGN_MIDDLE equ 43905
IDM_FORMAT_ALIGN_BOTTOM equ 43906
IDM_FORMAT_SIZE equ 43992
IDM_FORMAT_SIZE_WIDTH equ 43911
IDM_FORMAT_SIZE_HEIGHT equ 43912
IDM_FORMAT_SIZE_BOTH equ 43913

IDM_PROJECT_ADDNEW equ 44990
IDM_PROJECT_ADDEXISTING equ 44991
IDM_PROJECT_ADDNEWASM equ 44101
IDM_PROJECT_ADDNEWINC equ 44102
IDM_PROJECT_ADDNEWRC equ 44103
IDM_PROJECT_ADDNEWTXT equ 44104
IDM_PROJECT_ADDNEWDIALOG equ 44105
IDM_PROJECT_ADDNEWMENU equ 44106
IDM_PROJECT_ADDNEWMODULE equ 44107
IDM_PROJECT_ADDNEWFILE equ 44108
IDM_PROJECT_ADDEXISTINGFILE equ 44201
IDM_PROJECT_ADDEXISTINGDIALOG equ 44202
IDM_PROJECT_ADDEXISTINGMENU equ 44203
IDM_PROJECT_ADDEXISTINGOBJ equ 44205
IDM_PROJECT_ADDEXISTINGMODULE equ 44206
IDM_PROJECT_ACCELERATOR equ 44011
IDM_PROJECT_RESOURCE equ 44001
IDM_PROJECT_STRINGTABLE equ 44007
IDM_PROJECT_VERINF equ 44002
IDM_PROJECT_LANGUAGE equ 44013
IDM_PROJECT_GROUPS equ 44010
IDM_PROJECT_SET_ASSEMBLER equ 44992
IDM_PROJECT_EXPORTTOOUTPUT equ 44003
IDM_PROJECT_REMOVE equ 44004
IDM_PROJECT_TEMPLATE equ 44005
IDM_PROJECT_OPTIONS equ 44006
IDM_PROJECT_MAINFILES equ 44009
IDM_PROJECT_TLINK equ 44993
IDM_TLINK_NOTE equ 44701
IDM_TLINK_BUG equ 44702
IDM_TLINK_TODO equ 44703
IDM_PROJECT_REFRESH equ 44008
IDM_PROJECT_SCANPROJECT equ 44012

IDM_TOOLS_SNIPLETS equ 46001
IDM_TOOLS_EXPORT equ 46002

IDM_WINDOW_SPLIT equ 47009
IDM_WINDOW_CLOSE equ 47001
IDM_WINDOW_CLOSEALL equ 47002
IDM_WINDOW_NEXTWINDOW equ 47003
IDM_WINDOW_PREVIOUS equ 47004
IDM_WINDOW_EDIT equ 47013
IDM_WINDOW_PROJECT equ 47014
IDM_WINDOW_PROPERTY equ 47015
IDM_WINDOW_OUTPUT equ 47016
IDM_WINDOW_TILEHOR equ 47005
IDM_WINDOW_TILEVER equ 47006
IDM_WINDOW_CASCADE equ 47007
IDM_WINDOW_ARRANGEICONS equ 47008
IDM_WINDOW_MAXIMIZE equ 47010
IDM_WINDOW_RESTORE equ 47011
IDM_WINDOW_MINIMIZE equ 47012

IDM_OPTION_LANGUAGE equ 44022
IDM_OPTION_EDIT equ 48003
IDM_OPTION_COLORS equ 48001
IDM_OPTION_PRNCOLORS equ 48015
IDM_OPTION_DIALOG equ 48004
IDM_OPTION_FONTS equ 44014
IDM_OPTION_ACCEL equ 48017
IDM_OPTION_FILEASS equ 44021
IDM_OPTION_FILEBROWSER equ 48012
IDM_OPTION_EXTERNALFILE equ 48013
IDM_OPTION_SNIPLET equ 48005
IDM_OPTION_PATHS equ 48006
IDM_OPTION_TOOLWINDOWS equ 48011
IDM_OPTION_MAKEMNU equ 48007
IDM_OPTION_TOOLMNU equ 48008
IDM_OPTION_HELPMNU equ 48009

IDM_MACRO_RECORD equ 46301
IDM_MACRO_MANAGE equ 46303

IDM_HELP_ABOUT equ 49001

IDM_MAKE_COMPILERC equ 20001
IDM_MAKE_ASSEMBLE equ 20002
IDM_MAKE_BUILD equ 20004
IDM_MAKE_GO equ 20005
IDM_MAKE_RUN equ 20006

IDM_HELPF1 equ 41902
IDM_HELPCF1 equ 41903
IDM_HELPSF1 equ 41904
IDM_HELPCSF1 equ 41905

IDR_PROMENU equ 998
IDM_PROMNU_FILEPROP equ 50001
IDM_PROMNU_REMOVE equ 50002
IDM_PROMNU_RENAME equ 50024
IDM_PROMNU_LOCK equ 50003
IDM_PROMNU_AUTOLOAD equ 50004
IDM_PROMNU_COPY equ 50014

IDM_OUTPUT_OPEN equ 50005
IDM_OUTPUT_SAVE equ 50006
IDM_OUTPUT_UNDO equ 50007
IDM_OUTPUT_REDO equ 50008
IDM_OUTPUT_CUT equ 50101
IDM_OUTPUT_COPY equ 50102
IDM_OUTPUT_PASTE equ 50103
IDM_OUTPUT_DELETE equ 50104
IDM_OUTPUT_CLEAR equ 50105
IDM_OUTPUT_COPYALL equ 50106
IDM_OUTPUT_CUTALL equ 50107

IDM_FILE_CUT equ 50009
IDM_FILE_COPY equ 50010
IDM_FILE_PASTE equ 50011
IDM_FILE_DELETE equ 50012
IDM_FILE_RENAME equ 50013
IDM_FILE_COPYNAME equ 50015
IDM_FILE_EXPLORE equ 50023

IDM_PROPERTY_GOTO equ 50016
IDM_PROPERTY_SCAN equ 50021
IDM_PROPERTY_FIND equ 50018
IDM_PROPERTY_FINDNEXT equ 50019
IDM_PROPERTY_FINDPREV equ 50020
IDM_PROPERTY_COPY equ 50017
IDM_PROPERTY_PROTO equ 50022

IDM_USERBTN1 equ 29991
IDM_USERBTN2 equ 29992


KetilO

Biterider

Hi KetilO
Thanks for the prompt response. The AIM_MENUREBUILD does the trick!
I found some things that I think doesn't work right

1. If you disable various AddIns simultaneously, RadASM crashes.
2. Moving the Properties Window to the middle if the RadASM window and back again, it remains a painted copy if it in the old position. It seems so, as it needs a redrawing operation
3. In the context menu of the Project window, there is an item called "Project groups". Can you explain how to work with? I don't know how to enable the groups to appear on the TreeView to drop files on it.
4. Are you using ID for the main menu items? This will facilitate seeking of items, specially if new ones are inserted in between. Example: IDM_EDIT  equ 41000. Additionally you don't need to inspect the fMaximized flag to locate a main menu item.
5. I suggest to move the MenuIDs to the RadASM.inc file. By this way, the main RadASM application and the AddIns will keep in phase.

I'll take a close look at the written AddIns to learn how they do the things they do, but I'm wondering where they got the info to write the code... Simply asking?

Regards,

Biterider



KetilO

Hi Biterider

1. It is probably some addin that does not handle undo subclassing correctly.
2. Cant make it happend here. Does it happend only with properties?
3. There is a project option and a button on the project toolbar.
4. Numbered from 49900 and up.
5. I will think about it.

KetilO

KetilO

There was a bug in addin manager when uninstalling more than one addin.
Here is the fixed version.

KetilO

[attachment deleted by admin]

Biterider


Biterider

Hi KetilO
About point 2, it happens only with the Properties Pane

Regards

Biterider

Biterider

Hi KetilO
I want to add language support to my AddIn too. I guess that it is something related to the AIM_LANGUAGECHANGE message. Can you shortly describe the strategy you are following to change the language setting. Have you predefined constants for each language? What languages are supported jet?

Regards,

Biterider

Biterider

Hi KetilO
I have solved the DblClick problem using the REM_GETWORD message. The next thing is I have a method name, how can I jump to the definition file and line like it is done with the properties?

Regards

Biterider

KetilO

Hi Biterider

Current translations:

Chinese, English, German, Hebrew, Korean, Norwegian, Portuguese(Brazil), Russian, Spanish and Ukrainian


; Addins language translations

; A language file is a unicode ini file.
; To have a string translated you call predefined functions.

; Conventions for addins:
; -----------------------
; App name must be the dll name without extention.
; Menu item translations start at 2000.
; Options translations start at 3000.
; Tooltip translations start at 4000.

;--------------------------------------------------------------------------------
; Translating menuitem

.elseif eax==AIM_ADDINSLOADED
; Update menu text
push sizeof buffer/2
lea eax,buffer
push eax
push 2000
push offset szAppName
mov eax,lpProc
call [eax].ADDINPROCS.lpGetLangString
.if eax
mov mii.cbSize,sizeof MENUITEMINFO
mov mii.fMask,MIIM_TYPE
mov mii.fType,MFT_STRING
lea eax,buffer
mov mii.dwTypeData,eax
mov edx,lpHandles
invoke SetMenuItemInfoW,[edx].ADDINHANDLES.hMenu,IDAddIn,FALSE,addr mii
.endif

;--------------------------------------------------------------------------------
; Translating menuitem when menuitem needs rebuilding

AddMenu proc
LOCAL nMnu:DWORD
LOCAL hMnu:DWORD

mov nMnu,6
;Adjust topmost popup if maximized.
mov eax,[lpDStruct]
mov eax,(ADDINDATA ptr [eax]).fMaximized
.if eax
inc nMnu
.endif
;Get handle of menu
mov eax,[lpHStruct]
mov eax,(ADDINHANDLES ptr [eax]).hMenu
;Get handle of Tools popup
invoke GetSubMenu,eax,nMnu ;Tools menu
mov hMnu,eax
;Add our menuitem
invoke AppendMenu,hMnu,MF_STRING,AsciiMenuID,addr szAsciiMenu
ret

AddMenu endp

.elseif eax==AIM_ADDINSLOADED || eax==AIM_MENUREBUILD
.if eax==AIM_MENUREBUILD
invoke AddMenu
.endif
; Update menu text
push sizeof buffer/2
lea eax,buffer
push eax
push 2000
push offset szAppName
mov eax,lpProc
call [eax].ADDINPROCS.lpGetLangString
.if eax
mov mii.cbSize,sizeof MENUITEMINFO
mov mii.fMask,MIIM_TYPE
mov mii.fType,MFT_STRING
lea eax,buffer
mov mii.dwTypeData,eax
mov edx,lpHandles
invoke SetMenuItemInfoW,[edx].ADDINHANDLES.hMenu,IDAddIn,FALSE,addr mii
.endif

;--------------------------------------------------------------------------------
; Translating tooltip

.elseif eax==AIM_TBRTOOLTIP
mov eax,wParam
.if eax==AsciiMenuID
push sizeof szBuff/2
push offset szBuff
push 4000
push offset szAppName
mov eax,lpPStruct
call [eax].ADDINPROCS.lpGetLangString
.if !eax
; No translation, show default
mov eax,offset szAsciiToolTip
xor edx,edx
.else
mov eax,offset szBuff
; To tell RadASM it's unicode
mov edx,123456
.endif
ret
.endif

;--------------------------------------------------------------------------------
; Showing modal dialog. Needed to support Win95, 98 and Me

push NULL
push offset DialogProc
push hWin
push IDD_DLGADDINMANA
push hInstance
mov eax,lpProc
call [eax].ADDINPROCS.lpModalDialog

;--------------------------------------------------------------------------------
; Showing modeless dialog. Needed to support Win95, 98 and Me

push NULL
push offset DialogProc
push hWin
push IDD_DLGADDINMANA
push hInstance
mov eax,lpProc
call [eax].ADDINPROCS.lpModelessDialog

;--------------------------------------------------------------------------------
; Translating dialog, sets selected font and magnify.

.if eax==WM_INITDIALOG
push FALSE ;FALSE==Magniufy, TRUE==No Magnify
push offset szAppName
push hWin
mov eax,lpProc
call [eax].ADDINPROCS.lpSetLanguage

;--------------------------------------------------------------------------------
; Sample English translation for Addin manager addin

[AddinMana]
AddinMana=RadASM Addin Manager
1=OK
2=Cancel
10=Apply
1032=Install
1033=Uninstall
1001=Addins:
1002=Options
1003=Info
1004=Description:
1005=Author:
1006=Version:
1007=Date:
2000=Addin Manager
3000=Enable

;--------------------------------------------------------------------------------
; Sample English translation for Project zip addin

[ProjectZip]
ProjectZip=RadASM project zipper
2=Exit
1002=Zip && E-Mail
1004=Zip
1007=Select all
1009=Zip To:
1010=Current:
2000=Project Zipper
3000=Enable Project zipper
3001=Add date to zipname

;--------------------------------------------------------------------------------
; Sample English translation for Ascii Table addin

[asciiTab]
asciiTab=Esc to exit
2000=Ascii Table
3000=Enable Ascii Table
4000=Ascii Table

;--------------------------------------------------------------------------------


KetilO

KetilO

If the declaration is parsed to the radasm wordlist:

1. Find the word in the wordlist and get the file ID.
2. Translate the file id to a filename.
3. Open the file and find the declaration.

If the declaration is NOT parsed to the radasm wordlist you must scan all the files in the project.

Example: CppParse.dll, ReallyRad addin.

KetilO

Biterider

Hi KetilO
Finally quite almost works. It remains a little administrative work...
2 questions:

1. How do you fix the output window in its open state?
2. How can I switch programmatically between the 3 output windows?

Regards,

Biterider

KetilO

Hi Biterider

1. Give it focus:

mov eax,lpHandles
invoke SetFocus,[eax].ADDINHANDLES.hOutREd

2. Wit this code:

push 1 ;select output1, 2 or 3
mov eax,lpProcs
call [eax].ADDINPROCS.lpOutputSelect


KetilO

Biterider

#13
Hi KetilO
I think I have the beta version ready. If you have time, would you take a look at it?
Features:
- Variable usage check for methods
- Register preservation check for methods
- Output to pane #2

Regards,

Biterider

KetilO

Hi Biterider

Still missing RA_AddIn_Notes.inc

The addin looks great. It will however take some time to read and understand your code, so don't expect any feedback on that yet.

Suggestions:
Would it not be nice if the entire project was checked.
Disable menu if not a masm project.

KetilO