Announcement

Collapse
No announcement yet.

Stuck on this Button superclass, Help needed

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

  • Stuck on this Button superclass, Help needed

    Hi Guys,

    This sample has a few problems according to an expert, but wich is not clear to me, so I am stuck.

    Tryed this but can't get it to work I miss some link I guess, it works with a force repaint in %WM_NCHITTEST otherwise it is dead.

    Run the sample then comment out Case %WM_NCHITTEST and run it again.

    Sample in zip file with resource file what is needed.

    Just busy for 2 weeks in SDK so...
    Attached Files
    To Ask or Not To Ask ?

  • #2
    Code:
    FUNCTION AvSupClass(SrcClassName AS STRING, DstClassName AS STRING, AvNewWndProc AS LONG) AS LONG
    
    [b]     CallWindowProc AvNewWndProc, 0, 0, wc.lpfnWndProc, wc.cbWndExtra ' init our new-procedure with adress off old-one
    [/b]
    You don't call CallWindowProc when registering the superclass.

    Take that out your code should run fine... well, let me try it real quick...

    Well, no it doesn't, it does not create the buttons. Which you would have known had you tested hBtn after CreateWindowEx (it comes back null).

    You are "doing something else wrong" but you know it has to be before you create the window. I know, I'll bet you need to use the hInstance of this program insteadl of null, let me try that....no that's not it.

    OK, I found it.

    I was right, you don't "CALLWINDOWPROC" where you did, what you should have done was...

    Code:
          'CallWindowProc AvNewWndProc, 0, 0, wc.lpfnWndProc, wc.cbWndExtra ' init our new-procedure with adress off old-one
    [b]     CALL AvButCtrl (0, 0, wc.lpfnWndProc, wc.cbWndExtra) [/b]
    Now you have buttons.

    No charge.

    This time.

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

    Comment


    • #3
      by the way... using an #INCLUDE file for...
      Code:
          #COMPILE EXE
          #DIM ALL
          #INCLUDE "WIN32API.INC"
          #RESOURCE "Stuck.pbr"
      .. is kinda, well, weird. It's not like this particular #INCLUDE file is reusable. (#RESOURCE statement kind of insures that).

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

      Comment


      • #4
        MM,

        Haha first proggie with superclassed "no buttons"
        The skinned one was over them, and then they actually worked also?
        Strange thing is I got buttons, hmm , I made this sample to just isolate the button problem , have to watch better !

        Michael that leaves me with the problem that when the :
        Case %WM_NCHITTEST
        AVUpdateWin(GetDlgItem(hWnd, GetWindowLong(hWnd, %GWL_ID)), 0)

        is taken out the WM_paint routine is dead, and I am not sure what I need
        for this, wich way should I go :

        TrackMouseEventAPI ?

        Thanks a lot for helping MM, if you are stuck, you gonna try all kind of strange things hoping you actually hit something that put you on the road again.
        To Ask or Not To Ask ?

        Comment


        • #5
          >GetDlgItem(hWnd, GetWindowLong(hWnd, %GWL_ID))

          That's wrong.

          That says "find the child of hWnd which has an identifier equal to the identifier of hwnd to ITS parent window"

          Five bucks says that is NOT what you want.

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

          Comment


          • #6
            Hehe MM,

            Where did you find that RTFM
            I did to much reading in a short time I think, but what I was smoking when I made that funk I forgot!
            Was proberly reading on second monitor the wrong api-call when I made this.

            Thanks a Zillion MM, finally on the road again.
            To Ask or Not To Ask ?

            Comment


            • #7
              For your buttons you could also make them ownerdrawn, then you won't need to create a superclass (only needed to perform ultimate control over things).

              There are plainty of examples showing how to create ownerdrawn buttons, and you will find some on this forum too.
              Patrice Terrier
              www.zapsolution.com
              www.objreader.com
              Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

              Comment


              • #8
                Patrice,

                I know that, but the main program I want to skin has 2 tiny calculator like
                controls with each 13 buttons, thats why I want the Superclass.
                But anyway Patrice I like to puzzle it out, when I have a basic then things will speed up, just trying to get the whole TINY api reference in my head in
                a couple off weeks
                And for know I stick to basic-GDI so no advanced skinning like your work,
                Your skins looks so good that they forget to work with the proggie :goldcup:
                To Ask or Not To Ask ?

                Comment


                • #9
                  Patrice does some amazing things with graphics and pictures and artwork.

                  Me, I can't win at "Hangman" for want of the required art skills.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎