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.
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.
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.