flat assembler
Message board for the users of flat assembler.

Index > Windows > Showing a tooltip when mouse hovers over control

Author
Thread Post new topic Reply to topic
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
Good day, everyone!

Does anyone have a piece of working asm code as an example of attaching a tooltip to control?

I'm attaching my code in return. It's just an experiment and it isn't finished yet, just basic functions, and probably it doesn't work on anything other then Intel, so be careful.

To populate the CPU Brand string, I used a piece of typedef's code. Thanks, typedef.

FPU test code is taken from Intel's CPUID manual.

The idea is to make an explanation to each and every CPU feature flag, so user won't need to use the Internets to search for reference.

Another useless program, here it goes:


Description: Screenshot
Filesize: 15.52 KB
Viewed: 2396 Time(s)

wcpuid.png


Description: BIGNUM is written by ManHunter
v 0.0.4

Download
Filename: wcpuid.7z
Filesize: 14.18 KB
Downloaded: 138 Time(s)



Last edited by bzdashek on 21 Apr 2012, 10:36; edited 1 time in total
Post 20 Apr 2012, 20:30
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
It is not useless. It is nice.
If I have some time I will help with tooltips.

Basically, the best way is to subclass these checkboxes and sit on the WM_MOUSEMOVE msg and then cause tooltip by using TrackMouseEvent API.
Post 20 Apr 2012, 23:38
View user's profile Send private message Send e-mail Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
AsmGuru62
Thank you for the compliment about the program Smile

Well, I managed to create a test tooltip myself, so there's no need for example already, thanks a lot for an idea.

I used this code:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298368(v=vs.85).aspx

Will try it first, if it won't do, will try to make a multiline from here:
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298403(v=vs.85).aspx

When it will be finished, I'll upload the new version
Post 21 Apr 2012, 09:25
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
Uploaded a new version with tooltips.
Post 21 Apr 2012, 10:37
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Start >Run > type 'WMIC'

type /?
Post 21 Apr 2012, 10:45
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
typedef wrote:
Start >Run > type 'WMIC'

type /?

Thanks Smile

You're telling me, that I'm wasting my time?
Post 21 Apr 2012, 14:23
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
I'm sure it was discussed here, and I just can't find the appropriate thread.

When a child window (i.e. BUTTON) has focus, how can I catch the WM_KEYDOWN message in a Dialog Application? For example, I need to show the About box on VK_F1 keypress.

I tried to use WM_NOTIFY, trapping NM_KEYDOWN message, but it never gets invoked.

Please advice
Post 21 Apr 2012, 17:43
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
You must process hot keys (these that should work independent on the focus) in the main message loop of the application.
Read about accelerators: CreateAcceleratorTable, TranslateAccelerator, etc.
Post 21 Apr 2012, 18:51
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
JohnFound wrote:
You must process hot keys (these that should work independent on the focus) in the main message loop of the application.
Read about accelerators: CreateAcceleratorTable, TranslateAccelerator, etc.

Ok. I just wanted to avoid including the whole accelerators table for the sake of one key. I found an interesting article:
http://msdn.microsoft.com/en-us/library/ms644995
maybe I'll manage to do that without accelerators.

Thanks for the hint.

UPD:
I managed to do that without accelerators:
1. Used CreateDialogParam instead of DialogBoxParam, hence converting Modal dialog box to modeless. With that it is possible to interfere the message loop.
2. In the msg_loop the message is being checked, and if the message is WM_KEYDOWN and wparam is VK_F1, it is sent to main window.

Code:

;       invoke  DialogBoxParam,eax,IDD_CPU,HWND_DESKTOP,DialogProc,0
     invoke  CreateDialogParam,eax,IDD_CPU,HWND_DESKTOP,DialogProc,0
     mov     [hWnd],eax

  .msg_loop:
  invoke  GetMessage,msg,NULL,0,0
     or      eax,eax
     je      .finish
     cmp     [msg.message],WM_KEYDOWN
    jne     @f
  cmp     [msg.wParam],VK_F1
  jne     @f
  invoke  SendMessage,[hWnd],WM_KEYDOWN,[msg.wParam],[msg.lParam]
     @@:
     invoke  IsDialogMessage,[hWnd],msg
  jne     .msg_loop
   invoke  TranslateMessage,msg
        invoke  DispatchMessage,msg
 jmp     .msg_loop

  .not_supported:
      invoke  MessageBox,HWND_DESKTOP,_no_cpuid,_title,MB_ICONHAND

  .finish:                                                         
 invoke  ExitProcess,0
    
Post 21 Apr 2012, 19:23
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: Paradise Falls
Picnic
bzdashek wrote:
Does anyone have a piece of working asm code as an example of attaching a tooltip to control?

I have a masm sample showing various tooltip styles.


Description:
Download
Filename: ToolTips.zip
Filesize: 9.15 KB
Downloaded: 127 Time(s)

Post 22 Apr 2012, 07:50
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
Picnic wrote:
bzdashek wrote:
Does anyone have a piece of working asm code as an example of attaching a tooltip to control?

I have a masm sample showing various tooltip styles.

Thanks a lot, Picnic!
Post 22 Apr 2012, 08:48
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.