Announcement

Collapse
No announcement yet.

Desktop Shortcut Icon Reappears

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Desktop Shortcut Icon Reappears

    Hello all,

    I'm working on an app that tests LCD screens with various colors, patterns, etc.
    When my app starts the first thing it does is clear the entire screen
    to black and then display a splash screen.

    However, when I start the app with a desktop shortcut, the screen clears
    as it should but after 1-2 seconds the desktop shortcut icon reappears over
    my splash screen. Icky! The system tray clock also reappears when the minute
    rolls over. This is on Win98.

    Is there a way to disable these system-level redraws by Windows?

    (FWIW, I'm using Graphics Tools to do the graphics.)

    Thanks!


    ------------------
    Mark Newman
    Mark Newman

  • #2
    Mark --

    Graphics Tools uses 100% standard techniques to create a graphics window and perform drawing operations. There is nothing unusual about the window.

    I have never heard of a desktop icon reappearing like that, over any type of window. And if your graphics window covers the task bar clock, clearly a clock-update should not affect your window.

    My first thought is a buggy video driver. Do you see this behavior on more than one type of computer, for example one that does not use an LCD screen?

    When the icon reappears does it appear to have the focus? Does pressing Enter start another instance of the program, or is the keystroke being seen by your program?

    -- Eric Pearson, Perfect Sync Software

    ------------------
    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>



    [This message has been edited by Eric Pearson (edited June 07, 2001).]
    "Not my circus, not my monkeys."

    Comment


    • #3
      Or by some strange chance is hte program icon going to the splash screen from internally?


      ------------------
      Scott
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Eric-My apologies, I didn't mean to imply anything about Graphics Tools, just
        provided it as background info. (Heck, I bought GT with my own money, not
        the company's, and I'm happy as can be with it. This app is the first serious
        one I've done with GT and I've gotten several compliments on it, as well as
        questions like, "How did you get VB to run that fast?" )

        Currently this app only runs on a specific hardware setup (it's a dedicated
        manufacturing system) so I can't easily test on other platforms. I'll see if
        I can cook up some test code using the same techniques.

        The video driver is a likely suspect, as it's a custom one for the LCD. But
        doesn't Windows have to ask for repaints or do video drivers do much more
        on their own these days?


        Scott-Not sure I follow you; could you rephrase?

        Thanks!


        ------------------
        Mark Newman
        Mark Newman

        Comment


        • #5
          Mark --
          Sounds like using an hDC of the screen.
          For example, hDC = GetDC(hWnd), but hWnd = 0.

          ------------------
          E-MAIL: [email protected]

          Comment


          • #6
            > My apologies, I didn't mean to imply anything about Graphics Tools

            No apology necessary, I didn't take it that way. You should always eliminate the "top layer" first, and I just wanted to reassure that you Graphics Tools wasn't doing anything unorthodox, so you can probably rule it out. It's just a plain ol' window. I also didn't want other readers to assume that this is "a Graphics Tools thread" and fail to suggest other possibilities.

            > The video driver is a likely suspect, as
            > it's a custom one for the LCD.

            It's amazing how many bad ones are out there. I have been living with a buggy Trident driver for three years now. I tried to update it last year, and afterward my system would not even boot. It took me a DOS-boot-floppy and about 10 hours of work just to get back where I started, so now I just live with the display glitches. (When I scroll a Spread 3.0 Grid with a highlighted block, for example, it creates large inverse-color rectangles outside the boundaries of the grid. But only on this workstation.)

            > But doesn't Windows have to ask for repaints
            > or do video drivers do much more on their own
            > these days?

            Windows performs zero actual repaint operations. Virtually 100% of the GDI subsystem -- the API functions that are used to control the display -- are simple wrappers for standard-name functions that are actually performed by the current video driver. Your program calls an API function, and Windows simply passes the request to the driver. The driver handles the actual operation in all cases. You're right in saying that Windows "asks" for the repaints, but how it is done, and exactly what gets repainted, is often up the the driver. As in the case of the Spread Grid, it does not always work perfectly.

            I have never heard of an effect like this, so if I were you I would rule out the driver first. Is an updated video driver available for the custom hardware?

            -- Eric


            ------------------
            Perfect Sync Development Tools
            Perfect Sync Web Site
            Contact Us: mailto:[email protected][email protected]</A>
            "Not my circus, not my monkeys."

            Comment


            • #7
              Semen makes a very interesting point... If for some unknown reason the graphics window creation process failed, Graphics Tools would default to drawing on the desktop. The fact that GetDC(0) returns the desktop window DC doesn't seem to be documented anywhere. Nice catch Semen!

              It would be easy to test this theory... Change the size of your graphics window so that it does not fill the screen. If you don't see the edges of the graphics window when you run the program, then it never got created.

              -- Eric


              ------------------
              Perfect Sync Development Tools
              Perfect Sync Web Site
              Contact Us: mailto:[email protected][email protected]</A>
              "Not my circus, not my monkeys."

              Comment


              • #8
                > The fact that GetDC(0) returns the desktop window DC doesn't seem to be documented anywhere.

                It's documented in MSDN in GetDC function description. http://msdn.microsoft.com/library/ps...vcons_4esj.htm

                ------------------
                E-MAIL: [email protected]

                Comment


                • #9
                  I guess I shouldn't have said "anywhere". Thanks for the reference, Semen.

                  -- Eric


                  ------------------
                  Perfect Sync Development Tools
                  Perfect Sync Web Site
                  Contact Us: mailto:[email protected][email protected]</A>

                  [This message has been edited by Eric Pearson (edited June 07, 2001).]
                  "Not my circus, not my monkeys."

                  Comment


                  • #10
                    I've put together a small test app which does cause the icon to reappear,
                    at least sometimes! On my NT 2K system, the icon reappears about 1 out of
                    10 tries. At least this rules out video drivers, for now anyway.

                    The variability in the results tells me that perhaps I'm trying
                    to do the graphics operations too fast.

                    When the icon does reappear, it doesn't have the focus.

                    Here's the code:
                    Code:
                    ' AA.bas
                    '
                    
                    #Compile Exe "aa.exe"
                    #Register None
                    #Dim All
                    #Resource "aa.pbr"
                    
                    #Include "win32api.inc"
                    
                    #Include "C:\swtools\GfxTools\GfxTools.INC"
                    
                    ' This function isn't in "win32api.inc"
                    Declare Function EnumDisplaySettings Lib "user32.dll" Alias "EnumDisplaySettingsA" _
                    	(ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As DEVMODE) As Long
                    
                    ' Global variables
                    Global gtScrnModes()  	As DEVMODE
                    Global glNumModes   		As Long
                    Global glStartMode  		As Long
                    Global glScreenWidth 	As Long, glScreenHeight As Long, glColorDepth As Long
                    
                    Declare Sub SplashScreen()
                    Declare Sub GetScreenSettings()
                    
                    '***************************************************************************
                    
                    Function WinMain(ByVal hCurInstance  As Long, _
                                     ByVal hPrevInstance As Long, _
                                     lpszCmdLine         As Asciiz Ptr, _
                                     ByVal nCmdShow      As Long) Export As Long
                    
                       Local Msg         As tagMsg
                      	Local wndclass    As WndClassEx
                      	Local szAppName   As Asciiz * 80
                      	Local hWnd        As Long
                    
                    	GfxOption  %GFX_MODULE_INSTANCE, hCurInstance
                    
                    	szAppName              = "aa"
                    	wndclass.cbSize        = SizeOf(WndClass)
                    	wndclass.style         = %CS_HREDRAW OR %CS_VREDRAW
                    	wndclass.lpfnWndProc   = CodePtr( WndProc )
                    	wndclass.cbClsExtra    = 0
                    	wndclass.cbWndExtra    = 0
                    	wndclass.hInstance     = hCurInstance
                    	wndclass.hIcon         = LoadIcon( hCurInstance, "logo" )
                    	wndclass.hCursor       = LoadCursor( %NULL, ByVal %IDC_ARROW )
                    	wndclass.hbrBackground = GetStockObject( %WHITE_BRUSH )
                    	wndclass.lpszMenuName  = %NULL
                    	wndclass.lpszClassName = VarPtr( szAppName )
                    	wndclass.hIconSm       = LoadIcon( hCurInstance, ByVal %IDI_APPLICATION )
                    
                    	RegisterClassEx wndclass
                    
                    	' Create a window using the registered class
                    	hWnd = CreateWindowEx(%WS_EX_TRANSPARENT, szAppName, _
                    							"LCD Test", _
                    							%WS_POPUP Or %WS_CLIPCHILDREN, _
                    							0, 0, _
                             				GetSystemMetrics(%SM_CXSCREEN), _
                             				GetSystemMetrics(%SM_CYSCREEN), _
                             				0, ByVal %Null, _
                             				hCurInstance, ByVal %NULL)
                    
                    	' Display the window on the screen
                    	ShowWindow hWnd, nCmdShow
                    	UpdateWindow hWnd
                    
                    	' Main message loop
                    	While GetMessage(Msg, %NULL, 0, 0)
                    		TranslateMessage Msg
                    	 	DispatchMessage Msg
                    	Wend
                    
                    	Function = msg.wParam
                    
                    End Function
                    
                    ' **********************************************************************
                    
                    Function WndProc (ByVal hWnd As Long, ByVal wMsg As Long, _
                                      ByVal wParam As Long, ByVal lParam As Long) As Long
                    '
                    ' Function: Message handler
                    ' Accepts : Standard WndProc params
                    ' Returns : False if the message was handled by this function, True to let
                    '				the Windows default handler process it
                    '
                    	Select Case wMsg
                    
                    		Case %WM_CREATE
                    			' Get the screen setup data
                    			GetScreenSettings
                    
                    		  	' Initialize the graphics window to the current screen size
                                            ' minus 10 pixels on each side to test the GetDC() item.
                    			InitGfx hWnd, 10, 10, glScreenWidth - 10, glScreenHeight - 10, %TOOLSET_WINDOWS
                    
                    			' Show the graphics window...
                    			GfxWindow %SHOW
                    
                    			' ...and then the splash screen
                    			SplashScreen
                    
                    		Case %WM_CHAR
                    			' Terminate on the ESC key
                    			If wParam = 27 Then SendMessage hWnd, %WM_CLOSE, 0, 0
                    
                    		Case %WM_DESTROY
                    			PostQuitMessage 0
                    			WndProc = 0
                    			Exit Function
                    
                    	End Select
                    
                    	WndProc = DefWindowProc(hWnd, wMsg, wParam, lParam)
                    
                    End Function
                    
                    ' **********************************************************************
                    
                    Sub SplashScreen()
                    
                    	GfxWindow %FREEZE
                    
                       ' Clear the graphics window to Black
                    	BrushColor %Black
                    	GfxCLS
                    
                    	DrawFrom 100, 75
                    	DrawFrame 500, 300
                    
                    	BrushColor Rgb(150, 150, 150)
                    	DrawFrom 150, 150
                    	DrawFlood %FLOOD_SURFACE, %Black
                    
                    	' Draw the program name
                    	GfxFont "Arial", 20, 40, 4, %Black, 0, 0
                    	DrawFrom 210, 90
                    	DrawTextBox "AA" & $CRLF & "LCD Test", %TEXT_WORD_BREAK + %TEXT_NO_PARTIALS, 400, 300
                    
                    	' Program rev
                    	GfxFont "Arial", 10, 20, 2, %Black, 0, 0
                    	DrawFrom 210,220
                    	DrawTextRow "Revision 0.0.0", 0
                    
                    	' Show the legal stuff
                    	GfxFont "Arial",10, 20, 2, %Black, 0&, 0
                    	DrawFrom 210, 270
                    	DrawTextBox "©2001 AA Corp." & $CRLF & "Press ESC to quit.", %TEXT_WORD_BREAK + %TEXT_NO_PARTIALS, 400, 300
                    
                    	GfxFont "Arial",8, 16, 2, %Black, 0&, 0
                    	DrawFrom 490, 350
                    	DrawTextRow Format$(glScreenWidth) & "x" & Format$(glScreenHeight) & "x" & Format$(glColorDepth), 0
                    
                    	GfxWindow %UNFREEZE
                    
                    End Sub
                    
                    ' ****************************************************************************
                    
                    Sub GetScreenSettings()
                    '
                    ' Get the current screen settings
                    '
                    	Local hdc As Long
                    	Local szDevice As Asciiz * 80
                    
                    	' Get existing BitsPerPixel (color depth)
                    	szDevice = "DISPLAY"
                    	hdc = CreateIC (szDevice, ByVal %NULL, ByVal %NULL, ByVal %NULL)
                    	glColorDepth = GetDeviceCaps(hdc, %BITSPIXEL)
                    	DeleteDC hdc
                    
                    	' Get the current screen size
                    	glScreenWidth = GetSystemMetrics(%SM_CXSCREEN)
                    	glScreenHeight = GetSystemMetrics(%SM_CYSCREEN)
                    
                    End Sub
                    The resource file just has 2 lines:

                    #include "C:\Program Files\PBDLL60\Winapi\resource.h"
                    logo ICON earth.ico


                    Thanks!


                    ------------------
                    Mark Newman

                    [This message has been edited by Mark Newman (edited June 07, 2001).]
                    Mark Newman

                    Comment


                    • #11
                      It's not the video driver, it's not Graphics Tools, it's not a Device Context problem, and it's not drawing too fast.

                      Get rid of WS_EX_TRANSPARENT and everything should work fine.

                      Here is what Win32.HLP says about WS_EX_TRANSPARENT...

                      Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window.

                      And that's exactly what you are seeing. Windows that are beneath your app, such as the icon and task bar items, are showing through. Because the graphics window is a child of the main window, it too is being affected.

                      -- Eric


                      ------------------
                      Perfect Sync Development Tools
                      Perfect Sync Web Site
                      Contact Us: mailto:[email protected][email protected]</A>



                      [This message has been edited by Eric Pearson (edited June 07, 2001).]
                      "Not my circus, not my monkeys."

                      Comment


                      • #12
                        Eric,

                        Works like a charm!

                        I though I read somewhere that WS_EX_TRANSPARENT should be used when
                        you want to "take over" the whole screen, but obviously not!

                        Many thanks!


                        ------------------
                        Mark Newman
                        Mark Newman

                        Comment


                        • #13
                          Where is the GfxTools.Inc?

                          ------------------



                          Arthur Kohl

                          Comment


                          • #14
                            Arthur --

                            GFXTOOLS.INC is part of Graphics Tools, which is a PowerBASIC add-on that is published by my company, Perfect Sync Software. Just click on one of the links below for more information...

                            -- Eric


                            ------------------
                            Perfect Sync Development Tools
                            Perfect Sync Web Site
                            Contact Us: mailto:[email protected][email protected]</A>
                            "Not my circus, not my monkeys."

                            Comment


                            • #15
                              Arthur,

                              I've been using it for about 9 months now & the combination of
                              PBDLL, Graphics Tools & EzGui has made the transition from Dos
                              to WinBlows a lot easier! I've been able to concentrate on the
                              products I'm developing, instead of every detail of windows and
                              that has made a hugh difference in my ability to get some new
                              product out the door.

                              Russ Srole
                              Editing Technologies Corp.



                              ------------------
                              "There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs." - John Rogers

                              Comment

                              Working...
                              X