A normal button which is a Custom Button in disguise?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: A normal button which is a Custom Button in disguise?

  1. #1
    Join Date
    Dec 2010
    Posts
    92

    A normal button which is a Custom Button in disguise?

    I want to a normal button to disguise a custom button I have written.
    Let's say the normal button comes from an ordinary application, I want to override the OnPaint function, so that it will draw the themed button.
    What I've done so far is I've got a custom button activex control, it works only when the button comes from my own designer, it can't "adapt" to an existing application, but my goal is to theme an ordinary application, how do I make this possible?
    Thanks
    Jack

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,956

    Re: A normal button which is a Custom Button in disguise?

    How about an ownerdraw button?
    Victor Nijegorodov

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,559

    Re: A normal button which is a Custom Button in disguise?

    Is the other application in a separate process? If so why are you injecting your code and trying to spoof an existing button of the application?

  4. #4
    Join Date
    Dec 2010
    Posts
    92

    Re: A normal button which is a Custom Button in disguise?

    Name:  2017-08-24 06_08_09-CPP_Container.jpg
Views: 21
Size:  9.3 KB

    This guy is no C# application, but a C++ with activex container

    See:
    https://www.codeproject.com/Articles...xTheme-wrapper

    https://www.codeproject.com/Articles...w-in-C-Project

    The problem when I was theming an ordinary application is that the control's Draw functions are not exposed in ActiveX context.
    So My workflow will be:
    1) Inject a DLL
    2) Divert Draw calls to my activex control
    3) Once there is a Draw Call coming in, I will divert it to my Draw Call

    After the application opens up a theme with OpenThemeData which can be ignored, it will call on DrawThemeBackground etc for example
    My activex interface is DrawThemeButton or OnPaint

    The difficult thing is that the winapi doesn't have a centralized/distributive calling system for drawing controls, and hence very decentralized
    Last edited by luckiejacky; August 23rd, 2017 at 05:33 PM.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)