May anyone, please, help me to make a simple hyperlink in a dialogbox? Underlined. Color and cursor have to change. I don't know How I can do that... I've found this example from a code of Betrayed... but I don't undertstand all ... May anyone please help me? A simple dialog box with an hyperlink? So you make happy a lot of beginners.... Here the Betrayed's code extract from "resolver": HyperLinkWndProc PROTO :DWORD, :DWORD, :DWORD, :DWORD .data? hFinger dd ? .code addr HyperLinkWndProc invoke LoadCursor,hInstance,101 mov hFinger,eax 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 invoke SendMessage, hWnd, WM_GETFONT, 0, 0 mov edx,eax invoke GetObject, edx, sizeof LOGFONT, addr tmpFont mov tmpFont.lfUnderline, TRUE invoke CreateFontIndirect, addr tmpFont mov ebx,eax invoke SelectObject, wParam, ebx .if hover == FALSE invoke SetTextColor, wParam, Blue .else invoke SetTextColor, wParam,Red .endif invoke GetSysColor, COLOR_MENU invoke SetBkColor, wParam, eax invoke DeleteObject,ebx creatin invoke GetStockObject, HOLLOW_BRUSH ret .ELSEIF uMsg==WM_NCHITTEST mov eax, 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 Thanks a lot. giox
Posted on 2001-03-12 07:52:00 by Giox
All a hyperlink in a window (or a dialog box for that matter) is is a simple play with a windows control. The basic concept behind a hyperlink, is the user clicks it, it performs an action, ie, opening a web page. Theres also the little things on the side, such as the usaly blue underlined writing. The microsoft standed for creating a window control such as this, is to place all the code, data etc, for a window class (these would be things like, a WndProc etc), and then when the Dll is loaded, it registers the window class, a good example of this is the common controls Dll (comctl32.dll). So say:

DllEntry PROC hinstDll:HINSTANCE,fdwReason:DWORD,lpvReserved:DWORD

    mov wc.cbSize,SIZEOF WNDCLASSEX
    mov wc.lpfnWndProc,Offset WndProc
    mov wc.lpszClassName,Offset WndClassName
    m2m wc.hInstance,hinstDll
    invoke RegisterClassEx ,ADDR wc
    invoke UnregisterClass ,ADDR WndClassName,hinstDll

ret   ;Noe, if the registering of the class failed, so will the loading off the dll
DllEntry ENDP

WndProc PROC hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
What the above does when linked into a dll, will register your hyperlink class (if made to do so), so in your main exe's code. A call to create window with the same window class will automacticly create the child window. If you can understand the above, you will see what iam getting at. This is my prefered way to start creating new child window classes.
Posted on 2001-03-12 16:30:00 by George
I didn't want to start a whole new thread just for this, but I've got a somewhat related question. This has nothing to do with hyperlinks though, I'd just like to set the text color of a static control on a dialog through WM_CTLCOLORSTATIC. It's exactly how it's supposed to, except it's effecting how every static control is drawn. I can't seem to limit it to just the one. I've tried a simple ".if wParam == whatever" test, but nothing's working. Is it either all or none? ...or can I handle the WM_CTLCOLORSTATIC messages for each static control separately?
Posted on 2001-03-21 13:16:00 by 4oh4
nm I managed to get it working by testing for the control's handle:

  push eax
  mov eax, hChosenFile
  .if lParam == eax
    pop eax
    invoke SetTextColor,wParam,Red
    invoke SetBkMode,wParam,TRANSPARENT
    ;invoke SetBkColor,wParam,Black
    invoke GetStockObject,HOLLOW_BRUSH
I'm still new at this and extremely nervous about tampering with the contents of registers, so I was cautious about protecting the content of eax here. It probably wasn't necessary but oh well... Anyways, I posted a code snippet for anyone else who may find it useful. --4oh4 This message was edited by 4oh4, on 3/22/2001 12:38:17 PM
Posted on 2001-03-22 11:36:00 by 4oh4
4oh4, be careful with the code you have there! At the moment you only pop eax off the stack if you pass the comparison, that could have some nasty effects! Unless you really need eax for something later, don't bother pushing it on to the stack! You only NEED to make sure ebx, esi, and edi are the same at the start and end of a function, and for this you can use the "uses" keyword (if your function uses ebx, esi, or edi!). Mirno
Posted on 2001-03-22 11:58:00 by Mirno
Thanks a bunch Mirno, I had just figured the wm_ctlcolorstatic thing about a min before that. Thanks for the advice about the other registers though. I just hope I remember to clean up that code the next time I get a chance to play with it. 8n) --4oh4 This message was edited by 4oh4, on 3/22/2001 1:54:23 PM
Posted on 2001-03-22 12:53:00 by 4oh4