|
PointSize = lfHeight * 72 / GetDeviceCaps(hDC, LOGPIXELSYS);
Kuphryn
|
|
|
|
|
thx, could you give a reference where you have this information from + how does this work?
|
|
|
|
|
Here is the source on MSDN.
lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Solution:
PointSize = lfHeight * 72 / GetDeviceCaps(hDC, LOGPIXELSY);
Kuphryn
|
|
|
|
|
Thanks
|
|
|
|
|
Hello,
Do you have any idea how to create shadow run time? I would like to generate shadow thumbnails in my application.
Thanks,
H.S.Ngai
|
|
|
|
|
draw a black rectangle, blur it, draw the image on top of the blurred rectangle.
Image processing
|
|
|
|
|
Cut off your thumbnail and hold it under a light. Look underneath the thumbnail, and you'll see a shadow...
Sometimes, I have all the right answers...
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I'm building an application that will use a XML file as a document. The application will simply load the document and allow the user to edit it - adding nodes here and there. The editing will be done in custom controls, so I'm not looking for a generic XML editor...
My question is this: would it be wise to use the DOM as my document? That is, would my CDocument-derived class simply maintain and update an IXMLDOCDocument? Or would it be better to load the XML then convert to an internal format (converting on save as well)?
J
May the bear never have cause to eat you.
|
|
|
|
|
Use the DOM, much less work. Its generaly wise to only have a single model of your data, and the DOM is about the best way to represent an XML document. It would probably be good to have your controls directly editing nodes too.
Ryan
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
|
|
|
|
|
Ryan S Roberts wrote:
Use the DOM, much less work. Its generaly wise to only have a single model of your data, and the DOM is about the best way to represent an XML document. It would probably be good to have your controls directly editing nodes too.
This is what I figured. Thanks for the input!
Ryan S Roberts wrote:
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
Hmmmm... Where is this from?
J
May the bear never have cause to eat you.
|
|
|
|
|
I need to take an input string of something like "one thousand, 2 hundred and 54" and turn that into 1254 as an integer. I know how to write an algorithm to do this, but I am hoping someone can point me to one that already exists.
Ideally, it would be C++ and non-MFC.
Thanks,
Matt Gullett
|
|
|
|
|
If you know a solution, then implement it. Originality has its advantages including experience.
Kuphryn
|
|
|
|
|
Knowing how and having time are conflicting right now. Besides, I am not one for reinventing the wheel everytime a problem arises. I agree that originality has advantages, but when I have a low priority need I always look for existing code/tools/libraries before I invest my time into coding a solution. I would much rather use someone elses code (IF: it works, is clean, looks well written, has been used by others, works, is not someting that is critial to my system, works, etc).
I am afraid, that my question may have come off as a "school problem" type question, but I assure you, that is not the case. I just have a request for a feature which is low on the priority list and was interested in a "quick" solution.
|
|
|
|
|
There is an article on here that tackles the exact problem you need solving. I can't remember where it is, but if you dig deep enough you should find it
|
|
|
|
|
I appreciate the comment, but I have searched and looked around. I have found 2 articles which do the opposite of what I want (convert a number to a string like "1234" becomes "one thousand two hundred thirty four"), but none which do what I want which is to take "one thousand two hundred thirty four" and return 1234.
|
|
|
|
|
Here's a short and hopefully easy question...
One of our designers would like me to display some items in a list view right-justified, but have the title in the column header left justified. Does anyone know how to do this?
Any help would be greatly apprecaited...
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Take alook at the list control section here and micheal dunns custom draw section. You could probbaly make use of that to right justify the required text.
I even think there may be an example in his article to do it.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
I want to implement my own controls in the system tray.
How can i do it ?
How ca i do it if my control will be have lenght like 2-3 or more standart SystemTrayIcons ?
How can i replace standart tray tools - like clocks digits with my own controls ?
Thank you !
Live samples will be great !
|
|
|
|
|
How can i do it ?
Ans: Use Shell_NotifyIcon API.
A. Riazi
|
|
|
|
|
My submenus are dynamic.
I think I understand the concept of setting up an WM_MENUCOMMAND handler for the submenu of a toplevel menu which I will make suitable with SetMenuInfo (NOTIFYBYPOS). I want to notify by the index of the submenu item pressed. Fine. Now if I press on item 1 " SubMenu 1" , index 0, a flyout I'd created at the same time (CreatePopup)as I was creating "SUbMenu 1" dynamically , pops out . This has its own list of items.
I want stuff to happen when I press t hese flyout items. Now the toplevel submenu handle needed for SetMenuInfo I can get by GetSUbMenu(). Can I use my same trick for the flyout:
CMenu* submenu = mmenu->GetSubMenu(pos);
except now it will be
subsubmenu = submenu->GetSubMenu(pos) (after I get the right pos in the submenu?
I cant test it out because I'm beseiged with a zillion problems before I can get to this stage, and dont want to go through the effort if my supposition wont work....
Thanks,
Appreciate your help,
ns
|
|
|
|
|
MSDN says:
BOOL SetMenuInfo(
HMENU hmenu,
LPCMENUINFO lpcmi
);
Heres what I have done, and have #include winuser.h : My aim here is to press any one of the dynamic menu items that get created under the top level "mapdyn" and have it trigger the OnMenuCommand handler which sends in the index. I hope I have the correct menu handle etc (???), and am having trouble compiling :
CMenu* mmenu = ((CMainFrame*)AfxGetMainWnd())->GetMenu();
int pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(mmenu, "mapdyn");
if (pos == -1)
return;
CMenu* submenu = mmenu->GetSubMenu(pos);
HMENU m_hMenu = submenu->GetSafeHmenu();
LPCMENUINFO lpcmi;
lpcmi.dwStyle = MNS_NOTIFYBYPOS;
::SetMenuInfo(m_hMenu, lpcmi);
Compile error :
C:\BKView.cpp(176) : error C2065: 'LPCMENUINFO' : undeclared identifier
and the rest that follow....
Appreciate your help,
ns
|
|
|
|
|
When you set the MNS_NOTIFYBYPOS, can it be done for a submenu only, or only a subsubmenu? Or is it that the whole menu has to be that way?
Appreciate your help,
ns
|
|
|
|
|
As you can see in the documentation for MENUINFO and related stuff, this is only available in Windows 98 and later and Windows 2000 and later. VC++ 6.0 helps you avoid inadvertent use of APIs not present in baseline Windows 95 and NT 4.0 by not including anything incompatible with these. So, if you really want to use MENUINFO , inform the compiler about the target platform by inserting
#define WINVER 0x0500 before #include ing winuser.h . Please note that your program won't run in 95 or NT systems!
PS: if this doesn't work try inserting the #define in stdafx.h , right at the beginning.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I put it in stdafx.h:
But I do get:
NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http:
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information
=========================================================
And got rid of the #include for winuser.h
According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnw98bk/html/thewindowshheaderfile.asp I dont need to explicitly include it...
Now I'm getting:
HMENU m_hMenu = submenu->GetSafeHmenu();
LPCMENUINFO lpcmi;
<code>lpcmi->dwStyle = MNS_NOTIFYBYPOS;</code> line 195
SetMenuInfo(m_hMenu, lpcmi);
C:\BKView.cpp(195) : error C2166: l-value specifies const object
I must be doing something really dumb!!!
Actually, for some reason my machine MSDN doesnt have CMenu as h aving a SetMEnuINfo member, but the web mSDN does!!!!!!
SO I think I might just do
submenu->SetMenuInfo( lpcmi);</
and skip the HMENU stuff.
My local MSDN isnt that old!!!!
Appreciate your help,
ns
|
|
|
|
|
C:\BKView.cpp(195) : error C2166: l-value specifies const object The error says it all! You're defining a pointer to a const MENUINFO and trying to fill it: two errors here, the const -ness thing prevents you from changing the contents and you haven't allocated any space for lpcmi . What you surely will want to do is the following:
HMENU m_hMenu = submenu->GetSafeHmenu();
MENUINFO mi;
mi.cbSize=sizeof(MENUINFO);
mi.dwStyle = MNS_NOTIFYBYPOS;
SetMenuInfo(m_hMenu, &mi);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|