Hi I am using Betrayed's about control to make hyperlink in my dialog. I use below code this code makes white bacground with windows xp.However in win9x and win2k it works.


IF uMsg==WM_INITDIALOG
...
invoke SetWindowLong, eax, GWL_WNDPROC, addr HyperLinkWndProc ;subclass our static window

HyperLinkWndProc PROC uses ebx, hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
LOCAL tmpFont :LOGFONT
LOCAL rect:RECT
LOCAL pt:POINT
.IF uMsg==WM_CTLCOLORSTATIC ;Color our static windows
invoke SendMessage, hWnd, WM_GETFONT, 0, 0 ;Get the defualt system font
mov edx,eax ;store result
invoke GetObject, edx, sizeof LOGFONT, addr tmpFont ;get our font into a logfont structure
mov tmpFont.lfUnderline, TRUE ;under line the link
invoke CreateFontIndirect, addr tmpFont ;Create the new font
mov ebx,eax ;We need the return to free the memory later
invoke SelectObject, wParam, ebx ;Select our control
.if hover == FALSE
invoke SetTextColor, wParam,00800000h ;change this to change the color of the link
.else
invoke SetTextColor, wParam,00808080h
.endif
invoke GetSysColor, COLOR_MENU ;background is = to the system menu
invoke SetBkColor, wParam, eax ;Set the color
invoke DeleteObject,ebx ;Free memory used for font creatin
invoke GetStockObject, HOLLOW_BRUSH ;Return painting with a hollow brush
ret
.ELSEIF uMsg==WM_NCHITTEST
mov eax, 1 ;We want to handle the non client hit test so we return true or 1
ret
.ELSEIF uMsg==WM_MOUSEMOVE
invoke GetParent,hWnd
push ebx
mov ebx,eax
invoke GetActiveWindow
.if eax == ebx
invoke GetCursorPos,addr pt
invoke GetWindowRect,hWnd,addr rect
invoke PtInRect,addr rect,pt.x,pt.y
.if eax
invoke GetCapture
.if !eax
invoke SetCapture,hWnd
mov hover,TRUE
invoke InvalidateRect,hWnd,FALSE,FALSE
invoke SetCursor,hFinger

.endif
.else
invoke GetCapture
.if eax
invoke ReleaseCapture
mov hover,FALSE
invoke InvalidateRect,hWnd,FALSE,FALSE
.endif

.endif
.endif
pop ebx
xor eax,eax
ret
.ELSEIF uMsg==WM_LBUTTONDOWN
invoke ShellExecute, NULL, offset szOpen, offset homepage, NULL, NULL, SW_MAXIMIZE ;go to our homepage
mov hover,FALSE ;change cursor and color to previous state
invoke InvalidateRect,hWnd,FALSE,FALSE
xor eax,eax
ret
.ENDIF
invoke CallWindowProc, orgStatic, hWnd, uMsg, wParam, lParam
ret
HyperLinkWndProc endp
Posted on 2001-10-21 17:36:41 by LaptoniC
Well, i have no clue.... as I assume most people are also thinking. The lack of response to this means only one thing, the solutions *could* exist in someting no-one wants to do:

Scouring the MSDN...

Basically, you confirmed the code "can" work, on certian platforms. So your task is to hit the MSDN, and look up all API's used and see which ones have a beef with Windows xp.

To give you a head start... Its safe to say "SendMessage" is OK :)

My guess is its the CreateFontIndirect, or the GetStockObject... but these are just guess', I'd need to see more... Like if i can still click on it and get to a web-link (even tho there is not text). Also is the background supose to be white? Are you implying the Text doesnt show up? etc. etc.

I know this isnt much solution, sorry... but we've all been there in MSDN before...

Good Luck...

NaN
Posted on 2001-10-23 01:02:36 by NaN
may be you have to save ebx since it is used in WM_CTLCOLORSTATIC?

japheth
Posted on 2001-10-23 03:08:33 by japheth
I have found the solution.


invoke GetSysColor, COLOR_MENU ;background is = to the system menu
invoke SetBkColor, wParam, eax ;Set the color

In xp this menu color is white so either you have to get dialogs color with another parameter ie COLOR_3DFACE or remove this two function and use
	

invoke SetBkMode,wParam,TRANSPARENT


I think second is better than above and I will use it.Thanks for your responses.
Posted on 2001-10-23 09:03:11 by LaptoniC