What's new:

- New, improved interface
- More error codes supported
- Compatible with RadAsm, WinAsm and QuickEditor - all in the same dll file!
- Also a standalone version is available

Feedback is welcome... :)

EDIT: Attachment updated (2.0.1.6)
Posted on 2003-10-17 12:52:33 by QvasiModo
BTW, I've tried to make it compatible with AsmEdit too, but I couldn't get it to work (I'm not familiar with this IDE). Could somebody please try it? This is the code I used for the exported function...
; -------------------------------------------------------------------------

; AsmEdit addin support
; -------------------------------------------------------------------------

AsmEditProc proto :DWORD,:DWORD,:DWORD,:DWORD

; Messages sent to AsmEdit
IDM_GETDWORDS equ WM_USER+50
IDM_GETPROC equ WM_USER+51
IDM_GETDATA equ WM_USER+52

;IDM_NEW equ 6001
;IDM_OPEN equ 6002
;IDM_CLOSE equ 6004
;IDM_SAVEAS equ 6006
;IDM_PRINT equ 6010

ASMDWORDS struct
; IDM_GETDWORDS
hWnd dd 0 ; Handle of AsmEdit.
hMenu dd 0 ; Handle of AsmEdit Menu.
hToolBar dd 0 ; Handle of AsmEdit ToolBar.
hStatus dd 0 ; Handle of AsmEdit StatusBar.
hREdit dd 0 ; Handle of RichEdit window.
MenuID dd 0 ; Addin/Project menu item ID.
ProjType dd 0 ; Project type from create (.dll or .exe)
ASMDWORDS ends

ASMEPROC struct
; IDM_GETPROC
lpBaseAscii dd 0 ; Pointer to BaseAscii Proc.
lpAsciiBase dd 0 ; Pointer to AsciiBase Proc.
lpEnaDisMenu dd 0 ; Pointer to EnableDisableEditMenu Proc.
ASMEPROC ends

ASMEDATA struct
; IDM_GETDATA
lpRootDir dd 0 ; Pointer to root dir, ends with \.
lpPathName dd 0 ; Pointer to current full path.
lpFileName dd 0 ; Pointer to FileName.
lpProjectName dd 0 ; Pointer to Project Name.
lpProjectPath dd 0 ; Pointer to Project Path.
lpRegKey dd 0 ; AsmEdit registry key.
ASMEDATA ends

.data?
pHStruct dd ? ;Pointer to AsmEdit handles
pPStruct dd ? ;Pointer to AsmEdit procedures
pDStruct dd ? ;Pointer to AsmEdit data
fAEInit dd ?

.code
align DWORD
AsmEditProc proc hWin,uMsg,wParam,lParam

.if fAEInit == FALSE
inc fAEInit ;TRUE
invoke ReadConfig,offset szWinErrINI
mov pPStruct,$invoke (SendMessage,hWin,IDM_GETPROC,0,0)
mov pDStruct,$invoke (SendMessage,hWin,IDM_GETDATA,0,0)
mov pHStruct,$invoke (SendMessage,hWin,IDM_GETDWORDS,0,0)
push [eax].ASMDWORDS.hMenu
push [eax].ASMDWORDS.MenuID
pop AddinID
pop AddinMenu
.endif
mov eax,uMsg
.switch eax
.case WM_COMMAND
invoke PostThreadMessage,IdWorker,WM_USER+100h,TRUE,0
.break
.case WM_CLOSE
invoke DeleteMenu,AddinMenu,AddinID,MF_BYCOMMAND
mov fActive,FALSE
mov eax,AddinPopup
.if eax != 0
invoke IsWindowVisible,eax
.if eax
inc fActive ;TRUE
.endif
invoke SendMessage,AddinPopup,WM_DESTROY,0,0
.endif
invoke PostThreadMessage,IdWorker,WM_QUIT,0,0
invoke WaitForSingleObject,hWorker,INFINITE
invoke CloseHandle,hWorker
mov hWorker,0
invoke WriteConfig
.endswitch
ret

AsmEditProc endp

Any comments are appreciated.
Posted on 2003-10-17 12:54:11 by QvasiModo
Hi Qvasimodo,

Inteface is very much nicer! Thanks very much. Most probably you will want to make it even better in a few days... :confused:

Regards,

akyprian
Posted on 2003-10-17 12:59:04 by akyprian
Hi Qvasimodo,

u can add search by error number? (vc alike tool)
Posted on 2003-10-17 13:24:05 by wizzra
Hi, akyprian and wizzra.
@akyprian: Thanks!
@wizzra: It currently does search by error number. Just type it in decimal format. For hexa, you need to precede the number with "0x" (like in C).
Of course, if it's still not working it could be a bug (let's hope not! I should have catched one as big as that! :grin: )
Posted on 2003-10-17 13:32:23 by QvasiModo
To QvasiModo,

In regards to your WinErr.dll addin for AsmEdit:

The following is what I'm sending to your addin.


INVOKE LoadLibrary, addr szBuffP ; = WinErr.dll
.if eax
mov ebx, eax
INVOKE GetProcAddress, ebx, addr szBuffF ; = AsmEditProc
.if eax
push lParam ; = 0
push wParam ; = 0
push WM_COMMAND
push hWnd
call eax
.else
.endif
.else
.endif

I don't know why it is not working.

Thanks,

Ewayne
Posted on 2003-10-17 21:50:25 by Ewayne
Thanks for the feedback, Ewayne. :)
Weird. I'll try debugging AsmEdit and see what happens when AsmEditProc is called... :confused:
Posted on 2003-10-18 15:25:26 by QvasiModo
To QvasiModo,

I get a valid return value from the LoadLibrary and GetProcAddress,
but it returns right away after the WM_COMMAND call.

Ewayne
Posted on 2003-10-18 18:00:46 by Ewayne
:o :o :o
I'm so stupid!
I forgot to create the worker thread in the init code... so PostThreadMessage fails...
Will be fixed as soon as I get back home.
Posted on 2003-10-18 18:02:52 by QvasiModo
To QvasiModo,

I forgot to mention I do not use any .ini files, all new
menu items gets stored in the registory.

Ewayne
Posted on 2003-10-18 19:06:07 by Ewayne
Hi QvasiModo,

the dll version is correctly creating/modifying the WinErr.ini file if I use it with QEDITOR, but it's not doing the same when I use it with RadASM...
Posted on 2003-10-20 04:21:46 by Cip
@Ewayne: I think I've fixed it. Thanks for your support :alright:

Anyway, now the addin's dialog box is modal (under AsmEdit) since the addin is unloaded right after the procedure is called. Is there any way to make it modeless?

I will also look into using AsmEdit's registry key to store the addin settings. Currently it uses WinErr.Ini in the Addins folder.

@Cip: Thanks for the bug report. I'll try to see what did I do wrong in the RadAsm support routines. ;)

@Everyone: I've also added support for the Chrome IDE, but for now the dialog box is modal too (until I figure out better how the addin interface works, it's more complicated than the other IDEs).

I'll be also checking out the new WinAsm version with docking windows available to addins. :)

EDIT: Attachment removed. Latest version at the beginning of this thread.
Posted on 2003-10-20 16:27:25 by QvasiModo
QvasiModo,

It flickers like hell when changing the window size... Could you fix it somehow? :)
Posted on 2003-10-20 20:09:49 by Morris
To QvasiModo,

Your new WinErr.dll addin works good with AsmEdit.

You could use the following to retrieve and store the info in the registry.


szREGSZ db 'REG_SZ',0
szWinErrKey db '\WinErr',0
szWndErrPos db 'Pos Window',0
szActive db 'Active',0
szLastCode db 'last Code',0

WndErrPos dd 4 dup(?)
IsActive dd ?
LastCode dd ?
hKey dd ?

lpType dd ?
lpcbData dd ?
lpdwDisp dd ?

LOCAL szWinErr[256]:BYTE

;---------- [Open or create the WinErr registry] ----------
mov eax, dwDStruct
mov ecx, (ASMEDATA ptr [eax]).lpRegKey
INVOKE lstrcpy, addr szWinErr, ecx
INVOKE lstrcat, addr szWinErr, addr szWinErrKey

INVOKE RegCreateKeyEx, HKEY_CURRENT_USER, addr szWinErr, 0, offset szREGSZ, 0,\
KEY_WRITE or KEY_READ, 0, addr hKey, addr lpdwDisp

;---------- [Retrieve
mov lpcbData, 16
INVOKE RegQueryValueEx, hKey, addr szWndErrPos, 0, addr lpType, addr WndErrPos, addr lpcbData
mov lpcbData, 4
INVOKE RegQueryValueEx, hKey, addr szActive, 0, addr lpType, addr IsActive, addr lpcbData
mov lpcbData, 4
INVOKE RegQueryValueEx, hKey, addr szLastCode, 0, addr lpType, addr LastCode, addr lpcbData

;---------- [Save
INVOKE RegSetValueEx, hKey, addr szWndErrPos, 0, REG_BINARY, addr WndErrPos, 16
INVOKE RegSetValueEx, hKey, addr szActive, 0, REG_DWORD, addr IsActive, 4
INVOKE RegSetValueEx, hKey, addr szLastCode, 0, REG_DWORD, addr LastCode, 4
INVOKE RegCloseKey, hKey


Anyway, now the addin's dialog box is modal (under AsmEdit) since the addin is unloaded right after the procedure is called. Is there any way to make it modeless?


What dialog box are you referring to?

Question:
Why don't the other IDE's need a function name.

Thanks,

Ewayne
Posted on 2003-10-20 22:24:53 by Ewayne

I'll be also checking out the new WinAsm version with docking windows available to addins. :)


This is exactly what I expected!

Regards,

akyprian
Posted on 2003-10-21 00:44:17 by akyprian
@Morris: I set WS_CLIPCHILDREN and WS_CLIPSIBLINGS so that (hopefully) should fix any flicker problems. :)

@Ewayne: I meant the dialog box that is shown when you run the addin. Under RadAsm and WinAsm it behaves differently (it doesn't disable it's parent window, and it actually runs in a different thread). To get to do the same under AsmEdit I should be able to keep the DLL open. I was thinking of calling LoadLibrary on myself to do that, but it's probably more trouble than it's worth (unless there's an easier way I'm not aware of).

@akyprian: I've tried to add support for docking windows, but I found it overly difficult. The problem is I'm currently using a dialog box created from a different thread, while docking windows require me to call CreateWindowEx to create the controls, and the window is always created in WinAsm's main thread. So I'd have to rewrite much of the code.

Since I'm at it, I have a couple of feature requests ;) :
- A message to get the DOCKINGDATA structure from an existing docking window. That would greatly simplify storing the window position.
- A custom class, so it could be possible to create a dialog box as a docking window. No need to subclass then, either.

EDIT: Attachment removed. Latest version at the beginning of this thread.
Posted on 2003-10-24 21:02:45 by QvasiModo
Originally posted by QvasiModo
...I've tried to add support for docking windows, but I found it overly difficult. The problem is I'm currently using a dialog box created from a different thread, while docking windows require me to call CreateWindowEx to create the controls, and the window is always created in WinAsm's main thread. So I'd have to rewrite much of the code.

Since I'm at it, I have a couple of feature requests ;) :
- A message to get the DOCKINGDATA structure from an existing docking window. That would greatly simplify storing the window position.
- A custom class, so it could be possible to create a dialog box as a docking window. No need to subclass then, either.


Qvasimodo,

Sorry for not responding earlier! (been busy)

I think that developing and Add-In hosted in a Docking window is extremley easy! The WinAsm internal mecahnism of docking windows does not allow the use of a dialog as a docking window although you could try hosting one in your Docking window! (this is more or less the case with most - if not all - the commercial products I know of). To get a pointer to the DOCKINGDATA structure use:

Invoke GetWindowLong,hDock,0

I hope this helps,

akyprian

PS. Do you really need a different thread for your Add-In?
Posted on 2003-10-26 06:25:00 by akyprian
Thanks for the reply. :)

I'll try that, creating the dialog box as child to the docking window should be a lot easier than switching to CreateWindowEx. I just have to add a second dialog resource and call EndDialog when destroying it.

As for the thread, I don't really need it but it allows me to use the standard dialog box accelerators in a modeless dialog. Since it's now going to be a modal child of the docking window I won't be needing it anymore.

The GetWindowLong tip is really useful... now I can also store the window position. :)
Posted on 2003-10-28 16:55:20 by QvasiModo
hi,


@Everyone: I've also added support for the Chrome IDE, but for now the dialog box is modal too (until I figure out better how the addin interface works, it's more complicated than the other IDEs).


I just saw this thread today, to use a non-modal dialog in a chrome's addins is fairly easy, just do this:

return ADDIN_FINISHED (0) to the AddInLoad procedure.
return ADDIN_ZOMBIE (3) to the AddInMenu procedure.

Unload your dialog at AddInUnLoad.
And create it in AddInMenu.

You might want to handle multiple clicks on the addin's menu entry ;).

Look in the provided addins to see how to retrieve the MDI handle (but i think you already figured this).

You can install your addin by just using "update addin" in the addins manager and selecting the last version of your dll (chrome should handle the rest).

I'm currently working on a SDK but it's a huge work...

h.
Posted on 2003-10-29 22:34:33 by hitchhikr
@akyprian: Still not getting the results I wanted. I'm attaching my latest mess, you'll see what I mean... :grin:

@hitchhikr: Thanks for the tips! I'll soon be improving the Chrome IDE support. :)

EDIT: Attachment removed. Latest version at the beginning of this thread.
Posted on 2003-10-30 16:08:00 by QvasiModo