Dmytro
Tue Apr 26 02:12:17 CDT 2005
Application.DoEvents actually has nothing to do with visual styles. However,
it can cause problems, but of a very specific nature. The keyword is
re-rentrancy; in other word, if you are in an event handler and call
Application.DoEvents, your handler might be invoked recursively, causing
unpredictable results. Therefore, one who uses DoEvents might exercise
extreme caution to prevent re-entrancy and the unpredictable order of UI
events.
--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:u184q8ZSFHA.3880@tk2msftngp13.phx.gbl...
> What happens if you remove the call to DoEvents() and what did this
> suggested fix cure?
>
> Instead of calling Application.EnableVisualStyles and
> Application.DoEvents, add a manifest file/resource and you will find that
> the images will display in toolbars, listviews, etc..
>
> --
> Mick Doherty
>
http://dotnetrix.co.uk/nothing.html
>
>
> "Saurabh" <saurabh@yupitsme.com> wrote in message
> news:eWcdhtYSFHA.1172@TK2MSFTNGP12.phx.gbl...
>>I tried adding the call to EnableVisualStyles in my application and that
>>did make the app look different, I would assume that the visual styles are
>>not enabled on my machine so the exception that I am seeing is something
>>else.
>>
>> Also noticed, when I eneabled the visual styles, none of my tree nodes
>> displayed icons. Now thats the mentioned symptom of the bug. So no visual
>> styles for now.....
>>
>> --Saurabh
>>
>> "Dmytro Lapshyn [MVP]" <x-code@no-spam-please.hotpop.com> wrote in
>> message news:eDEOAMYSFHA.1096@tk2msftngp13.phx.gbl...
>>> Hello,
>>>
>>> Visual styles, when enabled, make your buttons, text boxes etc. look
>>> XP-like. On the other hand, you get the 'rounded corners' even without
>>> enabling visual styles.
>>>
>>> According to my colleague, calling EnableVisualStyles indeed can cause
>>> some nasty bug, but as you say you don't call this method, you should be
>>> on the safe side.
>>>
>>> Speaking of comctl32.dll version, it's 5.82.2900.2180 on my WinXP SP2
>>> machine.
>>>
>>> Here's what you can try. Attach event handlers to the
>>> Application.ThreadException event and to the
>>> AppDomain.UnhandledException event. Write some dummy code in the
>>> handlers just to have an ability to set the breakpoint there. Once the
>>> breakpoint is hit, examine the exception caught in the Watch window,
>>> paying special attention to the stack trace. This way, you might get a
>>> clue on what is the actual source of the exception.
>>>
>>> --
>>> Sincerely,
>>> Dmytro Lapshyn [Visual Developer - Visual C# MVP]
>>>
>>>
>>> "Saurabh" <saurabh@yupitsme.com> wrote in message
>>> news:uPWuRSXSFHA.3088@TK2MSFTNGP15.phx.gbl...
>>>> Hello All,
>>>>
>>>> I have a .NET application running on Windows XP. I have quite a few
>>>> forms, some modal and some modeless. Once in a while we get a wierd
>>>> exception in the application and most of the time the code is
>>>> transferred to the top level 'ThreadExceptionEventHandler'. It is
>>>> difficult to get the information on actual exception. Most of the time
>>>> it seems to say "External component has thrown an exception' and the
>>>> source of the exception object is 'System'
>>>>
>>>> Doing a bit of searching on the internet, I came across the known bug
>>>> in EnableVisualStyles( ). I do not call the
>>>> Application.EnableVisualStyles at all. but I do call
>>>> Application.DoEvents (this was suggested as a fix somewhere) I tried
>>>> looking for the comctl32.dll. In the System32 folder the dll has
>>>> version 5.82. One of the articles on the internet said, XP uses 6.0 by
>>>> default. Where would this dll be?
>>>>
>>>> I do get rounded corners for my form's title bar, does this mean that
>>>> my application is using visual style? If yes where is it getting set?
>>>> Is it the default under Windows XP (SP2)?
>>>>
>>>> Can somebody direct me to information which will lead to better
>>>> understanding of visual styles and the related bug. I don't even know
>>>> whether what I am facing is the same bug or not
>>>>
>>>> TIA,
>>>>
>>>> --Saurabh
>>>>
>>>
>>
>>
>
>