CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 39 of 39
  1. #31
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [win32] - transparent and opacy

    Quote Originally Posted by 2kaud View Post
    You have checked, haven't you, that GetSize() and GetPosition() are returning the expected values?
    yes.. i have tested now:
    Code:
    struct Position
    {
    	int X;
    	int Y;
    };
    
    struct Size
    {
    	int Width;
    	int Height;
    };
    
    Position GetPosition()
        {
            RECT LabelSize;
            GetWindowRect(hwnd,&LabelSize);
            Position crdSize = {LabelSize.left,LabelSize.top};
            return crdSize;
        }
    
    Size GetSize()
        {
            RECT LabelSize;
            GetWindowRect(hwnd,&LabelSize);
            Size crdSize = {LabelSize.right-LabelSize.left,LabelSize.bottom-LabelSize.top};
            return crdSize;
        }

  2. #32
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: [win32] - transparent and opacy

    ...and clrBackColor is set where?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #33
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [win32] - transparent and opacy

    Quote Originally Posted by 2kaud View Post
    ...and clrBackColor is set where?
    Code:
    void SetBackColor(COLORREF color)
        {
            clrBackColor=color;
            ShowWindow(hwnd,SW_HIDE);
            ShowWindow(hwnd,SW_SHOW);
        }
    
        color GetBackColor()
        {
            return clrBackColor;
        }

  4. #34
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: [win32] - transparent and opacy

    ...and SetBackColor() is called from where? And is it called before the WM_ERASEBKGND message is received?
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #35
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [win32] - transparent and opacy

    Quote Originally Posted by 2kaud View Post
    ...and SetBackColor() is called from where? And is it called before the WM_ERASEBKGND message is received?
    it's a class member... the ShowWindow() helps me do the control update

  6. #36
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: [win32] - transparent and opacy

    But have you checked that SetBackColor() is called before the WM_ERASEBKGND message is recieved? If it is called after, then clrBackColor won't have been set before it's used in the message process code.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  7. #37
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [win32] - transparent and opacy

    Quote Originally Posted by 2kaud View Post
    But have you checked that SetBackColor() is called before the WM_ERASEBKGND message is recieved? If it is called after, then clrBackColor won't have been set before it's used in the message process code.
    you came 1st?
    WM_CTLCOLORSTATIC or WM_ERASEBKGND?

  8. #38
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: [win32] - transparent and opacy

    Output the received msg codes to a file or a debug window and see. It's for this sort of thing that I had the msg codes output to a file in an earlier example I posted.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  9. #39
    Join Date
    Apr 2009
    Posts
    1,355

    Re: [win32] - transparent and opacy

    Quote Originally Posted by 2kaud View Post
    Output the received msg codes to a file or a debug window and see. It's for this sort of thing that I had the msg codes output to a file in an earlier example I posted.
    it's the WM_ERASEBKGND message.. is the 1st. and then cames the WM_CTLCOLORSTATIC message

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured