-
July 21st, 2017, 02:57 AM
#1
How do I put a COM-aware control onto a form (.rc file) or programatically?
How do I make the controls in my form located in my .rc file aware of the theme wrapper?
It exposes theme related functionality
I want to either put the controls coming from Advanced Theme wrapper programmatically
Or
All the controls to be aware of the "hooking" library???
Thanks
Jack
Code:
#include <iostream>
#include <Windows.h>
#include "resource.h"
#include "commctrl.h"
#import "E:\Projects\Personals\Shell\XP Theme\Advanced Theme Wrapper\Advanced Theme Wrapper\Demo\bin\Release\Devcorp.Controls.VisualStyles.Sample.tlb" no_namespace
#import "E:\Projects\Personals\Shell\XP Theme\Advanced Theme Wrapper\Advanced Theme Wrapper\lib\bin\Release\Devcorp.Controls.VisualStyles.tlb" no_namespace
int dialogID = IDD_DIALOG1;
INT_PTR CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
IVisualStyleSwitchable* button = NULL;
HRESULT hr = E_FAIL;
switch(msg)
{
case WM_INITDIALOG:
hr
= CoCreateInstance(__uuidof(CustomButton),NULL,CLSCTX_INPROC_SERVER,__uuidof(IVisualStyleSwitchable),(void**)&button);
break;
case WM_DESTROY:
case WM_CLOSE:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, msg, wparam, lparam);
}
int main()
{
CoInitialize(NULL);
//InitCommonControls();
// put the button on the form
HINSTANCE hInstance = GetModuleHandle(NULL);
DialogBoxParam
(
hInstance,
MAKEINTRESOURCE(dialogID),
nullptr,
DialogProc,
0
);
//CoUninitialize();
return 0;
}
-
July 22nd, 2017, 05:48 AM
#2
Re: How do I put a COM-aware control onto a form (.rc file) or programatically?
Is the DevCorp.Controls namespace you are referencing from the 10 year old Code Project article? https://www.codeproject.com/articles...xtheme-wrapper
If so, it might be better to understand how that article is using theming and call that directly in your code rather than using the article's code as a COM component inside your code. The value add for that article is to be able to use theming (as of 2007) inside a C# application. As far as I can tell, you aren't coding in C# so using code that uses .Net to create a COM application to call within a C++ application doesn't seem to be the most direct way of getting the job done. In addition, the world evolves and although that code may have worked 10 years ago, it may no longer work now (.net versions change, OS's have tighter security, and so on).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|