News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Tooltip OnClick

Started by Mincho Georgiev, May 27, 2006, 10:23:35 PM

Previous topic - Next topic

Mincho Georgiev

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]

hutch--

Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Mincho Georgiev

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

six_L

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?
regards

Mincho Georgiev

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. "



six_L

hey,shaka_zulu
Thanks your answer.

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

[attachment deleted by admin]
regards

Mincho Georgiev

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...

six_L

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
regards

savage

Hey, very cool!
But why are you using GlobalAlloc instead of HeapAlloc?

Ossa

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
Website (very old): ossa.the-wot.co.uk

savage

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.

Ossa

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
Website (very old): ossa.the-wot.co.uk

savage

I should rephrase that.
I have heard in many places that GlobalAlloc has certain problems.  :dance:

Mincho Georgiev

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'.