The MASM Forum

General => The Campus => Topic started by: bomz on December 10, 2012, 04:50:41 AM

Title: ToolTip Icon
Post by: bomz on December 10, 2012, 04:50:41 AM
(http://s53.radikal.ru/i139/1212/65/b1eac164dde7.png)
How change this icon for my own?
How add X close button to tooltip?
How use SetWindowTheme?
Help me please.
Title: Re: ToolTip Icon
Post by: jj2007 on December 10, 2012, 05:42:47 AM
I think it's a bot. The real bomz was a really friendly guy, and had funny icons all over the place ::)
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 05:55:48 AM
(http://smiles.kolobok.us/light_skin/blush.gif)
It's me. I restore password and can't logon.
Title: Re: ToolTip Icon
Post by: dedndave on December 10, 2012, 06:00:00 AM
you need to look at tooltip styles and messages   :P

alas - MSDN seems to be down at the moment
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 06:03:50 AM
I read msdn. It's example not working. I find one forum where C programmers says about manifests(?) and SetWindowTheme
Title: Re: ToolTip Icon
Post by: dedndave on December 10, 2012, 06:09:25 AM
this is from the community content on the TOOLINFO structure page...

QuoteFor _WIN32_WINNT  > 0x0501, you must set 'cbSize' to TTTOOLINFOA_V2_SIZE (instead of sizeof(TOOLTIPINFO))
or include the appropriate version of Common Controls in the manifest. Otherwise the tooltip won't be displayed.

comment by Jefeh1

the structure is defined as follows:

typedef struct {
  UINT      cbSize;
  UINT      uFlags;
  HWND      hwnd;
  UINT_PTR  uId;
  RECT      rect;
  HINSTANCE hinst;
  LPTSTR    lpszText;
#if (_WIN32_IE >= 0x0300)
  LPARAM    lParam;
#endif
#if (_WIN32_WINNT >= Ox0501)
  void      *lpReserved;
#endif
} TOOLINFO, *PTOOLINFO, *LPTOOLINFO;
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 06:13:55 AM
http://s40.radikal.ru/i090/1212/99/1c3083ccbc81.png

I try this just now
Title: Re: ToolTip Icon
Post by: jj2007 on December 10, 2012, 06:15:25 AM
Welcome back, bomz :t

Can't find what I was looking for - tooltips with bold titles - but CodeProject has something (http://www.codeproject.com/Articles/98967/A-ToolTip-with-Title-Multiline-Contents-and-Image).
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 06:21:36 AM
(http://smiles.kolobok.us/light_skin/friends.gif)
Title: Re: ToolTip Icon
Post by: dedndave on December 10, 2012, 06:22:37 AM
one thing i noticed...

when you create the tooltip, you provide a handle to a parent window, but do not specify WS_CHILD
from my experience, it is best to create the tooltip with HWND_DESKTOP (same as NULL) as the parent
and do not specify WS_CHILD

what we do not see is the manifest you are using
you probably want to specify common controls 6.0
but, according to the comment mentioned in my previous post, you may have
to check the OS to set a proper value for cbSize - not sure about that
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 06:27:42 AM
(http://smiles.kolobok.us/light_skin/suicide2.gif) any masm half year long
OK
Title: Re: ToolTip Icon
Post by: hfheatherfox07 on December 10, 2012, 06:39:39 AM
Hey bomz....Welcome back  :t
I posted such a source (not mine) on the old forum .....

This not only shows custom icon and close but it shows icon according to conditions .....connected or not connected
You will only see the not connected icon since I am only posting the part you need ...the whole thing is too big to upload ....I you want the whole software let me now and I will upload it off site


Here you go  :P

Title: Re: ToolTip Icon
Post by: Magnum on December 10, 2012, 06:43:26 AM
Quote from: jj2007 on December 10, 2012, 05:42:47 AM
I think it's a bot. The real bomz was a really friendly guy, and had funny icons all over the place ::)

They even stole Bomz avatar too.

Title: Re: ToolTip Icon
Post by: hfheatherfox07 on December 10, 2012, 06:45:31 AM
@bomz ....Get the whole source while it is up ...... :P

http://www.filesend.net/download.php?f=0dcbda22c9ed7c628ea1ce8a2531fc63
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 06:45:45 AM
I add avatar with third post
Title: Re: ToolTip Icon
Post by: CommonTater on December 10, 2012, 08:14:44 AM
Quote from: bomz on December 10, 2012, 06:03:50 AM
I read msdn. It's example not working. I find one forum where C programmers says about manifests(?) and SetWindowTheme

You need to set a manifest for common controls and for somethings you may have to change settings using UxTheme??? functions...

http://msdn.microsoft.com/en-us/library/windows/desktop/bb773187(v=vs.85).aspx

Here's an example manifest...

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32"
                    name="AutoLogon"
                    version="1.0.0.0"
                    processorArchitecture="*" />
  <description>
    Auto logon tool
  </description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32"
                        name="Microsoft.Windows.Common-Controls"
                        version="6.0.0.0"
                        processorArchitecture="*"
                        publicKeyToken="6595b64144ccf1df"
                        language="*" />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel  level="asInvoker"
                                  uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>


You would save this as an xml file and include it into your program's resources with RC.
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 08:55:34 AM
I don't know what this - manifest. only see it in WinSxS

May be subclass or enumchildwindows simply use to change icon?
Title: Re: ToolTip Icon
Post by: hfheatherfox07 on December 10, 2012, 09:56:05 AM
Hey bomz
Did that example that I uploaded for you not work?
It does what you asked for ..... Uses custom icon and adds a close button to tool tip

Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 10:10:36 AM
May be it work, I try connect my phone what have any effect for program
Title: Re: ToolTip Icon
Post by: jj2007 on December 10, 2012, 11:02:04 AM
Hi bomz,

You can specify the style TTS_CLOSE in CreateWindowEx to get the close box (but I have not managed to click on it - the damn tooltip disappears as soon as I move the mouse...).

And here is code to put an icon:
      push rv(LoadIcon, hInstance, IDI_APPLICATION)
      invoke SendMessage, hTT, TTM_SETTITLE, eax, chr$("Tooltips may have titles")
      call DestroyIcon

:icon14:
Title: Re: ToolTip Icon
Post by: hfheatherfox07 on December 10, 2012, 11:13:31 AM
Quote from: bomz on December 10, 2012, 10:10:36 AM
May be it work, I try connect my phone what have any effect for program

No need to do that,
I uploaded the whole software for you as soon as you turn it on you will see icon
every thing you need to load custom icon and close button on tool tip is there and simple to follow :t
Title: Re: ToolTip Icon
Post by: bomz on December 10, 2012, 04:05:07 PM
(http://s019.radikal.ru/i642/1212/fc/a105031e3209.png)
(http://s017.radikal.ru/i409/1212/c7/3cdf1368da94.png)
(http://s019.radikal.ru/i615/1212/7c/f80b2afd1410.gif)

(http://smiles.kolobok.us/light_skin/scratch_one-s_head.gif)
Title: Lot of bugs ?? in P2Kautostart
Post by: Magnum on December 10, 2012, 04:26:21 PM
That  P2kAutostart.zip was a mess to clean up.

It put files in about 15 directories.

Andy
Title: Re: Lot of bugs ?? in P2Kautostart
Post by: jj2007 on December 10, 2012, 05:09:55 PM
Quote from: Magnum on December 10, 2012, 04:26:21 PM
That  P2kAutostart.zip was a mess to clean up.
It put files in about 15 directories.

And you still have to find in that mess the two lines that I posted above :lol:
Title: Re: ToolTip Icon
Post by: Magnum on December 10, 2012, 05:27:43 PM
I am not sure if I used HfHeatherfox's version or Bomz.

I don't feel so bad about some of my programming "boofs."

Andy
Title: Re: ToolTip Icon
Post by: dedndave on December 10, 2012, 09:59:08 PM
bomz,

i am sure that what you need is a manifest to ensure common controls v6 is present and loaded
there are 2 common ways to include a manifest file

you can put a manifest file in the same folder as the EXE...
MyProgram.exe
MyProgram.exe.manifest

that's ok for testing, perhaps, but if you distribute a program that way,
it assumes the manifest will be in the same folder as the exe   :P
(see below for what the manifest file looks like)

probably a better way - and more common, i think,
is to include the manifest file as a resource by referencing it in the program's RC file
when you do it this way, the XML text of the manifest is added to the EXE
(i assume you already know how to compile and link resource files with your project)

MyProgram.rc
;#############################################################

#include "\masm32\include\resource.h"

#ifndef  CREATEPROCESS_MANIFEST_RESOURCE_ID
#define  CREATEPROCESS_MANIFEST_RESOURCE_ID  1
#endif

#ifndef  RT_MANIFEST
#define  RT_MANIFEST                         24
#endif

;#############################################################

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "MyProgram.xml"

;#############################################################


MyProgram.xml
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"/>
    </dependentAssembly>
  </dependency>
</assembly>


no matter which way you get the manifest file loaded...
in your program, you want to use InitCommonControlsEx
        .DATA
icc INITCOMMONCONTROLSEX <sizeof INITCOMMONCONTROLSEX,ICC_BAR_CLASSES>

        .CODE
Start:
        INVOKE  InitCommonControlsEx,offset icc
;
;rest of program...
;
        END     Start

notice that i used ICC_BAR_CLASSES
you may want to combine more flags or use ICC_WIN95_CLASSES, which combines several
ICC_BAR_CLASSES is used because you want to use a tooltip
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775507%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/bb775507%28v=vs.85%29.aspx)
the call to InitCommonControlsEx should be performed early in the program
i usually make it the first thing executed
Title: Re: ToolTip Icon
Post by: farrier on December 10, 2012, 10:50:19 PM
A nice example of different tooltips for MASM, found on the fasm site:

http://board.flatassembler.net/topic.php?p=143198#143198

includes source.

farrier
Title: Re: ToolTip Icon
Post by: bomz on December 11, 2012, 04:25:33 AM
dedndave
I try this. With manifest any tooltip appear. when I del manifest file - tooltip appear without TT_CLOSE and icon
Title: Re: ToolTip Icon
Post by: dedndave on December 11, 2012, 04:28:36 AM
let me play with it.....
Title: Re: ToolTip Icon
Post by: bomz on December 11, 2012, 04:33:29 AM
see line 2155

(http://s005.radikal.ru/i210/1212/1b/89bc0551a8b4.gif)
Title: Re: ToolTip Icon
Post by: dedndave on December 11, 2012, 06:05:19 AM
i made notes in Changes.txt...

(http://img96.imageshack.us/img96/3246/bomz.png)
Title: Re: ToolTip Icon
Post by: bomz on December 11, 2012, 07:05:18 AM
(http://smiles.kolobok.us/light_skin/thank_you2.gif)
Title: Re: ToolTip Icon
Post by: bomz on December 11, 2012, 07:08:27 AM
(http://smiles.kolobok.us/standart/black_eye.gif)
any tooltip appear... what system you have - windows 7? may be some effects or theme or windows "optimization" influence?
Title: Re: ToolTip Icon
Post by: jj2007 on December 11, 2012, 08:00:21 AM
With Dave's code, I can see a tooltip only when in the notification area, and despite of the TTS_BALLOON style, it is just a plain rectangle, no icon and no title.

And it does work on XP SP3, as shown below. So what happens there?? Why no balloon and no title?

P.S.: JWasm doesn't like line 1857:
.elseif
Title: Re: ToolTip Icon
Post by: dedndave on December 11, 2012, 08:33:43 AM
Jochen,
refer to this post...
http://masm32.com/board/index.php?topic=1053.msg9759#msg9759 (http://masm32.com/board/index.php?topic=1053.msg9759#msg9759)
you run the program
then, right-click on the tray icon and select the Popup option
then, when you mark some text and click Copy, the balloon appears, showing the text you put into the clipboard
it could be raised up a little   :P

i am using XP sp3
Title: Re: ToolTip Icon
Post by: jj2007 on December 11, 2012, 09:03:28 AM
Dave,

Thanxalot for the explanation - it works :t
(maybe I got confused because all comments are in former Russian Unicode, hehe :bgrin:)
Title: Re: ToolTip Icon
Post by: Magnum on December 11, 2012, 11:38:00 AM
Looks good Dave.

Looks like a notebook I had when I was a little younger.

Title: Re: ToolTip Icon
Post by: dedndave on December 11, 2012, 01:11:58 PM
the code is from bomz   :P
i just did a few mods
Title: Re: ToolTip Icon
Post by: bomz on December 11, 2012, 04:01:33 PM
for a long time, since windows 2000, I use program for clipboard, which find in internet. when I install windows 7 I find for all habitual soft substitution except it. so make my own. such clipboard program common task for delfi programmers. i read delfi forum and make masm program whick may quickly work with 100.000 clipboard notice
now use it for tooltip experiment
Title: Re: ToolTip Icon
Post by: dedndave on December 11, 2012, 04:11:53 PM
bomz,
i noticed that you were trying to limit the program to a single instance
here is a little example of how to use a mutex
i used a class name string - but it can be any unique string

notice that you can only run one instance of the program at a time
Title: Re: ToolTip Icon
Post by: jj2007 on December 12, 2012, 05:25:52 AM
Quote from: dedndave on December 11, 2012, 04:11:53 PM
i noticed that you were trying to limit the program to a single instance
here is a little example of how to use a mutex

Same but with atoms.
Title: Re: ToolTip Icon
Post by: dedndave on December 12, 2012, 07:02:05 AM
that's a little simpler   :biggrin: