|
Hello there,
I have a CDHtmlDialog app in which am trying to add a CSS media query in the HTML file as shown below, but it doesn't work.
@media(max-width:20em) {
table, thead, tbody, tfoot, th, td, tr { display:block; }
tr + tr { margin-top:1em; }
}
The same CSS works fine if i open in a browser like IE, FireFox, Chrome. But inside the CDHtmlDialog app this doesn't work.
I am using Visual Studio 2012 for development and have IE 11 installed in my machine.
Any ideas?
THanks in advance.
|
|
|
|
|
I know I already addressed this in my answer to one of your previous questions[^], but let me repeat just to make sure since you did not say if that fixed your problem.
The version of IE used in CDHtmlDialog depends on your OS and what version of IE you have installed, but that does not mean it defaults to using IE11 compatibility even if you have IE11 installed.
Make sure your HTML file has <!DOCTYPE html> at the beginning and you might have to have <meta http-equiv="X-UA-Compatible" content="IE=edge"> in your document as well.
You might have to take to the registry to get the browser control to behave correctly. Check out this on SO[^], this on MSDN[^] and check your settings by connecting to this[^]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Did the trick for me!
Thanks SoMad!
|
|
|
|
|
Great!
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
HI, in a MFC program.
I use CDC* pDC = GetDC(); get a CDC pointer of screen.
but I need to create a new font, so I use:
HDC hdc = pDC->GetSateHdc();
my question is, after I done the function, I use:
Release(pDC), released the CDC object.
then do I need to release hdc handle? like Release(hdc)?
modified 21-Feb-14 15:43pm.
|
|
|
|
|
Nope, shouldn't have to do that. That should already be handled when you release the object.
|
|
|
|
|
I would like to dynamically create menu items attached to a submenu of a submenu.
I can get access to the first level of submenu using GetSubMenu, but cannot get to the second level probably because this function returns CTempMenu. Both submenus are pop-up, but I must be must be missing something else here.
Here is my test code snippet which asserts on pSubSubMenu
CMenu *pSubMenu,*pSubSubMenu;
int iCount = pMenu->GetMenuItemCount();
if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
pSubMenu = pMenu->GetSubMenu(2);
ASSERT(pSubMenu);
}
pSubSubMenu = pSubMenu->GetSubMenu(0);
ASSERT( pSubSubMenu);
Any suggestions will be as always appreciated.
Cheers
Vaclav
<pre lang="text">Can I get submenu of a submenu? ( MFC VC 6.0)
I woul like to dynamically create menu items attached to a submenu of a submenu.
I can get access to first level of submenu using GetSubMenu, but cannot get to the second level probably because this function returns CTempMenu. Both submenus are pop-up, but I must be must be missing something else here.
Here is the code snippet which asserts on pSubSubMenu
CMenu *pSubMenu,*pSubSubMenu;
int iCount = pMenu->GetMenuItemCount();
if (pMenu != NULL && pMenu->GetMenuItemCount() > 0)
{
pSubMenu = pMenu->GetSubMenu(2);
ASSERT(pSubMenu);
}
pSubSubMenu = pSubMenu->GetSubMenu(0);
ASSERT( pSubSubMenu);
Any suggestions will be as always appreciated.
Cheers
Vaclav
|
|
|
|
|
Hi,
To avoid the temporary handle and CTempMenu you can use CMenu::GetSafeHmenu[^] to get a permanent handle. You would then call CMenu::Attach[^] to attach to a CMenu object and then manipulate the menu.
Best Wishes,
-David Delaune
|
|
|
|
|
I think you can try use GetSubMenu() twice to get submenu of a submenu.
|
|
|
|
|
Thanks guys,
there is a minor "problem" with building / attaching permanent handle - it is already attached to window as m_hMenu data memeber of CMenu. I tryed to use it with same results - the second level always returns NULL. The strange part is that docs saiz if the popup submenu does not exist it will create it. But even than it returns NULL.
I would like to use that handle to get to next submenu, but I feel I need to look into what message(s) are being posted when the mouse goes over the menu items and try to process those instead.
I also forgot to say that I am using OnInitMenu in main frame which runs only once.
|
|
|
|
|
Here is what works, still not sure why I could not use m_hMenu similar way.
Basically a copy of MFC code.
HMENU hMenu = pSubMenu->GetSafeHmenu();
pSubSubMenu = pSubMenu->FromHandle(hMenu)->GetSubMenu(2);
ASSERT(pSubSubMenu);
Thanks for all the help I got, you guys are great!
Cheers Vaclav
|
|
|
|
|
1. Create a structure Fraction (numerator, denominator). Accept details of n fraction and write a menu driven program to perform the following operations. Write separate functions for different options. Use dynamic memory allocation.
i) Display the largest Fraction.
ii) Display the smallest Fraction.
iii) Sort Fraction.
iv) Display all.
Note: While accepting fractions, store the fractions in the reduced form.
|
|
|
|
|
Please do not post your homework assignments here; no one is going to write it for you.
|
|
|
|
|
Looks interesting. Good luck with your homework.
Veni, vidi, vici.
|
|
|
|
|
To get any kind of help, please post what are all things you've tried or where you stuck with code/logic.
|
|
|
|
|
A Dialog based MFC program, I want to display data on the dialog control.
Situation like:
a general C++ class D,
a dialog class ADlg :CDialog
{
D dObj;
showSth() { drawText(); }
}
now dObj.showResult() {
UINT32 result = XXXYYY;
if ( result == XXXYYYY )
showResultInDialog(result);
}
How can I transfer data to dialog object to display it?
|
|
|
|
|
|
|
It depends on what your control actually is (the one that you want to display some data on)... a dialog isn't a control, it's a window. A control would be, for example, an edit box.
|
|
|
|
|
I am writing code on an ARM920 platform, the demo program supplied by vendor is a dialog-based MFC program, running on Windows CE.
Now I need to add more functions to the program,but some functions are not related to the dialog, for example, serial communication module.
I think I can create a new class, like class SerialCom{ } ;
and instantiated it in Dlg class.
I also can just write some C style functions as global functions, and called them in Dlg.function.
I wonder which way has a better efficiency, in space and time.
|
|
|
|
|
Don't worry about performance: since you are using the serial port for communicating with the microcontroller then your application execution time is, in any case, dominated by the I/O operations.
In any case MFC , at this level (that is simple GUI stuff), is about as efficient as the raw C WINAPI code.
Veni, vidi, vici.
|
|
|
|
|
Hi,
v is an array;
in v[f(x)]+=j; will f(x) be evaluated once or twice (one for reading and one for writing)?
I guess once (at least due to optimization) but I'd like to know if C language ensures that it will be once and not twice.
Thanks
Tom
|
|
|
|
|
A good question, and one that yould be tricky to answer under different circumstances*. But for your purposes it's safe to answer that any of the compound assignment statements evaluate the adress of the modified value just once!
*: it would be tricky indeed if f() could modify v !
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I'm inclined to think that it took you longer to type your question than it would have to just compile that piece of code and find out.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I must write portable code (x86, ARM etc.....) and I was interested in understanding what C rules exactly say.
|
|
|
|