I have this method which creates a CDialog containing controls / info about DirectShow filter. I would like to access the dialog and use the controls to adjust the filter properties. I posted this in DiectShow forum and getting nowhere.
I have no clue how to do this.
Any help would be greatly appreciated. Cheers Vaclav
If you want to modify gui elements programmatically then it is a big hack that may or may not work on other machines. Even if we know how to do this magic we don't know what you want to do and we can't read your mind to find it out. It is possible to traverse the window/child control hierarchy and if you can identify certain controls then you can manipulate them. Often identifying the controls is possible by their/their parents' Z order and/or control ID. Depending on what you want to do different kind of hacks/functions may be necessary.
EDIT: as a first step you should write a function that prints out the full window hierarchy of your dialog along with some extra info with each child control window (like hwnd value, control id, classname). Use the GetWindow() function to traverse the window (tree) hierarchy. At the same time you should check the properties of the child controls you want to manipulate with Spy++. This way you can find the location of a control in the hierarchy and write the code that somehow programmatically retrieves the necessary HWNDs from the hierarchy for you. When you are done you will have to manipulate the gui controls by calling windows functions and sending messages to the HWND of the given control.
EDIT: Here is a piece of code that prints you the tree you can view with Spy++. This small piece of code contains a few function calls that can come handy when its about getting the HWND of a specified child control in the gui hierarchy:
Thanks, it's a start. BTW this is not "for hire" project and as long as it works for me I am happy. I am busy learning about COM because I feel the "interface array" may be used to accomplish this. But right now it is way over my head. Personally I am puzzled why MS published this method if it just for show, but there are other DirectShow applications pretty much same style - half-baked. But I like your Spy approach. Thanks Vaclav
You are welcome. I have no clue about directshow. If there is a nice "official" method to adjust settings (that I doubt if you couldn't get help on a specialized forum) then do it that way instead of hacking around with HWNDs. Sometimes however the hack is the only solution. If the program is not a production release (for example a temporary throw away helper tool, or an in-house tool) then its quite okay to go with hacky "working" solutions. In-house you can restrict directshow versions (like we restrict browser versions compatible with our in-house web-interfaces). If you want to release it to the wild to be used with a lot of windows/directshow versions then its more dangerous, you cant test your hack with all windows/directshow versions...
Been doing some research and found this interface IPropertyPageSite which may work. So far no luck finding a usage of it. There my be another way to do it but I would have to replace the modal dialog with modeles. There was KB article on that but it is gone. Thanks MS. Vaclav
If you want to use integer arithmetic without floating point then do it this way:
unsigned__int64 size = 524285686;
constunsigned MEG = 1024*1024;
unsigned megs = (unsigned)(size / MEG);
// If you want 3 digits in the fraction then change 100 to 1000 and change %02u to %03u in the format string.
unsigned fraction = (unsigned)((size % MEG) * 100u / MEG);
printf("%u.%02u\n", megs, fraction);
EDIT: changed from signed integers to unsigned integers
I want to develop a DLL that has a web browser embedded in it. In the past i have created MFC dialog app using CDHtmlDialog. With that experience what i want to achieve is create a DLL that has browser embedded in it, and then load this DLL into a web browser like IE, Chrome or Firefox.
Is this possible to do?
The reason why i want it this way is because the C++ code in the DLL will talk with another C++ DLL and take instructions on how and when to show the HTML/JS controls.
As i said earlier, i have worked with CDHtmlDialog in MFC Dialog app. But in this case i don't need any MFC controls. All i need is a Web Browser capability like the one CDHtmlDialog provided. And also this should be launchable from with in another web browser like IE or Chrome or Firefox.
Please let me know of any examples that does similar things.
Your question is too broad for a technical forum; we deal here with specific problems. For general "how to" questions you need to do the research and find the samples and articles that will help to build your project.