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

KetilO


1. It seem to me that only the topmost open file is checked with Method Unused ... and Method Register ...

KetilO

Biterider

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

KetilO


.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

Biterider

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]

Biterider

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

KetilO

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

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

Biterider

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

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

KetilO

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


Biterider

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

KetilO

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

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

Biterider

Hi KetilO
It works fine, thanks!  :U

Biterider