|
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
|
|
|
|
|
hi all,
I have file size in bytes, I am converting it in MB to display,
but or two decimal places its display round off value.
I don't want to round up the value and value should be displayed in two decimal places.
QWORD nSize=524285686;
static char szSize[16];
if (nSize < 1024)
{
sprintf(szSize, "%u Byte", nSize);
}
else
{
char szScales[] = "KMGTPEZY";
int nScale = 0;
for (; nScale < sizeof(szScales); ++nScale)
{
if (nSize < 1024 * 1024)
{
sprintf(szSize, "%6.2f %cB", nSize / 1024.0f, szScales[nScale]);
break;
}
nSize = (nSize + 512) / 1024;
}
if (nScale == sizeof(szScales))
{
strcpy(szSize, "Unknown Size");
}
}
return szSize;
//its return size=500.00MB
//but in real its = 499.99779319
thanks in advance.
modified 18-Sep-13 3:18am.
|
|
|
|
|
You are using integer arithmetic within the loop. Convert the original size to a double type at the beginning and use decimal arithmetic throughout.
Veni, vidi, abiit domum
|
|
|
|
|
now its display the value upto six decimal place,
I want to display value upto 2 decimal place without rounding off.
|
|
|
|
|
Then you need to print it to a memory buffer in full and then remove all the extra digits from the string before displaying it.
Veni, vidi, abiit domum
|
|
|
|
|
|
Try this code:
int size = 511998;
int di = (int)(size/10.24);
printf("%d.%02d", di/100,di%100);
(Fixed thanks to pasztorpisti)
Veni, vidi, vici.
modified 18-Sep-13 5:31am.
|
|
|
|
|
"%d.%d" -> "%d.%02d". If the fraction part is below 10 then %d gives wrong result, for example "1" instead of "01".
|
|
|
|
|
Fixed, thank you very much.
Veni, vidi, vici.
|
|
|
|
|
|
If you want to use integer arithmetic without floating point then do it this way:
unsigned __int64 size = 524285686;
const unsigned MEG = 1024*1024;
unsigned megs = (unsigned)(size / MEG);
unsigned fraction = (unsigned)((size % MEG) * 100u / MEG);
printf("%u.%02u\n", megs, fraction);
EDIT: changed from signed integers to unsigned integers
modified 18-Sep-13 6:15am.
|
|
|
|
|
Hello all,
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.
I want all the GUI elements to be developed in HTML with some JavaScript(JS) added. Now i want to trigger the controls in the HTML/JS using the C++ code that runs the DLL. And also i should be able to launch this DLL on another web browser and display the HTML/JS controls.
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.
Thanks in advance.
|
|
|
|
|
Don Guy wrote: Is this possible to do?
I suppose anything is possible, but what is your specific question?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Don Guy wrote: Please let me know of any examples that does similar things. Google is the place for such questions. Also it is not clear exactly what your problem is.
Veni, vidi, abiit domum
|
|
|
|
|
Ok let me be more specific here:
Is it possible to create a C++ DLL with WebBrowser embedded in it?
I am using Visual Studio 2012.
|
|
|
|
|
Yes, it's possible. Now, do you have an actual question?
Veni, vidi, abiit domum
|
|
|
|
|
How to do that? Any sample project to help?
|
|
|
|
|
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.
Veni, vidi, abiit domum
|
|
|
|
|
Lemme rephrase the question
Is it possible to add/embedd CDHtmlDialog inside a Win32 DLL?
|
|
|
|
|
How many times do you plan to repeat this question? Yes it's possible, but you are the one who is going to have to write the code to make it happen.
Veni, vidi, abiit domum
|
|
|
|
|
Don Guy wrote: I want to develop a DLL that has a web browser embedded in it. ...then load this
DLL into a web browser like IE, Chrome or Firefox.
So you have a web browser (doesn't matter whether you create it or not) and then run it in a web browser.
Why?
The question is similar to asking if one would want to run Chrome inside of Firefox.
Don Guy wrote: Is this possible to do?
It is possible to create a web browser in a dll. To create a functioning browser then one would simply use the dll in the exe and call probably one method.
That said a web browser is a user tool and a client side tool. I doubt there is any need to have a browser that one can embed and moreover it would likely irritate users because a non-trivial number of them are really attached to the browser they use.
Standard browsers can run executable content if the users allow that. The executable content can be anything, so it could certainly start a browser.
But excluding attempts to circumvent security and attempt to hack information from users I can't see any point to this.
|
|
|
|
|
I am unable to set focus to CProperyPage CEdit control using OnSetActive:
BOOL C_CommPropertyPage2::OnSetActive()
{
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);
pBoxOne->SetFocus();
return CPropertyPage::OnSetActive(); // added
}
I am able to TAB to the controls and I have tried both value and control without success.
Any help would be appreciated.
Cheers Vaclav
Here is a workaround.
I initially fill the edit boxes with default values. When I reset them, in my case to empty text, I can set focus using the above code. I can live with that.
-- modified 17-Sep-13 13:34pm.
|
|
|
|
|
Have you tried putting
return CPropertyPage::OnSetActive();
as the last line in the handler?
|
|
|
|