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]
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
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
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
There was a bug in addin manager when uninstalling more than one addin.
Here is the fixed version.
KetilO
[attachment deleted by admin]
Thanks
Hi KetilO
About point 2, it happens only with the Properties Pane
Regards
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
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
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
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
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
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
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
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
Hi KetilO
The Project has a base object RA_AddIn that serves me for future AddIns... The missing file is only code for myself that I took from other AddIns but it has no effect on the current AddIn. Simply ingnore it.
1. What do you mean with "the entire project was checked"?
2. OK, will do.
Regards,
Biterider
1. It seem to me that only the topmost open file is checked with Method Unused ... and Method Register ...
KetilO
OK, I got it :red
Yes, you are right. Do to my weak knowledge of how to handle more than a file a decided to check only the topmost mdi child.
One of my problems is that I don't know how to cycle trough the project files, getting their names, etc. The second one is the word lists, how are they structured?
Regards,
Biterider
.data
hFound HWND ?
.code
CheckLoadedEnumProc proc hWin:HWND,lParam:LPARAM
LOCAL buffer[MAX_PATH]:BYTE
invoke GetWindowLong,hWin,GWL_ID
; Is window mdi child
.if eax>=ID_FIRSTCHILD && eax<=ID_LASTCHILD
invoke GetWindowLong,hWin,0
; Is window code edit
.if eax==ID_EDIT
; Window caption is filename
invoke GetWindowText,hWin,addr buffer,sizeof buffer
invoke lstrcmpi,lParam,addr buffer
.if !eax
mov eax,hWin
mov hFound,eax
xor eax,eax
ret
.endif
.endif
.endif
mov eax,TRUE
ret
CheckLoadedEnumProc endp
TestFiles proc uses ebx esi
LOCAL nID:DWORD
LOCAL nMiss:DWORD
LOCAL buffer[MAX_PATH]:BYTE
LOCAL vTmp:DWORD
LOCAL hEdit:HWND
LOCAL hMem:DWORD
mov ebx,lpProc
mov ebx,[ebx].ADDINPROCS.lpGetFileNameFromID
mov nID,1
mov nMiss,0
.while TRUE
push nID
call ebx
.if eax
; eax points to filename as strored in project
mov esi,eax
; Could do file filtering here
; Get project path
mov eax,lpData
mov eax,[eax].ADDINDATA.lpProjectPath
invoke lstrcpy,addr buffer,eax
; Add filename
invoke lstrcat,addr buffer,esi
; Convert it to full pathname
invoke GetFullPathName,addr buffer,sizeof buffer,addr buffer,addr vTmp
; Check if the file is open
mov hFound,0
mov eax,[eax].ADDINHANDLES.hClient
invoke EnumChildWindows,eax,addr CheckLoadedEnumProc,addr buffer
.if hFound
; Get text from edit window
invoke GetWindowLong,hFound,GWL_USERDATA
mov hEdit,eax
invoke SendMessage,hEdit,WM_GETTEXTLENGTH,0,0
push eax
inc eax
invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,eax
mov hMem,eax
pop eax
invoke SendMessage,hEdit,WM_GETTEXT,eax,hMem
.else
; Read the file
.endif
inc nID
mov nMiss,0
.else
inc nMiss
.if nMiss>20
.if nID<1000
mov nID,1000
mov nMiss,0
.else
.break
.endif
.endif
.endif
.endw
ret
TestFiles endp
NOTE!
It is not tested. There might be typos.
KetilO
Hi KetilO
Looking at the menus I generated I found something that would interest you. Attached are 3 pictures. The first 2 are taken fron on PC and the last from a different one. Pic1 and 2 shows 2 menus of the same RadASM instance. The first comes from my AddIn compiled on this machine. Picture 3 is the same menu, but compiled on another machine. The AddIn menus supplied with your package seems to be different.
Regards
Biterider
[attachment deleted by admin]
New upload
New features:
- Object compilation (object must be in the object folder and the asm file too). Output to pane #1.
- Run on Hide option in AddIn options pane.
- Addin menu is added only for MASM projects.
- Debug macro "DbgAddInMessage" added to visualize received messages. Only active in debug modus.
Regards,
Biterider
The menu problem is known. Previously the workaround was to let AlexMenu be the last addin in RadASM.ini
That does not work with your addin. Posting a AIM_LANGUAGECHANGE (using lpDllProc) after you add the menu should solve the problem.
KetilO
Hi
The addin blanks outputwindow#2 when a file is opened or closed.
Not very nice when you are working with AsmVars addin to remove unused things.
KetilO
Hi
I intentionally made it so, since I could not jump to a not opened file by doubleclicking the MethodName in the OutpuWindow #2.
To bypass this situation I clear the output each time I switch to a new editor window. When I have those things more under control I may change it.
It would be nice to know how do you do it when you dobleclick on a method in the properties pane.
I'll see what I can do this weekend... :8)
BTW, the AIM_LANGUAGECHANGE message and the moving of the AddInManager didn't help to solve the menu drawing problem.
Regards,
Biterider
Hi KetilO
I'm implementing the missing features you pointed out and I've some new questions
1. How long is the lpFile buffer?
2. AIM_PROJECTCLOSED, AIM_PROJECTOPEN aren't sent when you open RadASM or a project. It seems like a bug... Since you have to consider that an AddIn can be started together with RadAsm or within an opened project, you have to provide a consistent way to the AddIn to get the information to start properly. :red
BTW, the macros doesn't work correctly in my version (2.2.0.0) :eek
Regards,
Biterider
Hi Biterider
Size of lpFile buffer is MAX_PATH (260 bytes).
AIM_PROJECTOPEN
Does not exist.
AIM_PROJECTOPENED
Is sendt after a project is opened.
AIM_PROJECTCLOSE
Is sendt before a project is closed.
It is also sendt even if a project is not loaded (bug?).
AIM_PROJECTCLOSED
Is sendt after a project is closed.
Possible causes if you dont get this messages:
1. You forgot to return the proper hook flag in eax.
2. Another addin returns TRUE in respons to these messages. This prevents other addins to get this message.
KetilO
Hi KetilO
It's a pity don't to have the AIM_PROJECTOPEN, but that isn't the real problem.
I scanned all AddIns for the AIM_PROJECT_CLOSED and didn't find a match so I decided to disable all AddIns and the problem remains. When you start RadASM doubleclicking at a .rap file, the following messages are sent to the AddIn:
AIM_ADDINSLOADED, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_PROJECTCLOSE, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_MENUREBUILD, hWnd = 00F6051Fh, wParam = 00000000h, lParam = 00000000h
AIM_MENUREBUILD, hWnd = 00F6051Fh, wParam = 00000000h, lParam = 00000000h
AIM_PROJECTOPENED, hWnd = 002C01E0h, wParam = 00000000h, lParam = 004540EAh
AIM_MDIACTIVATE, hWnd = 0010042Eh, wParam = 00000000h, lParam = 0010042Eh
AIM_EDITOPEN, hWnd = 0010042Eh, wParam = 000D04FAh, lParam = 0000FFDDh
...
As you can see, AIM_PROJECT_CLOSED is never send.
If I close a close a project using the menu "File/Close Project" the AddIn receives the following messages:
AIM_INITMENUPOPUP, hWnd = 002C01E0h, wParam = 00D4051Dh, lParam = 00000001h
AIM_COMMAND, hWnd = 002C01E0h, wParam = 00009C43h, lParam = 00000000h
AIM_PROJECTCLOSE, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_COMMAND, hWnd = 002C01E0h, wParam = 0000B79Ah, lParam = 00000000h
AIM_EDITCLOSE, hWnd = 0010042Eh, wParam = 000D04FAh, lParam = 0000FFDDh
AIM_EDITCLOSED, hWnd = 0010042Eh, wParam = 000D04FAh, lParam = 0000FFDDh
AIM_MDIACTIVATE, hWnd = 0010042Eh, wParam = 0010042Eh, lParam = 00000000h
AIM_COMMANDDONE, hWnd = 002C01E0h, wParam = 0000B79Ah, lParam = 00000000h
AIM_MENUREBUILD, hWnd = 00F6051Fh, wParam = 00000000h, lParam = 00000000h
AIM_PROJECTCLOSED, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_COMMANDDONE, hWnd = 002C01E0h, wParam = 00009C43h, lParam = 00000000h
AIM_TBRTOOLTIP, hWnd = 003F0238h, wParam = 0000000Eh, lParam = 00000000h
AIM_TBRTOOLTIP, hWnd = 003F0238h, wParam = 0000000Eh, lParam = 00000000h
...
Here, the AIM_PROJECTCLOSED is send. When I reopen the project I recieves the same messages like when I start RadASM.
Finally, when I create a new project using the menu "File/New Project" the following messages are received:
AIM_INITMENUPOPUP, hWnd = 002C01E0h, wParam = 00D4051Dh, lParam = 00000000h
AIM_COMMAND, hWnd = 002C01E0h, wParam = 00009C41h, lParam = 00000000h
AIM_PROJECTCLOSE, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_COMMAND, hWnd = 002C01E0h, wParam = 0000B79Ah, lParam = 00000000h
AIM_COMMANDDONE, hWnd = 002C01E0h, wParam = 0000B79Ah, lParam = 00000000h
AIM_MENUREBUILD, hWnd = 00F6051Fh, wParam = 00000000h, lParam = 00000000h
AIM_PROJECTCLOSED, hWnd = 002C01E0h, wParam = 00000000h, lParam = 00000000h
AIM_MENUREBUILD, hWnd = 00F6051Fh, wParam = 00000000h, lParam = 00000000h
AIM_PROJECTOPENED, hWnd = 002C01E0h, wParam = 00000000h, lParam = 004540EAh
AIM_COMMANDDONE, hWnd = 002C01E0h, wParam = 00009C41h, lParam = 00000000h
...
As you can see, somewhere is something wrong with the AIM_PROJECTCLOSED message. :red
Note: I guess that the AIM_PROJECTCLOSE is sent because you use a pseudo-masm-project to initialize RadASM and it is OK this way, but the AIM_PROJECTCLOSED has to be send too.
Regards,
Biterider
Hi Biterider
Yes I was a little surprised that AIM_PROJECTOPEN was not there. I will add it.
I guess that AIM_PROJECTCLOSE and AIM_PROJECTCLOSED should only be sendt if a project is really closed.
Not when RadASM is started or when a new project is created, unless it results in an open project beeing closed.
KetilO
Hi Biterider
You can get a RadASM 2202 pre release from the Source Safe thread.
It has the AIM_PROJECTOPEN message and the correct AIM_PROJECTCLOSE message.
KetilO
Hi KetilO
It works fine, thanks! :U
Biterider
Hi KetilO
I was testing the RAEdit class and I entered in an endless loop since the return value of the EM_LINEINDEX message doesn't follow the API specification. In particular it doesn't return -1 if the given line number is greater than the actual line number in the control. I solved it changing the algo. Is this behaviour change intentional?
Have you programmed the RAEdit control completely from scratch emulating all EM_ messages? :eek
Regards,
Biterider
Hi Biterider
The result of lazyness.
RAEdit is made from scratch. You can find the sources in the SimEd project on my website.
KetilO
Wow, monster source! Congrats! :thumbu
Biterider
Hi KetilO
Is there a way to add items to the context menus? The problem is to get a handle of them.
Regards,
Biterider
Hi
Use hToolMenu handle to get the popups.
Positions are:
0 - Project
1 - Output window
2 - Dialog edit
3 - File browser
4 - Properties
KetilO
Hi KetilO
I guess, one of the last questions... :P
How can I add a new accelerator?
Biterider
Hi
ADDINHANDLES.hAccel is the handle.
Note that it is rebuilt whenever you get an AIM_MENUREBUILD message.
KetilO
Hi KetilO
I have some problems with the Acceleators issue. I intercept the AIM_MENUREBUILD message to insert my ACCEL structure.
On the first call ADDINHANDLES.hAccel is 0. Under this circumstance, I create my own Accelerator table and store it in ADDINHANDLES.hAccel. on furter calls I get my handle but I get no result. :(
What I'm doing wrong?
Biterider
There is a bug in RadAsm.inc
It should be:
hTl1 dd 0 ;Handle of tool#1 static container
hTl2 dd 0 ;Handle of tool#2 static container
hHexEd dd 0 ;Handle of hex edit window
hAccel dd 0 ;RadASM Accelerators
hTbrIml dd 0 ;Imagelist for the toolbars
ADDINHANDLES ends
KetilO
Hi KetilO
I was looking for the context menu of the RA_Edit window (main editor). As I could see, it is not in the hToolMenu, so I tried to use the GetMenu api on the hEdit and hMdiCld without success :'( Where is the menu handle I'm looking for?
Regards
Biterider
Context menu for the editor is the same as the main menu Edit popup.
KetilO
Hi KetilO
I have finished the OA32 AddIn and it works like a violin. I gave it to test and if all work smoothly I'll post the sources.
I'm interested to add some sort of intellisence for the method calls (OCall, ACall, etc.) like the autocomplete feature for APIs.
I can imagine to use the wordlists, but I don't know how they are build. Can you give me some hints about them?
Perhaps a better approach is to use the code you have implemented for the API autocomplete in some way...
Regards,
Biterider
Hi Biterider
Download addins.zip from my website.
In tutorials you can find CodeComplete and ProcDump addins.
They should give you a good starting point.
KetilO
Hi KetilO
Currently I'm working on the intelisence for OA32 methods and I have now my first results. I'm not completely satisfied with the options showed in the ListBox when I type i.e. "OCall esi::" The shown items are only those defined in the project files, missing those inherited from. A possible solution is to add the missing files to the project or automatically read the missing information. The last option is in my eyes the best. To do this, I need the name of the object ancestor defined in the "Object xxx ". The property of type 11 (object) doesn't have additional information like the arguments or locals from procedures. Can you consider adding them? Also the parameters on the Method line can be very helpful. With this addition I can display parameter information when the line is being typed! :8)
BTW, where is the info stored that let you jump to the source code line when you doubleclick on an item in the property listbox?
Finally, is there a way to know the height of a text line? I need it to properly position the hLBS.
Upload updated
Regards,
Biterider
Hi Biterider
Adding parameters to Objects and Methods should not ba a big problem.
In the wordlist there is an Owner. This can be converted to a filename with a call to lpGetFileNameFromID.
From there you must do a search.
From RAEdit sources:
GetWindowLong,hEdit,0 returns a pointer to an EDIT structure. The fntinfo member points to a RAFONTINFO structure.
RAFONTINFO.fntht + RAFONTINFO.linespace givs the line height.
KetilO
I uploaded the sources to the first post of this thread.
Regards
Biterider
Hi HuMaX
From my website you can download the language pack. It contains the tool (RadLNG.exe)
and the english file (RadENG.lng) you can use to translate.
KetilO
Hi Biterider
I will try it out.
Here is the RadASM version 2.2.0.2 with the methods and objects parameters parsed to wordlist.
KetilO
[attachment deleted by admin]
Hi Biterider
A few suggestions.
1. Case insensitive intellisence
2. Check if listbox goes off screen and if so put it abowe active line.
Undoing subclassing of RadASM windows is a pain since another addin might also subclass the same windows.
The included addin project shows how it should be done.
KetilO
[attachment deleted by admin]
Hi HetilO
Thanks for the revision! I'll correct the above mentioned points. :U
Currently I'm checking how to add the inherited object methods to the intellisence as well.
I have a suggestion that I forgot to mention earlier. When you create a new and unsaved file, you call it "(Untitled)". With this unspecific name, it is difficult to to find the corresponding editor again when your are looping through all project related and opened files. A better solution is to add an index number to the name like "(Untitled 1)".
Regards,
Biterider
Hi HuMaX
I have heard someone else complain about that. I don't know why.
It runs just fine on the XP machines I have access to.
It will NOT run on 95/98 or Me since it uses unicode.
On your XP you can use notepad to edit the lng file. Remember to save it as unicode.
KetilO
Hi KetilO
I have coded the AddIn I recently posted based on the sources of the CodeComplete AddIn. I changed the approach shown there since the way it subclasses the RA_Edit windows does not contemplate all AddIn activation cases. I.e., when you have 2 open RA_Edit windows and you activate the AddIn, none of them are subclassed. On the other hand, if you deactivate the AddIn and some instances of the RA_Edit window remain open, the subclassing procedures remain active, even if the AddIn was deactivated. This last situation can be solved i.e. using a flag...
The approach I suggested is using the WM_MDIACTIVATE message to subclass and unsubclass only the active editor. The problem that could appear is that if further subclassings are done, they went lost when the unsublassing of my AddIn is executed.
One compromise solution could be to close all open editors when the AddIn is activated or deactivated, but I really don't like to do it this way. :(
Have you faced this problem before?
Biterider
It seem to me that max one MdiChild and max one RAEdit are subclassed at any given time.
Assuming this is correct it shoud be easy to handle all possible activation events.
If the addin below you in the chain wants to unsubclass you must respond to AIM_UNHOOK message.
.elseif eax==AIM_UNHOOK
mov eax,hWin
.if eax=hMySubclassedWindow
mov eax,wParam
.if eax==MyOldCallBack
;Remove the hook from the chain
mov eax,lParam
mov MyOldCallBack,eax
mov eax,TRUE
ret
.endif
When you want to unsubclass
UnHook proc hWin:HWND
invoke GetWindowLong,hWin,GWL_WNDPROC
.if eax==offset CallBack
;Last in chain, just unhook
invoke SetWindowLong,hWin,GWL_WNDPROC,OldCallBack
.else
;Let the next in the chain unhook me
push RAM_UNHOOK
push OldCallBack
push offset CallBack
push AIM_UNHOOK
push hWin
mov eax,lpProc
call [eax].ADDINPROCS.lpDllProc
.endif
ret
UnHook endp
KetilO
Hi KetilO!
I was trying to implement the unsubclassing but I only get GPFs. :'(
I think I understand what is intended, but I have some questions:
1. How finally makes the unsublassing? Is it the final code after the AIM_UNHOOK message?
2. The unsubclassing of the container (MDI child) has to follow the same rule like the RA_Edit window?
Biterider
The subclassing of the RAEdit is a bit tricky since you are actually subclassing two childrens of the RAEdit window.
Have a look at the posted sources of CodeComplete on how the subclassing should be done.
If you are the last in the chain (your proc address is the same as the GWL_WNDPROC) you must set the new GWL_WNDPROC to the OldWindowProc, if not the one above you will just change it's "OldWindowProc" to skip you.
The mdi child follows the same rule as any RadASM window subclassed by an addin (see FlipCase, it subclasses output windows).
KetilO
Hi KetilO
Finally I think I got the problem...
When I subclass the RA_Edit window, I use the following line:
invoke SendMessage, hEditChild, REM_SUBCLASS, 0, offset EditProc
When I examine the return value of the following line executed immediately after the subclassing
invoke GetWindowLong, hEditChild, GWL_WNDPROC
I get a completely different value than that I have set. This causes the Unhook procedure to fail since the call to GetWindowLong also returns a different value and the RA_Edit get never unsubclassed and when I reset the previous message loop pointer I get a GPF. :(
Regards,
Biterider
Yes, that's what I have been trying to explain.
You are sbbclassing the two children of RAEdit.
Suggested way to subclass:
;Subclass the two RAEdit child windows, handle of mdi child is known
;Get the RAEdit window
invoke GetWindowLong,hMdiChild,GWL_USERDATA
;Get pointer to RAEdit EDIT structure
invoke GetWindowLong,eax,0
mov edx,[eax].EDIT.edta.hwnd
mov hEdit1,edx
invoke SetWindowLong,edx,GWL_WNDPROC,offset EditProc
mov OldCallBack1,eax
;Get the RAEdit window
invoke GetWindowLong,hMdiChild,GWL_USERDATA
;Get pointer to RAEdit EDIT structure
invoke GetWindowLong,eax,0
mov edx,[eax].EDIT.edtb.hwnd
mov hEdit2,edx
invoke SetWindowLong,edx,GWL_WNDPROC,offset EditProc
mov OldCallBack2,eax
Again: See the last uploaded CodeComplete addin.
KetilO
I can see the light... again...
Thanks!
Hi KetilO
I need your help again... I'm ready to reposition the ListBox according to the cursor position following your suggestion. I need the structure definition of EDIT and RAFONTINFO to compute the correct positions. Can you post them? Thanks! :wink
Regards,
Biterider
Hi Biterider
Here is the latest CodeComplete demo. It shows a way to do it.
KetilO
[attachment deleted by admin]
Hi KetilO
So far I'm ready with that I wanted to realize with the AddIn. Currently we are testing it to check if it works in all situations.
The next implementation steps could be:
1. Currentls no help is provided when you type something like "[eax]." The idea is to provide a selection list with all possible structures and objects and rediusing the selection while typing. This process can be repeated each time the dot key is pressed, taking as parameter the word placed before the dot. :8)
2. Show a tooltip with the argument help when you are typing a XCall. Is there a prefered way to do it using the RadASM buildin procs?
Regards,
Biterider
Hi Biterider
None of RadASM's tooltip functions are currently available to addins.
Not that I think it matters since they are pretty specialisized to each task.
The onl thing I can recomend is using RadASM's tooltip control, hTlt.
It is a subclassed static.
KetilO
Hi KetilO
I'm trying to reuse the hTlt control but I failed. Perhaps you have a code fragment you can share that shows how to display/hide and setup it. Thanks! :P
Biterider
Hi
I have added tooltip to the CodeComplete tutorial.
KetilO
[attachment deleted by admin]
Hi
I checked your code and it is more than I expected. I transplanted it into my AddIn and it works perfectly! Thanks! :U
It's up to me now to make some usable with it... :P
Biterider
Hi KetilO
I think I have found a bug in the message processing of the RA_Edit window. :eek
I'm trying to catch some keys subclassing the window and all works OK for keys like VK_BACK, VK_ESCAPE, etc. but it seems that the VK_DELETE is not passed.
Regards,
Biterider
Hi Biterider
You will not be able to catch the VK_DELETE using WM_CHAR message.
You must use the WM_KEYDOWN message.
KetilO
Hi KetilO
Sometimes I have a problem with the drawing if the sorted listbox items of the context popup (hLBS). The items seems to be drawn transparently. I know that they are there, since when I click on the empty listbox, I get the item that should be there. I preserve the item strings, so it can't be a matter of LBS_HASSTRINGS style. Any idea?
Biterider
This might be WM_SETREDRAW TRUE/FALSE getting out of sync due to subclassing.
Try sending WM_SETREDRAW TRUE to the listbox.
If that does not help, try invalidating the listbox.
KetilO
Hi KetilO,
Here is the latest stand of the ObjAsm32 AddIn (top post updated).
As far as I tested it, it works without crashes. :bg
Current features:
1. Short form of XCall supported (OCall esi.DoSomething...). SetObject should be used.
2. Implicit form of XCall supported (Ocall DoSomething...). Type OCall . within a method to show the listbox.
3. ACall shows correct ancestor information.
4. Variable members supported within a method (invoke [esi].dMember).
5. Ctrl+Win accelerator to open an object (.inc) file from the Objects directory. Cursor has to be placed over the object name. If a text selection is done, this text is used to seek for the file.
6. Ctrl+Alt+Win, same as Ctrl+Win but adds the file to the project tree.
7. Ctrl+M accelerator to insert a new method.
8. Ctrl+L accelerator to insert a separation line.
Note about intelisence: autocomplete "XCall" with object and method from a selection list. The information is taken from a file called ObjBase.stm placed in the objects directory. This file is automantained by the AddIn. It detects changes in the directory and adds or removes data as necessary. The information from the object base is completed with those from the project files. When changes are done to any of these files, the intelisence database is updated each time the files are saved.
Important: before using this new release, the ObjBase.stm file has to be deleted. This way the file is rebuild completely with the correct information!
Attached the DLL, that has to be copied to the RadASM\AddIns folder and the activated using the AddIn Manager. It can be found in the RadASM Options menu.
I want to thank you for your support and patience! :U
Regards,
Biterider
Hi Biterider
Very nice addin.
When I try to load included project, RadASM ends up in an endless loop.
Probably a bug in the parser.
KetilO
[attachment deleted by admin]
Hi KetilO
Finally I found the bug that leaded to infinite loop. It was a bad typecast in one of the info collections (typical side effect of over night work and too much coffee :bg). I reuploaded the code on the top post. Since the information stored in the ObjBase.stm file is corrupted, it has to be deleted before RadASM is started again. The AddIn rebuilds the file automatically.
I want to know what do you think about to add icons to the listbox to allow to the user to recognize rapidly the type of the items the listbox is offering.
I have tested the AddIn with the test version 2.2.0.3 and all seems to work OK. :U
A little detail, the typo in the "File Association" menu item was not corrected.
Regards,
Biterider
Hi Biterider
Works OK now.
I have been thinking about adding icons to the listbox. I will take a closer look at it and maybe add it in 2.2.0.3
KetilO
Hi all
I uploaded to the first post the latest release of the ObjAsm32 AddIn for RadASM. Now it handles ICall (COM method calling) :8)
Regards,
Biterider
Hi
I added "Object" as a keyword to trigger the Object selection ListBox when ypu need to enter the ancestor object.
I added also in the ObjAsm32 menu the "Insert Float" item. It triggers an input dialog to enter a Float number. This float number can be inserted in the code in form of a dword or qword. This is handy to define symbolic floats or to pass Floats as parameters like in DirectX.
Example:
sR4_PiBy2 equ 3FC90FDBh
Uploaded to the first post.
Biterider
Hi
Finally I found an error that made the AddIn instable under some circumstances.
The AddIn is now compiled with the new speed improved procedures and methods new on ObjAsm32 version 1.3d that will be released soon. The load time was shortened to the half.
The sources will be released together with main package.
Since the first post could not be modified, I post the new release of the AddIn here.
Regards,
Biterider
[attachment deleted by admin]
Hi KetilO
Trying to add new features to an AddIn I woke a sleeping dog.
The problem seems to be the sharing of the RadASM listbox. Pressing Ctrl+Space opens automatically the listbox regardless if it is use by another part of the code. The consequence of this behaviour is that the custom drawing of icons can not be controlled since the itemData field contains a pointer to an information block. In your case, you pass and icon index when pressing Ctrl+Space, but this is not enough for a more flexible use of this field.
I suggest the put a pointer in the itemData field to a structure that identifies the use (or user) of the listbox, followed by the specific data, i.e. the icon index.
Regards,
Biterider
Hi Biterider
I tested your addin and found the following:
1. I am pretty shure you don't follow the rules on return value from DllPrpc. The rule is simple. Only return TRUE when you know that you dont want RadASM or other addins to further process the message. Not following this rule creates addin hawoc.
2. When your addin shows the listbox it must select the first item in the list.
3. Your addin must handle Ctrl+Space ,Shift+Space ,Shift+Ctrl+Space and Enter when the addin 'owns' the listbox. The RadASM default is to handle it the same as Tab. Have a look at how AIM_EDITKEYDOWN and AIM_EDITCHAR is handled in the CodeComplete addin.
If you do these changes your addin should be stable.
KetilO
[attachment deleted by admin]
Hi KetilO
Thanks for the hint, I'll check it again. There is a situation that I think can not be handled this way. Suppose you have triggered the listbox pressing Ctl+Space and then backspace several times until you reach a place where the intellisence want to have the listbox to show a selection data. I haven't found a way to deactivate or send a message to the original algo to stop displaying the first info. To overcome this problem I send a VK_ESC first. This is a dirty trick. Is there a better solution?
Regards
Biterider
There is a flag that prevents RadASM from doing any intellisense, but it is not exposed to addins.
In my next version I will expose some intellisense flags.
If I press Ctrl+Space while your addin is doing any intellisense RadASM crashes.
KetilO
Hi
GB noticed the AddIn (1.0.5) malfunction and then I found the problem on the custom drawing method as I described before. I corrected it applying some dirty tricks. This weekend I will check again your sample code to correct the problem.
Regards,
Biterider
Hi KetilO
This weekend I found the time to write the code changes for the RAEdit hooking according to the CodeComplete example for the ObjAsm32 AddIn. I think it works now.
One of the next things I want to implement is the expansion of the intellisence to show Object members. Since an object instance is a data structure, I think that the RadASM build-in intellisence can do the job if I can append new structures. Unfortunately I haven't found a way to do it. The idea is if I have an object like
Object ABC
DefineVariable X, dword, 0
DefineVariable Y, dword, 0
DefineVariable Z, dword, 0
ObjectEnd
I can trigger the intellisence in a line like
mov [ecx].ABC. here comes the Listbox showing X, Y, Z
I would appreciate any hint you can give me
Regards,
Biterider
Hi Biterider
The function to add to wordlist is currently not exposed to addins.
Included is a very early 2.2.0.6 where it is exposed.
Example:
mybuff db 'ABC',0,'x,y,z',0
push 2 ; 2 strings
push offset mybuff ; Pointer to string(s) to add
push iNbr ; Project FileID
push 's' ; Structure
mov eax,lpProcs
call [eax].ADDINPROCS.lpAddWordToWordList
KetilO
[attachment deleted by admin]
Hi KetilO
Now my test app works fine adding a structure definition. It took some time until I noted that I need a capital "S" to call AddWordToWordList. I have some new questions
1. When do you do the intelisence scan to update the internal word lists? I do it when I save the current file, but I found that you update it more frequently...
2. How is the housekeeping of this word list? Should I remove my entries when the structure was deleted?
3. When the structure was modified, what must I do?
4. What is the intention if the FileID and what should I do when I add the structure without explicit code lines in the file referred by the ID?
5. Are there other information that can be added to the word lists beside the "S"tructure info?
Regards,
Biterider
Hi
1. The wordlist is updatede when the caret is moved to a new line and the edit control was changed since last update.
2,3,4. I think the best is to use AIM_PARSEDONE. It will give you Project FileID and a pointer to the content. Also all the entries for this file was removed from the wordlist before the new parse.
5. Here is a list of things currently in the wordlist:
;Adds a word to the wordlist.
;nType Single letter: A=Api, C=Api Constants, M=Api Messages, W=Word List, s or S=Struct, t or T=Data type, p=proc, d=data, c=constant, m=macro, l=labels
;nOwner Prorject file ID, same as in project file (.rap)
;lpWords Pointer to string(s)
;nParts Numberr of strings
Anything can be added to the wordlist.
KetilO
Hi KetilO
I checked your last additions for the 2.2.0.6 version and I have to say that it makes that intellisence work much easier. The bad news are that I have to rewrite a lot of the code, but I like when thinks are done the right way.
Now I need to use your lpGetFileNameFromID procedure and I'm not sure what to do with the returned string. Do I have to dispose (free) it after using it or not? If yes, what memory API fits to do it?
BTW, is there any place where do you describe the ADDINPROCS / ADDINDATA / ADDINHANDLES? Some of them are absolutely clear, but others require some explanation.
Regards,
Biterider
Hi Biterider
Do nothing. It just returns a pointer into a global memory block.
RadASM maintains this block.
Currently there is no single in-depth description of the addin system.
Hopefully I will find the time to do that.
KetilO
Hi KetilO
I have some problems with the AIM_PARSEDONE notification. Most of the time it returns a correct number in the wParam argument, but some times, when I was working on a project with about 20 files, it returns a crazy number (a negative big value). Is it a bug?
Regards,
Biterider
Probably not.
A negative number indicates an open file that is not part of the project. The negated number is the handle of the mdi child.
KetilO
Hi KetilO
The retuned value in wParam is the negated ADDINHANDLES.hMdiCld - 1. The problem is that the files are members of a project. I click on the project tree to open them and looking into the .rad file, they have assigned IDs.
Biterider
Hi Biterider
Can there be some confusion on long / short filenames or maybe the path?
KetilO
Hi KetilO
I think I've found the pattern of the problem. If I open a file that is part of a project and it is located in the same directory as the rap file (in the project tree it is NOT indicated with ..\..\) then and only then, the wParam parameter of the AIM_PARSEDONE message contains the negated handle of the MDI child. All other files in different directories behave normal, returning the file ID in wParam. Perhaps this helps.
Files that are not in the project, returns the negated MDI child handle as it should be.
Biterider
Hi KetilO
I want to tell you about some strange thing that happens using the GetFileNameFromID procedure. If I provide a an invalid argument, the function returns NULL and in some cases after the function returns, RadASM crashes. If I remove the call to this function all returns to normality. Can check this code?
Regards,
Biterider
Hi
The buffer for converting the FileID in GetFileNameFromID was too small, only 8 byes.
I still cant find anything wrong with the AIM_PARSEDONE. All the projects I have tested are OK.
It might help if you post the full path and what it looks like in the .rap file.
KetilO
[attachment deleted by admin]
Hi KetilO
I tested the new procedure and all works OK. About the inverted Handle issue, I attached a picture of the project tree. All files without the ..\.. have the mentioned problem. The full path for these files is "C:\Masm32\ObjAsm32\Projects\RA_OA32AddIn\xxx"
Biterider
[attachment deleted by admin]
Hi KetilO
I tried to reproduce the AIM_PARSEDONE problem on another machine (also XP) with exactly the same path and it didn't happen. Then, I copied the whole RadASM to the new machine to be sure that the DLLs are the same and the problem didn't appear like before. Returning to the first machine, the retuning value in wParam was inverted. I have no explanation for this behaviour...
Biterider
Hi Biterider
My guess is that RadASM is set to run in some copatibility mode on that machine. The machine reports short filenames while RadASM uses long filenames.
KetilO
Hi KetilO
I checked if RA is runningin some compatibility mode but it is not the case.
I retrieved the MDI Client window text from from one of the files with the problem and it returns a full qualified path (C:\Masm32\ObjAsm32\Projects\RA_OA32AddIn\RA_OA32_AddIn.inc). Is there a way to output he string you are using to evaluate if the file is a project file or not?
For the moment y write a bypass that works for me
...
mov ecx, [esi].pProcs
invoke GetFileNameFromIDPto ptr [ecx].ADDINPROCS.lpGetFileNameFromID, wParam
mov ecx, [esi].pHandles
m2m hChild, [ecx].ADDINHANDLES.hMdiCld
invoke GetWindowLong, hChild, GWL_ID
.if (eax >= ID_FIRSTCHILD) && (eax <= ID_LASTCHILD)
invoke GetWindowText, hChild, addr bBuffer1, sizeof bBuffer1
invoke GetFullPathName, addr bBuffer1, sizeof bBuffer1, addr bBuffer1, NULL
invoke GetLongPathName, addr bBuffer1, addr bBuffer2, sizeof bBuffer2
...
Even if I have the bypass, I think we have to see what is going wrong.
Biterider
Hi, I don't suppose Jeremy Collake or Milos Tziotas still frequent the boards? I tried to use the AsmVars plugin today and it complains of masm32rt.inc:
Quote from: AsmVars.dll
------------------------------------------------------------------
AsmVars v1.00a, (c)2001 Jeremy Collake
------------------------------------------------------------------
==== Pass 1 of 4
Processing file: C:\masm32\RadASM\Helios\TIMERS~1\RANDCR~1\rng.asm
Including file: masm32rt.inc
Processing file: masm32rt.inc - ERROR OPENING!
==== Pass 2 of 4
Processing file: C:\masm32\RadASM\Helios\TIMERS~1\RANDCR~1\rng.asm
Processing file: masm32rt.inc - ERROR OPENING!
==== Pass 3 of 4
Processing file: C:\masm32\RadASM\Helios\TIMERS~1\RANDCR~1\rng.asm
Processing file: masm32rt.inc - ERROR OPENING!
==== Pass 4 of 4
Processing file: C:\masm32\RadASM\Helios\TIMERS~1\RANDCR~1\rng.asm
Processing file: masm32rt.inc - ERROR OPENING!
Total lines: 442
------------------------------------------------------------------
UNREFERENCED VARIABLES
------------------------------------------------------------------
Total unreferenced variables: 0
All done.
I did however find a 1.01 version of asmvars.exe at http://www.bitsum.com/ (past the middle.) So I made a .CMD file to run it:
@echo off
%1\asmvars.exe %2
echo.
pause
and placed all the files in \AddIns. Then I added a tools menu shortcut to it with this command:
$D\asmvars.cmd,$D,2
And it works... but this (newer?) version behaves no better. In fact after some testing it reported a few labels and vars which WERE in use. :dazzled:
Is it anything I'm doing wrong? Thanks for reading. :bg
Hi Mark Jones
The problem is that asmvars needs full path to included files like:
include C:\masm32\Include\masm32rt.inc
However you do not need / want to process theese files as they usually dont contain any variables, locals or procedures.
Processing huge files like windows.inc is just a waste of time.
KetilO
Hi KetilO, that makes sense, thanks. I was just concerned that maybe the errors might indicate other problems. But with further investigation, it seems like the 1.01 release was simply buggy. Too bad development stopped, it's a great tool.
Quickly I have a question about AIM_MAKEDONE, it seems that this message is passed to an Add-In twice, once at resource compilation and again after linking. Is there any way to differentiate the two? :U
You can pair the AIM_MAKEBEGIN and AIM_MAKEDONE and then use the lParam of AIM_MAKEBEGIN to find out what was done.
KetilO
Excellent, thanks. Now I've copied the current hEdit text into a buffer, modified it, and pasted it back. This works fine, but is there a way to create an "undo" entry, so that the changes can be undone? :bg
Hi Mark Jones
Undo is automatic on WM_CLEAR, WM_CUT and WM_PASTE
On EM_REPLACESEL wParam must be TRUE.
On WM_SETTEXT there is no undo.
KetilO
Hi KetilO
I'm adding new functionality to the OA32 Addin. Doing so, i need a modeless dialog to be shown.
My first attempt was using CreateDialogParam and i noticed that some messages were not processed due to the lack if invoking IsDialogMessage for that window.
My next step was trying to call ModelessDialog exported by the ADDINPROCS without luck. A short look at the source of MdiRadAsm.asm showed that you are invoking IsDialogMessage for only a few windows.
My request is, if it is possible to add a mechanism to add more window handles to be checked by IsDialogMessage in the main messageloop?
Maybe you can add the handle in a list when ModelessDialog is called and remove it when DestroyWindow is called. A DestroyModalDialog proc must be suppied in the ADDINPROCS struct.
Regards,
Biterider
Hi KetilO
Any chance to add this feature in 2.2.1.4?
Biterider
Hi Biterider
There is no need for any changes to RadASM.
When your dialog gets focus:
Save old value of ADDINHANDLES.hSearch
Then set ADDINHANDLES.hSearch to the handle of your dialog.
When your dialog looses focus:
Restore ADDINHANDLES.hSearch
KetilO
OK... I'll do so.
Thanks
Biterider
PS: it works! :bg