The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Mincho Georgiev on May 27, 2006, 10:23:35 PM

Title: Tooltip OnClick
Post by: Mincho Georgiev on May 27, 2006, 10:23:35 PM
Hi Frends,
I've developed today this Tooltip manipulator, cause i need it for one of my projects.
Then i decide to write a demo application and to share it with you.
Is a something simple, but it's really usefull for me in my Project so maybe it could be usefull for others too.
Thanks for reply.


[attachment deleted by admin]
Title: Re: Tooltip OnClick
Post by: hutch-- on May 27, 2006, 11:31:00 PM
shaka,

Works fine.  :U
Title: Re: Tooltip OnClick
Post by: Mincho Georgiev on May 27, 2006, 11:58:21 PM
Thank you,Hutch!
By the way, i thought that can be nice if you add the TTGETTITLE structure in the next release of windows.inc:

TTGETTITLE struct
dwSize dd ?
uTitleBitmap dd ?
cch dd ?
lpwszTitle dd ? ;PWCHAR
TTGETTITLE ends


here's the description. Important note is Windows XP - mimimum operating system:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/structures/ttgettitle.asp

Thanks in advance  :U
Title: Re: Tooltip OnClick
Post by: six_L on May 28, 2006, 03:15:51 AM
ttp_create PROC hInst:DWORD,hwndOwner:DWORD,dwStyle:DWORD
Local Tiphwnd:dword

invoke InitCommonControls
invoke CreateWindowEx,0,addr TTClass,0,dwStyle,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
0,0,hInst,0
mov  Tiphwnd,eax
push eax ;//store the handle
invoke SetWindowPos,eax, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE

invoke GetWindowLong,Tiphwnd, GWL_EXSTYLE
or     eax, WS_EX_LAYERED or WS_EX_TRANSPARENT
invoke SetWindowLong,Tiphwnd,GWL_EXSTYLE,eax
invoke SetLayeredWindowAttributes,Tiphwnd,0,150,LWA_ALPHA

pop eax ;//returned handle
ret

ttp_create ENDP

why can't the code work?
Title: Re: Tooltip OnClick
Post by: Mincho Georgiev on May 28, 2006, 07:16:51 AM
Because you have made a changes  :bg.
I'm just kidding'.
Since i didn't see the whole code of yours, it's very hard to answer that question.
Just let me remain you something:

"A ToolTip control always has the WS_POPUP and WS_EX_TOOLWINDOW window styles, regardless of whether you specify them when creating the control. "


Title: Re: Tooltip OnClick
Post by: six_L on May 28, 2006, 08:17:09 AM
hey,shaka_zulu
Thanks your answer.

here is all code. i want change the tipwindow onto transparent style.

[attachment deleted by admin]
Title: Re: Tooltip OnClick
Post by: Mincho Georgiev on May 28, 2006, 10:19:59 AM
I see.
Well, unknown why, the TTF_TRANSPARENT flag never work for me /maybe it a windows theme problem/ , but since i can't make that flag working,
there is only 2 way to do it properly /on my opinion/:
1. To sublcass the tooltip control and make full managing on it's painting ,and
2. To Create a custom tooltip control.
i just doubt that it can be made it on your way (it will always cause problems), but after all, i may wrong...
Title: Re: Tooltip OnClick
Post by: six_L on May 28, 2006, 05:07:20 PM
just trying.
the method can change the normal window into transparent style. but does nothing about CreateWindowEx
if you'r successed about this. please share it.

best regards
Title: Re: Tooltip OnClick
Post by: savage on May 29, 2006, 02:28:11 PM
Hey, very cool!
But why are you using GlobalAlloc instead of HeapAlloc?
Title: Re: Tooltip OnClick
Post by: Ossa on May 29, 2006, 02:34:45 PM
Quote from: savage on May 29, 2006, 02:28:11 PM
Hey, very cool!
But why are you using GlobalAlloc instead of HeapAlloc?

sorry to be contrary, but... why not?

GlobalAlloc is (IIRC) a wrapper for HeapAlloc using the default heap... it's much simpler to use and in the majority of programs, it is just as effective. There will be cases where HeapAlloc is better, but I don't think this is one.

[edit] Over at the other place, there was a tiny bit of investigation into some of the differences between GlobalAlloc and HeapAlloc a few years ago: http://www.asmcommunity.net/board/index.php?topic=17236.msg133567#msg133567 [/edit]

Ossa
Title: Re: Tooltip OnClick
Post by: savage on May 29, 2006, 03:17:41 PM
Quote
GlobalAlloc is (IIRC) a wrapper for HeapAlloc using the default heap... it's much simpler to use and in the majority of programs, it is just as effective. There will be cases where HeapAlloc is better, but I don't think this is one.

Hmm, much simpler? I've never found it hard to use at all...
Anyway, I've just seen in many places that GlobalAlloc has certain problems.
Title: Re: Tooltip OnClick
Post by: Ossa on May 29, 2006, 04:03:30 PM
Quote from: savage on May 29, 2006, 03:17:41 PM
Hmm, much simpler? I've never found it hard to use at all...

You don't need to keep the handle of the heap lying around with GlobalAlloc... thats what I'd meant - not that the Heap functions were hard to use.

Quote from: savage on May 29, 2006, 03:17:41 PM
Anyway, I've just seen in many places that GlobalAlloc has certain problems.

Don't suppose you could reference some... I've not seen any problems - it would be useful to know of them before they catch me out.

Ossa
Title: Re: Tooltip OnClick
Post by: savage on May 29, 2006, 06:03:09 PM
I should rephrase that.
I have heard in many places that GlobalAlloc has certain problems.  :dance:
Title: Re: Tooltip OnClick
Post by: Mincho Georgiev on May 29, 2006, 08:18:15 PM
QuoteI have heard in many places that GlobalAlloc has certain problems
Ok,here's my answer. On the place where GlobalAlloc had certain problems, use HeapAlloc instead of it.  :wink
The correct manipulation of the heap in a program that requires large amount of memory is not so simple task.
I agree that there is 'places' where HeapCreate,HeapAllocate,HeapFree and HeapDestroy will do a better job,
but they are not a subject for simple program like that one at all. Infact i use both in my programs depending of the needs...
Indeed the C 'malloc' function uses GlobalAlloc as well with a whole series of check to prevent those 'problems'.