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

I uploaded the sources to the first post of this thread.

Regards
Biterider

KetilO

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

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]

KetilO

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]

Biterider

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

KetilO

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

Biterider

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

KetilO

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

Biterider

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

KetilO

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

Biterider

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

KetilO

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

Biterider

I can see the light... again...

Thanks!

Biterider

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

KetilO

Hi Biterider

Here is the latest CodeComplete demo. It shows a way to do it.

KetilO

[attachment deleted by admin]