The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: dedndave on April 24, 2011, 03:30:44 AM

Title: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 03:30:44 AM
as a result of this thread (http://www.masm32.com/board/index.php?topic=16480.0), i have been working on a little demo program
it has 2 edit controls with tooltips that pop up if caps lock is on
it works fairly well, until i add a manifest file
i have exhausted all i know about manifest files and resource files, which isn't all that much   :lol
i have added message boxes to the program to report certain related errors
i have tried a variety of manifest files and resource lines
i have also tried using PoLink instead of Link
i am using XP MCE2005, SP3 with all the updates except .NET 4.0

when the manifest file is added, there are 2 apparent symptoms:
1) no tooltips at all
2) the cursor seems to be located incorrectly when the focus shifts to the second edit control
it appears as it should in the first one

(http://img14.imageshack.us/img14/2779/editctrl.png)

any help would be greatly appreciated
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 04:36:05 AM
i might add that there are no reported events in the Computer Management Event Viewer applet
and that my WinSxS folder has the following common control folders...
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.0.0_x-ww_1382d70a
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83
x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5705_x-ww_36cfed49
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: mineiro on April 24, 2011, 04:43:52 AM
Well, I cannot help much Sr Dedndave, but I have figured that when you move the mouse under the edit box, the tooltip appears.
(http://sites.google.com/site/programandoasm/_/rsrc/1303619646557/lazer/capslock/capslock.JPG)
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 04:49:59 AM
 :bg
what version of windows are you using ?
it seems that it adds the desired balloon tooltip because of the EM_SETPASSWORDCHAR message
or, it could be the TTF_UNDOCFLAG, which i found online   :P
i meant to comment that out
IFNDEF TTF_UNDOCFLAG
TTF_UNDOCFLAG   EQU 40h
ENDIF

TTF_IDISHWND or TTF_SUBCLASS or TTF_UNDOCFLAG      ;TOOLINFO.uFlags
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: mineiro on April 24, 2011, 05:51:53 AM
Hello Sr Dedndave, I spend some time to see why that tooltip appears to me, and I have commented some lines in your code to it disapear.
in source code
;        INVOKE  SendMessage,eax,EM_SETPASSWORDCHAR,'*',edi
In resource I removed the ES_PASSWORD.
;CONTROL "",IDC_EDT2,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|ES_PASSWORD,48,72,102,15,WS_EX_CLIENTEDGE

I play with your code, and changed to this:
Added in .data?
pointer         POINT   <>

and changed your source only a bit.
...
dProc1:
      invoke GetCursorPos,addr pointer
      mov      ecx,pointer.x
      mov      edx,pointer.y
      invoke   SetCursorPos,Ecx,Edx
      mov     ecx,FocusHandle
        mov     edx,ecs1.hTool
        mov     eax,ecs2.hTool
        jecxz   dProc2
...
Now it works here, is not a good implementations, I know, but have worked.
Regards Sr.
Oh, I forgot to answer your question, here is XP SP3.
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 07:33:35 AM
thanks   :U

but, now i am even more confused - you are using XP SP3 - so am i   :red
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 08:10:25 AM
 :lol

i figured out where i was gping wrong - lol
i had disabled balloons when i built the hard drive   :bg
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"EnableBalloonTips"=dword:00000001

it was 0 - i set it to 1, and now it works
i can eliminate a whole bunch of code   :bg

however, i still have the problem with the cursor being shifted to the right in the password box
this does not happen with no manifest and it does happen with one
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: mineiro on April 24, 2011, 09:03:12 AM
If I remove the ES_PASSWORD style in resource it get aligned, but with ES_PASSWORD the cursor shift to the right.
And in that previous code posted, if the mouse cursor is outside of edit box, so it don't work.
Regards.
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: sinsi on April 24, 2011, 09:38:48 AM
The only difference I can see is that a manifest uses a different version of the common controls.
Version 6 defaults to a black circle, user32 uses an asterisk. Maybe it calculates things depending on the character size?
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: hutch-- on April 24, 2011, 10:16:48 AM
Dave,

I would be inclined to subclass the control, save the data in memory and display whatever character you want for a password blockout. This means you would not be dependent on the internals of Windows for the display format.
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 01:56:12 PM
sinsi - i explicitly set it to asterisk   :P

earlier on, i added ES_PASSWORD to the resource file edit control definition (learning - trying things out)
i did not see that it did what i was after all along because of my registry setting
as i read through all the documentation, i added some other things
one was to set the hidden password character
which, by the way, if you send that message with a NULL, it shows the chars, but still acts like a password entry (tooltip)

as for the indentation, that occurs, even if i make the 2 edit controls identical (with or without password style)
this seems to be true whenever a manifest is used to enable XP visual styles
i'm going to call it a bug   :bg
possibly, i can make the other edit control indent the same way and say "that's how it's supposed to be" - lol

the fact is, i wrote a lot of unnecessary code because of the registry setting disabling balloon tooltips
that's ok - it has been a good leaning experience   :P
i wanted to get my feet wet with dialogs and tooltips
if it had worked when i added the ES_PASSWORD style, i wouldn't have learned much
i also learned a little more about manifest files
i found this article to be particularly educational...
http://blogs.msdn.com/b/junfeng/archive/2007/06/26/rt-manifest-resource-and-isolation-aware-enabled.aspx
i also learned to use the event viewer, among other things, when troubleshooting manifest related problems
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 24, 2011, 11:24:04 PM
this code fixes the indentation issue   :U
        INVOKE  SendMessage,hEdit1,EM_GETMARGINS,0,0
        INVOKE  SendMessage,hEdit2,EM_SETMARGINS,EC_LEFTMARGIN or EC_RIGHTMARGIN,eax

i put it near the end of the WM_INITDIALOG stuff
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: hutch-- on April 25, 2011, 12:30:04 AM
Dave,

With a simple tweak you can individually set either side margin in a rich edit control.


    mov ecx, 14
    mov edx, 4
    mov ax, dx
    rol eax, 16
    mov ax, cx
    invoke SendMessage,hEdit,EM_SETMARGINS,EC_LEFTMARGIN or EC_RIGHTMARGIN,eax
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: jj2007 on April 25, 2011, 02:49:00 AM
Quote from: dedndave on April 24, 2011, 11:24:04 PM
Dave's simple tweak fixes the indentation issue   :U

Just trying a synthesis :green
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 25, 2011, 02:53:16 AM
well - these aren't rich edit controls
but, i have re-thought the above code
it would be better to see what the value is and set them both to that,
rather than depending on the first one to be correct   :P

this makes no sense to me, Hutch   :bg
   mov ecx, 14
   mov edx, 4
   mov ax, dx
   rol eax, 16
   mov ax, cx


why not just do this...
invoke SendMessage,hEdit,EM_SETMARGINS,EC_LEFTMARGIN or EC_RIGHTMARGIN,40014h

:bg
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: hutch-- on April 25, 2011, 02:58:56 AM
Dave,

A fixed value is fine if you want it hard coded, I tend to make them so they can be user adjusted. Its not hard to make it more efficient but with loading 2 word values into an API, you are not going to see the difference.
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 25, 2011, 03:05:18 AM
ohhhhhhh   :bg
i see, the values 4 and 14 come from variables, then
        push    LowWordPart
        mov word ptr [esp+2],HighWordPart
        pop     eax
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: baltoro on April 25, 2011, 04:40:30 PM
DAVE !!!
You will find these blog entries from Raymond Chen very annoying:   
The History of the Windows XP Common Controls (http://blogs.msdn.com/b/oldnewthing/archive/2008/01/29/7294949.aspx),...and,...
What is the Default Version of the Shell Common Controls? (http://blogs.msdn.com/b/oldnewthing/archive/2007/04/12/2093090.aspx),...and,...
How Do I Suppress the CapsLock Warning on Password Edit Controls? (http://blogs.msdn.com/b/oldnewthing/archive/2008/10/10/8969403.aspx)
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 25, 2011, 05:10:39 PM
thanks, baltoro
i may actually use that last one   :P
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: jj2007 on April 25, 2011, 05:19:06 PM
Quote from: baltoro on April 25, 2011, 04:40:30 PM
How Do I Suppress the CapsLock Warning on Password Edit Controls? (http://blogs.msdn.com/b/oldnewthing/archive/2008/10/10/8969403.aspx)

I like the comments :bg

[There are segments of society that live with their Caps Lock key permanently on. I used to get email from some of them.]

Yeah, they're called "parents."
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: baltoro on April 25, 2011, 05:21:55 PM
Raymond Chen (http://blogs.msdn.com/b/oldnewthing/) is like the ANTI-EDGAR. :eek

...If you enter 'common controls' into the search box at his website, you will find alot of blog posts about the version difficulties associated with Windows Common Controls.

Quote from: JJ...There are segments of society that live with their Caps Lock key permanently on,...
:eek ...Yeah,...I do that ALL THE TIME,...just to be annoying. :eek
...Actually, I think my computer automatically activates the CAPS LOCK whenever it notices that I am responding to either 'hutch', or 'oex'. I haven't figured out how to psychically disable it yet,... :eek

More from Raymond Chen: 
Why Not Just Require Each Application To Declare What Version of Windows It Is Compatible With? (http://blogs.msdn.com/b/oldnewthing/archive/2010/09/27/10067997.aspx)
Visual C++ 2005 Will Generate Manifests For You (http://blogs.msdn.com/b/oldnewthing/archive/2007/05/31/2995284.aspx)

And,...Here is a reference from MSDN concerning Mainfest Files:   
Manifest Files Reference (http://msdn.microsoft.com/en-us/library/aa375632(v=VS.85).aspx)

...And, as an added BONUS,...here's a Raymond Chen blog that warns me not to do what I would have done if I was Dave:   
The Dangers of Playing Focus Games When Handling a WM_KILLFOCUS Message (http://blogs.msdn.com/b/oldnewthing/archive/2005/08/08/448969.aspx)
Title: Re: Edit Control/Tooltip problems with Manifest File
Post by: dedndave on April 25, 2011, 06:59:37 PM
back in the days of DOS and 14" monitors, i used to do it, myself - lol
now, i find it annoying
some people find it annoying that i don't capitalize and punctuate sentances, too   :P