I am trying to port Betrayed's hyperlink proc to tasm but I couldnt achived it.It always crashes and I guess I missed something in LOGFONT structure.Here is my code

.386
.model flat, stdcall
locals
unicode	= 0
includelib import32.lib
include w32.inc

;
DLG_MAIN	=	111
BT_GENERATE	=	1008
EDIT_NAME	=	1009
EDIT_KEY	=	1010
;
MINCHARS	=	5
MAXCHARS	=	30
;
extrn	_wsprintfA	     : 	PROC
extrn	SetWindowLongA	     : 	PROC
extrn	CallWindowProcA	     : 	PROC
extrn	GetObjectA          : 	PROC
extrn     CreateFontIndirectA :     PROC
extrn     GetActiveWindow     :    PROC
extrn     GetParent           :    PROC
extrn     GETCURSOR           :    PROC
extrn     GetCursorPos        :    PROC
extrn     GetCapture          :    PROC
extrn     SetCapture          :    PROC
extrn	SetCursor 		: 	PROC
extrn     ReleaseCapture      :    PROC
extrn     PtInRect            :    PROC
extrn     ShellExecuteA		:	PROC
  HyperLinkWndProc PROTO :DWORD, :DWORD, :DWORD, :DWORD ;hyperlink proc

;
.DATA
szWinTitle	db "Test Dialog",0
szError		db "Error",0
szInit		db "Ready.",0
  align 4
szformat	db "ABC-%.10lu",0
 szOpen      db "open",0
LF_FACESIZE                          equ 32

RECT STRUCT
  left    DWORD      ?
  top     DWORD      ?
  right   DWORD      ?
  bottom  DWORD      ?
RECT ENDS

LOGFONT STRUCT
 lfHeight    		DWORD ? 
 lfWidth    		DWORD ?
 lfEscapement 		DWORD ?  
 lfOrientation  	DWORD ? 
 lfWeight       	DWORD ?
 lfItalic   		BYTE ? 
 lfUnderline    	BYTE ? 
 lfStrikeOut    	BYTE ?
 lfCharSet      	BYTE ? 
 lfOutPrecision 	BYTE ? 
 lfClipPrecision  	BYTE ? 
 lfQuality         	BYTE ? 
 lfPitchAndFamily     	BYTE ? 
 lfFaceName        	BYTE LF_FACESIZE dup(?)
LOGFONT ENDS



;
.DATA?
hdlg		dd ?
_hInst dd ?
hWndName	dd ?
hWndKey		dd ?
 hFinger   dd ?                                       ;Variable to hold our finger icon
    orgStatic dd ?  
    hover       BOOL ?
userinput	db 260 dup(?)
buffer    db 256 dup(?) 
userkey		db 40 dup(?)
;
.CODE
Start:	pushad
	call	GetModuleHandle, 0
	test	eax, eax
	jz	ExitKG
	xor	ebx, ebx
	call	DialogBoxParamA, eax, DLG_MAIN, ebx, offset DlgProc, ebx
ExitKG:	popad
	call	ExitProcess, 0
	RET
;
DlgProc proc __hwnd:HWND, wmsg:UINT, _wparam:WPARAM, _lparam:LPARAM
	uses	ebx, edi, esi
	mov 	eax, wmsg

	cmp	eax, WM_CLOSE
	jz	_wmdestroy
	cmp	eax, WM_COMMAND
	jz	_wmcommand
	cmp	eax, WM_INITDIALOG
	jz	_initdlg
_nM:	xor	eax, eax
	RET
_wmdestroy:
	call	EndDialog, hdlg, 0
	RET
_wmcommand:
	mov	eax, _wParam
	cmp	ax, IDCANCEL
	jz	_wmdestroy
	cmp	ax, BT_GENERATE
	jnz	_nM
	call	Generate
	jmp	_nM
_initdlg:
     call GetDlgItem, __hwnd, 4000 
     call SetWindowLongA, eax, GWL_WNDPROC, offset HyperLinkWndProc
     mov orgStatic,eax
                            call LoadCursor,_hInst,101                                 ;Load our custom cursor into memory
                                mov hFinger,eax   
                            xor eax,eax
                                ret
DlgProc ENDP
;
Generate proc
	LOCAL	nlen:DWORD
	call	SendMessageA, hWndName, WM_GETTEXT, MAXCHARS+1, offset userinput
	cmp	eax, MINCHARS
	jl	@@err
	mov	nlen, eax	
;--------------------------------------------------------------
	lea	esi, userinput
	mov	ecx, eax
	xor	ebx, ebx
@@l1:	lodsb
	xor	bl, al
	ror	ebx, 5
	dec	ecx
	jg	@@l1
	call	_wsprintfA, offset userkey, offset szformat, ebx
	add	esp, 12
;--------------------------------------------------------------
	call	SendMessageA, hWndKey, WM_SETTEXT, 0, offset userkey
@@out:	call	SetFocus, hWndName
	RET
@@err:	call	SendMessageA, hWndKey, WM_SETTEXT, 0, offset szError
	jmp	@@out
Generate endp

HyperLinkWndProc PROC uses ebx, __hWnd:DWORD,uMsg:DWORD,_wParam:DWORD,_lParam:DWORD
tmpFont 	LOGFONT <>
align 4
rct  		RECT  	<>
align 4
pt 		POINT   <>
align 4
    .IF uMsg==WM_CTLCOLORSTATIC                                     ;Color our static windows
        call SendMessage, __hWnd, WM_GETFONT, 0, 0                  ;Get the defualt system font
Posted on 2001-02-10 19:21:00 by LaptoniC
help for unable to understand tasm, learn masm, the only disadvantage is the the code is clearer, you have much easyier access to win32 api, there are also higher level conditional blocks which if used properly will generate exactly the same code as a handwriten job............ and the only disadvantage that i have ever heard of, is that masm compiles a little slower.
Posted on 2001-02-11 00:19:00 by X
Dear X have you read the above source code...? if so please note: 1. the High level .IF .ELSE .ELSEIF .ENDIF constructs the "call" to API just like "invoke" to API... so the above code is allmost the same as MASM's, actually TASM is allmost THE SAME as MASM :) only faster :) now i only posted this beacuse i am tired of those wrong claims that "TASM is somehow inferior to MASM" .... if that is true...this example does not show it :D LaptoniC i will try to make that work ...but i cant promisse ... :( This message was edited by BogdanOntanu, on 2/11/2001 6:30:51 PM This message was edited by BogdanOntanu, on 2/11/2001 6:34:41 PM
Posted on 2001-02-11 18:30:00 by BogdanOntanu
Bogdan: The difference between TASM and MASM may not be much right now. The feature lists are almost the same but they differ in one thing: TASM has no more future. InPrise doesn't have plan for TASM as a separate product anymore. You would say that TASM 5.0 is currently ok but think about the future when new processors come out with new instructions, TASM would not be able to use them. That is one of the reasons I choose MASM over TASM.
Posted on 2001-02-12 02:50:00 by Iczelion