Announcement

Collapse
No announcement yet.

Smeared window title bar

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

  • Smeared window title bar

    I have an app that is written Windows style, with a WinMain. It creates a nearly full-screen window, with a menu. It clears the client area to a chosen background color and writes a welcome message (TextOut) into it. It reads a file that contains a bitmap (a picture), and displays the picture. Then it creates a new device context (CreateCompatibleDC) and captures the entire client area into it, as a new, large bitmap, which it re-displays with Windows function BitBlt.

    All of this takes about a second, and the window is up and running, ready for the user to start using the menu. The app contains a “window proc” to process messages from the window. The menu items are the window’s serious functions, such as a help file and the execution of external applications. Along with processing the menu items, the window proc also watches for messages telling that the window has been moved, re-sized, minimized, etc. For any one of these, it immediately invokes BitBlt to restore the contents of the client area. (Without BitBlt, there would be an annoying flicker as the picture was being re-painted.) It also watches for a left-click within the client area (%WM_LBUTTONDOWN). This is the user’s last resort in case the client area gets erased by another windoiw. It also invokes BitBlt and restores the client area instantly..

    All of the essential features of the window work, but there are some cosmetic problems. One is that, if the window is dragged partly off the screen and back on again, the title bar and the menu bar are smeared. What’s happening is probably more technical than the way I am describing it, but it looks as though the pixels of these bars are moving at different rates as the window moves, so the title bar and menu bar are chopped into pieces and smeared out. (Note that the client area remains under control of the window proc, which repeatedly invokes BitBlt to preserve its original appearance.)

    Has anyone had experience with this sort of behavior?

    Another cosmetic problem is that I can’t get an icon to appear in the upper left corner of the title bar. The icon comes from an .ICO file, introduced by a script file. When the program is running, the icon appears in the Windows task bar at the bottom of the screen. However, there is an empty rectangle in the upper left corner of the window. The problem is not in my .ICO file, because my icon works in the SKELETON.BAS program of the PB Samples.

    I am mentioning these problems together, because they may be related.

  • #2
    Hi Harry;

    If possible could you post some compilable code that demonstrates the problem?

    Comment


    • #3
      Smeared window title bar

      #CODE

      // SHEL.RC code begins here.
      //
      //
      /////////////////////////////////////////////////////////////////////////////
      // SHEL.H
      //
      #define SHEL_ICON 101
      //
      #define IDM_PATH 9011
      #define IDM_PARMF 9031
      #define IDM_COSTF 9041
      #define IDM_EXIT 9051
      #define IDM_RUNOLD 9111
      #define IDM_RUNMCRI 9121
      #define IDM_RUNMCRFC 9131
      #define IDM_RUNMCRFI 9141
      #define IDM_HELP 9151
      //
      //
      #include "afxres.h"
      //
      //
      /////////////////////////////////////////////////////////////////////////////
      //
      SHEL_ICON ICON SHEL.ICO
      //
      /////////////////////////////////////////////////////////////////////////////
      //
      // Menu
      //
      // Note: & on secondary items does not work.
      //

      SHEL_MENU MENU DISCARDABLE
      BEGIN
      POPUP "&Files"
      BEGIN
      MENUITEM " &Path to file", IDM_PATH
      MENUITEM SEPARATOR
      MENUITEM " File 1", IDM_PARMF
      MENUITEM " File 2", IDM_COSTF
      MENUITEM SEPARATOR
      MENUITEM " E&xit", IDM_EXIT
      END
      //
      POPUP " &Run "
      BEGIN
      MENUITEM SEPARATOR
      MENUITEM SEPARATOR
      MENUITEM " Old file" IDM_RUNOLD
      MENUITEM SEPARATOR
      MENUITEM SEPARATOR
      MENUITEM " ", IDM_RUNMCRI
      END
      //
      MENUITEM "&Help (old)", IDM_HELP
      END
      //
      // SHEL.RC code ends here.





      ''''''''''''''''''''''''' Use any .ICO file and copy it as SHEL.ICO


      ''''''''''''''''''''''''' SHEL.BAS code begins here.




      #CODE
      #COMPILE EXE
      #INCLUDE "C:\PBWin90\WinAPI\WIN32API.INC" '''' Set the paths!
      '
      #RESOURCE "C:\PBWin90\SHEL.PBR" '''' Set the paths!
      '
      ' "SHEL" program
      '
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ''' Object identifiers . . .
      GLOBAL SHEL_ICON AS LONG, IDM_PATH AS LONG
      GLOBAL IDM_EXIT AS LONG, IDM_HELP AS LONG
      '''
      GLOBAL t_mesg AS TAGMSG, t_paint AS PAINTSTRUCT
      '''
      GLOBAL Xscrfrac AS DOUBLE, Yscrfrac AS DOUBLE
      '''
      GLOBAL hInstancg AS DWORD, hMenu AS DWORD, hShelWind AS DWORD
      GLOBAL hPaint AS DWORD, hPaintc AS DWORD, hDlg AS DWORD
      GLOBAL iFFFF AS DWORD, hBitmap AS DWORD, hBmObj AS DWORD
      '''
      GLOBAL SysX AS LONG, SysY AS LONG
      GLOBAL WindowW AS LONG, WindowH AS LONG
      '''
      GLOBAL Returna AS INTEGER
      '''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      '''
      FUNCTION WINMAIN (BYVAL hInstance AS DWORD, _
      BYVAL hPrevInst AS DWORD, _
      BYVAL lpCmdLine AS ASCIIZ PTR, _
      BYVAL nCmdShow AS LONG) AS LONG
      '''
      '''
      DIM szClassName AS ASCIIZ * 80, t_wc AS WNDCLASSEX
      '''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      '''
      '''''''''''''''' Start with housekeeping . . .
      '''
      iFFFF = 65535
      hInstancg = hInstance
      '''
      SHEL_ICON = 101
      IDM_PATH = 9011
      IDM_EXIT = 9051
      IDM_HELP = 9151
      '''
      szClassName = "Shell window"
      '''
      ''' Set window height and width . . .
      Xscrfrac = 0.92
      Yscrfrac = 0.90
      SysX = GetSystemMetrics (0)
      sysY = GetSystemMetrics (1)
      WindowW = Xscrfrac * SysX
      WindowH = Yscrfrac * SysY
      '''
      '''
      '''''''''''''''' Initialize window attributes in t_wc . . .
      '''
      t_wc.cbSize = SIZEOF (t_wc)
      t_wc.style = %CS_HREDRAW OR %CS_VREDRAW
      t_wc.lpfnWndProc = CODEPTR (ShelProc)
      '' Processor for window's messages
      t_wc.hInstance = hInstance
      t_wc.hIcon = LoadIcon (hInstance, "SHEL_ICON")
      '' No handle is returned!
      t_wc.hCursor = LoadCursor (%NULL, BYVAL %IDC_ARROW)
      t_wc.hbrBackground = GetStockObject (%WHITE_BRUSH)
      t_wc.lpszMenuName = %NULL
      t_wc.lpszClassName = VARPTR (szClassName)
      t_wc.hIconSm = LoadIcon (hInstance, BYVAL %IDI_APPLICATION)
      ''
      '''
      '''''''''''''''' Register class, load menu . . .
      '''
      RegisterClassEx t_wc
      hMenu = LoadMenu (hInstance, "SHEL_MENU")
      '''
      '''
      '''''''''''''''' Create SHEL window . . .
      '''
      hShelWind = CreateWindowEx (BYVAL %NULL, szClassName, _
      "Shell window 2009 Sample window", _
      %WS_OVERLAPPEDWINDOW, _
      %CW_USEDEFAULT, %CW_USEDEFAULT, _
      %CW_USEDEFAULT, %CW_USEDEFAULT, _
      %HWND_DESKTOP, hMenu, hInstance, _
      BYVAL %NULL)
      '''
      '''
      '''''''''''''''' Redefine SysX and SysY, and set window's position . . .
      '''
      SysX = SysX / 15
      SysY = SysY / 15
      Returna = _
      SetWindowPos (hShelWind, %HWND_TOP, SysX, SysY, WindowW, _
      WindowH, %SWP_SHOWWINDOW)
      '''
      '''
      '''''''''''''''' Event loop for SHEL window . . .
      '''
      DO WHILE (GetMessage (t_mesg, BYVAL %NULL, 0, 0) > 0)
      Returna = TranslateMessage (t_mesg)
      Returna = DispatchMessage (t_mesg)
      LOOP
      '''
      WINMAIN = t_mesg.wParam
      END FUNCTION '' WinMain
      '''
      '' ...........................................................................
      '' ...........................................................................
      '''
      '
      FUNCTION ShelProc (BYVAL hWnd AS DWORD, BYVAL messag AS DWORD, _
      BYVAL wParam AS DWORD, BYVAL lParam AS LONG) EXPORT AS LONG
      '
      ' Processor for the SHEL shell window, principally its menu . . .
      '''
      DIM messag1 AS DWORD, wParam1 AS DWORD
      '''...........................................................................
      '''
      messag1 = messag
      wParam1 = wParam AND iFFFF
      '
      ' If user's command was to close window at system level ("X"),
      ' messag = %WM_SYSCOMMAND and wParam = %SC_CLOSE, in which
      ' case treat this as though it were %WM_COMMAND with
      ' IDM_EXIT . . .
      IF (wParam1 = %SC_CLOSE) THEN ' %SC_CLOSE == Z'00F060' == 61536
      messag1 = %WM_COMMAND
      wParam1 = IDM_EXIT
      END IF
      '
      ' WM_COMMAND: user command
      IF (messag1 = %WM_COMMAND) THEN
      '''
      SELECT CASE (wParam1)
      '''
      CASE IDM_PATH
      FUNCTION = 0
      '''
      CASE IDM_EXIT
      ' Close window, then shut down and quit . . .
      FUNCTION = 0
      Returna = SendMessage (hShelWind, %WM_CLOSE, 0, 0)
      PostQuitMessage (0)
      '''
      CASE IDM_HELP ' No help available
      FUNCTION = 0
      '''
      CASE ELSE
      ' Let the default window proc handle all other messages . . .
      FUNCTION = DefWindowProc _
      ( hWnd, messag1, wParam1, lParam )
      END SELECT
      '''
      ELSEIF (messag1 = %WM_SHOWWINDOW OR messag1 = %WM_SIZING OR _
      messag1 = %WM_WINDOWPOSCHANGED OR messag1 = %WM_SIZE OR _
      messag1 = %WM_LBUTTONDOWN) THEN
      FUNCTION = 0
      Init_ShelWindow
      '''
      ELSE
      ' Let the default window proc handle all other messages . . .
      FUNCTION = DefWindowProc ( hWnd, messag1, wParam1, lParam )
      END IF
      '''
      END FUNCTION '' ShelProc
      '''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      '''
      SUB Init_ShelWindow
      '''
      ''' Sets (or re-sets) Shell window as active window, clears it to
      ''' background color, sets focus on it . . .
      '''
      DIM bkgcolor AS LONG
      '''
      bkgcolor = &H00DDCCBB ' Light pale blue
      ColOutps (bkgcolor)
      Returna = SetFocus (hShelWind)
      END SUB '' Init_ShelWindow
      '''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      '''
      SUB ColOutps (atrib_in AS LONG)
      '''
      ''' Originally this was a complicated routine that cleared the screen
      ''' and wrote a message to it. It was much more complex because it
      ''' had much greater flexibility than shown here. This version
      ''' just creates the "device context" and clears the client area to ''' background.
      '''
      DIM hBrush1 AS DWORD, hRegion AS DWORD
      DIM XReswi AS INTEGER, YReswi AS INTEGER
      '''
      ''' Clears the client area to a desired background color atrib_in.
      '''
      hPaint = BeginPaint (hShelWind, t_Paint)
      '''
      Returna = SetBkMode (hPaint, %OPAQUE) ' Don't use TRANSPARENT '
      hBrush1 = CreateSolidBrush (atrib_in)
      '''
      ''' Screen resolutions . . .
      XReswi = INT (Xscrfrac * GetDeviceCaps (hPaint, %HORZRES))
      YReswi = INT (Yscrfrac * GetDeviceCaps (hPaint, %VERTRES))
      '''
      hRegion = CreateRectRgn (1, 1, XReswi, YReswi)
      Returna = SelectClipRgn (hPaint, hRegion)
      ''' Clear the screen by painting the defined region . . .
      Returna = FillRgn (hPaint, hRegion, hBrush1)
      Returna = UpdateWindow (hShelWind)
      Returna = DeleteObject (hBrush1)
      '''
      END SUB ' ColOutps
      '''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
      ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

      Comment


      • #4
        I hate to have to say this, but your Window Procedure is very poorly written and prone to serious errors.

        Here is what your window procedure actually is:

        Code:
        FUNCTION ShelProc (BYVAL hWnd AS DWORD, BYVAL messag AS DWORD, _
                           BYVAL wParam AS DWORD, BYVAL lParam AS LONG) EXPORT AS LONG
            DIM messag1 AS DWORD, wParam1 AS DWORD
            messag1 = messag
            wParam1 = wParam AND iFFFF
            ' ---------------------------------------------------------------
            ' BIG, BIG, ERROR!
            ' you are testing wparam outside of the select case, so that ALL
            ' messages are affected by this code
            ' ---------------------------------------------------------------
            IF (wParam1 = %SC_CLOSE) THEN ' %SC_CLOSE == Z'00F060' == 61536
                messag1 = %WM_COMMAND
                wParam1 = IDM_EXIT
            END IF
            ' ---------------------------------------------------------------
            IF (messag1 = %WM_COMMAND) THEN
                SELECT CASE (wParam1)
                    CASE IDM_PATH
                        FUNCTION = 0
                    CASE IDM_EXIT
                        FUNCTION = 0
                        Returna = SendMessage (hShelWind, %WM_CLOSE, 0, 0)
                        PostQuitMessage (0)
                    CASE IDM_HELP ' No help available
                        FUNCTION = 0
                    CASE ELSE
                        ' Let the default window proc handle all other messages . . .
                        FUNCTION = DefWindowProc ( hWnd, messag1, wParam1, lParam )
                END SELECT
            ELSEIF (messag1 = %WM_SHOWWINDOW OR messag1 = %WM_SIZING OR _
                    messag1 = %WM_WINDOWPOSCHANGED OR messag1 = %WM_SIZE OR _
                    messag1 = %WM_LBUTTONDOWN) THEN
                    FUNCTION = 0
                    Init_ShelWindow
            ELSE
                FUNCTION = DefWindowProc ( hWnd, messag1, wParam1, lParam )
            END IF
        END FUNCTION
        Did you notice the first big mistake ?

        You are testing the value of wParam outside of the select case structure normally used. %SC_CLOSE can only be tested if the message is WM_SYSCOMMAND and your aren't even testing for that message.

        Rule of thumb, always use the standard select case structure for testing messages and do not do stuff outside of it (unless it is not related to a specific message).

        Many messages are being passed through a window procedure and if you in any way confuse the window procedure, then some messages may get all messed up.

        Start by rewriting your window procedure properly. Then test each message in the select case structure and process each message individually.

        The following code is also very suspect:

        Code:
          ELSEIF (messag1 = %WM_SHOWWINDOW OR messag1 = %WM_SIZING OR _
                    messag1 = %WM_WINDOWPOSCHANGED OR messag1 = %WM_SIZE OR _
                    messag1 = %WM_LBUTTONDOWN) THEN
                    FUNCTION = 0
                    Init_ShelWindow
        Have you taken the time to see exactly how each of these messages work, what the return value for each means and whether your call to the routine Init_ShelWindow will have any ill effects on that message.

        Please, please take this in the right way.

        Window procedure code must be written according to proper rules and you must handle each message carefully. If the processing in any message makes calls to an API which is not appropriate to the message, then serious results can occur.
        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment


        • #5
          >#CODE

          Should be http://www.powerbasic.com/support/pb....php?do=bbcode

          Yes, you can "edit" to insert.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Thank you for your courtesy and your prompt reply. Sorry, my reply took a little longer. Thanks also for the tip about testing (or not testing) wParam outside of a SELECT. The code that I used (testing wParam directly against SC_CLOSE, then conditionally changing the incoming message to %WM_COMMAND and wParam to the identifieing number of an existing option, IDM_EXIT, and processing it that way) is a shortcut that I read about somewhere, but, unfortunately, I can’t find it now. It may have been a C or even a Fortran example, because I used it first in Fortran.

            The code I posted was not the application’s original code – which, btw, does work very reliably except for the cosmetic flaws I mentioned. What I posted was a chopped up, condensed, stripped-down version that took out most of the functionality of the original but left the enough to show the problem I discussed in the first posting. Sorry -- I was sloppy and hasty in that effort. In some places I took out too much. In others I didn’t take out enough. The original app made much more sense and had much more functionality than what you saw, but it was also 2 or 3 times as big.

            You also called attention to the statements starting
            ELSEIF (messag1 = %WM_SHOWWINDOW OR message1 = %WM_SIZING

            With comments added now to improve clarity, those statements used to be:

            ELSEIF (messag1 = %WM_SHOWWINDOW OR messag1 = %WM_SIZING OR _
            messag1 = %WM_WINDOWPOSCHANGED IR messag1 = %WM_SIZE OR _
            messag1 = %WM_LBUTTONDOWN) THEN
            FUNCTION = 0
            IF (bBitmap) THEN
            ‘ The client area has already been captured as a bitmap, so call
            ' BitBlt to restore it if any of the above events (sizing, position
            ' changed, etc.) have occurred.
            Returna = BitBlt (hPaint, 0, 0, WindowW, WindowH, hPaintc, _
            0, 0, %SRCCOPY)
            ELSE
            ‘ Call my Init_ShelWindow to do initializations, including clearing
            ' the client area to background, writing a greeting, reading a
            ' bitmap file, displaying the bitmap, and capturing the client area
            ' to a new device context.
            CALL Init_ShelWindow
            END IF

            These could have been written differently, e.g.,
            ELSEIF (messag1 = %WM_SHOWWINDOW) THEN
            FUNCTION = 0
            IF (bBitmap) THEN
            Returna = BitBlt (hPaint, 0, 0, WindowW, WindowH, hPaintc, _
            0, 0, &SRCCOPY)
            ELSE
            CALL Init_ShelWindow
            END IF

            ELSEIF (messag1 = %WM_SIZING OR messag1 = %WM_WINDOWPOSCHANGED OR _
            messag1 = %WM_SIZE OR messag1 = %WM_LBUTTONDOWN) THEN
            Returna = BitBlt (hPaint, 0, 0, WindowW, WindowH, hPaintc, _
            0, 0, %SRCCOPY)

            ELSEIF . . . . . . . . . . . . . . . . . . .

            Now, for the present - - -

            I have replaced the original posted code with a revised version of the condensed version of my application. For my present purposes, it does not need to respond to the menu options, although I have made it respond to “Exit” under “Files.” It does not need a bitmap picture in the window, although I have given the window an opaque light-blue shading. I have also changed the window’s command processor so that it now tests for WM_SYSCOMMAND before testing SC_CLOSE.

            However - - -

            I am still seeing the problem that I originally wrote about. To describe it more accurately, let me say this: If any part of the title bar and/or the menu bar is moved off-screen and then moved back onto the screen, that part does not survive. In my completed app (not the much shorter code you are seeing), the client area is unaffected, because it is being renewed continuously.

            The problem I have mentioned is all the more puzzling because it does not occur in my Fortran version of the same application, even though that uses the same early testing of wParam against SC_CLOSE. (Yes, there is a Fortran version, but it is 12.4 times as big as the PB one!)

            I think we need to be looking somewhere else, other than the window’s command processor.

            Comment


            • #7
              Code:
              IF (wParam1 = %SC_CLOSE) THEN
              ===>
              Code:
                IF msg=WM_SYSCOMMAND AND    _ 
                         wParam1 AND &hFFF0 = %SC_CLOSE THEN...
              But as Chris says.... maybe you should rewrite that WindowProcedure, starting with...
              Code:
              FUNCTION WindowProc (BYVAL hWnd AS LONG, BYVAL wMsg AS LONG,_
                   BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
              
              END FUNCTION
              While you "might" get what you have to "work" you will not enjoy testing, debugging or changing it at all.

              And don't even put in code for the messages you don't care about. DefWindowProc() will handle all the right actions for you. Just pick off what you want to use and do your thing on the specific message of interest.

              E.g., note in your code you have this:
              Code:
              ELSEIF (messag1 = %WM_SHOWWINDOW OR messag1 = %WM_SIZING OR _
              messag1 = %WM_WINDOWPOSCHANGED OR messag1 = %WM_SIZE OR _
              messag1 = %WM_LBUTTONDOWN) THEN
              FUNCTION = 0
              Init_ShelWindow
              There is no way you want to call Init_ShelWindow on WM_SHOWWINDOW (which you are not handling correctly) AND on WM_SIZE AND on WM_SIZING AND on WM_WINDOWPOSCHANGED AND on WM_LBUTTON down (also coded incorrectly as you are not accounting for someone holding the key down and generating multiple WM_LBUTTONDOWN messages).

              If you want to paint the screen a special way, do it on .... yes .. WM_PAINT, which you will only get when 'something' has happened which makes a repaint necessary.

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Smeared window title bar

                Thanks again to those who offered help. I learned from anothr source that a major problem was the lack of a CASE %WM_PAINT in my command processor. I was trying to capture all the possible actions that might occur when a window was shown, moved, resized, etc., and was trying to re-paint it in response to each of those actions (%WM_POSCHANGED, etc., etc.), but I neglected the single one, %WM_PAINT, that would have covered all of those, at least for my purposes.

                I also know the cause of the smeared (perhaps I should say erased) title bar, although I don't understand it. I was ANDing wParam with a DWORD that had been initialized to 65535. This worked for everything I was testing, including the numeric equates of over a dozern menu items. Now I am ANDing wParam with the constant &HFFFF, and the problem has gone away.
                Now, if I can just figure out why the LoadIcon doesn't put my icon in the title bar (although it's in the Windows task bar) . . . . . . . . . . . .

                Comment


                • #9
                  If you want to repaint a window whenever certain messages occur, you don't attempt to repaint within those messages.

                  For example when you get the WM_SIZE message, you can force a repaint by simply calling the InvalidateRect API function which can invalidate the entire client area.

                  Invalidate means:

                  Generate WM_PAINT for the area invalidated.

                  ie.

                  Code:
                  CASE %WM_SIZE
                        InvalidateRect hWnd&, BYVAL %NULL, 1
                  Chris Boss
                  Computer Workshop
                  Developer of "EZGUI"
                  http://cwsof.com
                  http://twitter.com/EZGUIProGuy

                  Comment


                  • #10
                    >CASE %WM_SIZE
                    > InvalidateRect hWnd&, BYVAL %NULL, 1

                    Not the best example..... If WM_SIZE means a repaint is necessary WM_PAINT will be generated automatically (By defwindowProc?) . E.g in this case if param is SIZE_MINIMIZED, no repaint is required.

                    Not to say invaldiateRect [+updateWindow] is not useful in some circumstances, but I think if Mr. Akers starts with the premise he is going to paint on WM_PAINT and only on WM_PAINT, those situations will become self-evident soon enough.

                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Eek! Mind the parentheses, please. That should be:

                      Code:
                        IF msg=WM_SYSCOMMAND AND    _ 
                                 (wParam1 AND &hFFF0) = %SC_CLOSE THEN...

                      Comment


                      • #12
                        > Eek! Mind the parentheses, please

                        Oh, right you are, sir.

                        Well, I do big ideas. Details are left to staff.
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Originally posted by Harry Akers View Post
                          Now, if I can just figure out why the LoadIcon doesn't put my icon in the title bar (although it's in the Windows task bar) . . . . . . . . . . . .
                          are you using the %WS_SYSMENU window style?

                          Comment


                          • #14
                            Smeared window title bar

                            I'm not using %SYSMENU, but I have solved the problem. I had some contradictions in the "defined equates."

                            Comment

                            Working...
                            X