|
Exactly, I just forgot the double quotes.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Can somebody tell me how I can convert centimeters into pixels?
e.g. I have given the value 25cm (centimeters, an european, or at least german unit of measurement ) and want to know the value in pixels.
I nee to draw some object very accurate onto the screen.
Any code is greatly appreciated
regards
|
|
|
|
|
I'm sorry to inform you that an answer will only be possible if every monitor in the world is the same size and runs the same resolution. You can find out the resolution from Windows, I know of no way to find out the size of the monitor with accuracy, let alone the fact that you can control from the front panel how much of the screen is used.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
You probably didn't unerstand my question
I.e I just found out that 100 pixel are equal to 3,571 centimeters.
Now I need to convert Pixels into Centimeters an vice versa.
How can I do this using c++?
|
|
|
|
|
What Chris was trying to make clear was that 100 pixels may equal 3.571 centimeters on your monitor, but on mine it could be 4.672 cm (just an example). How is c++ supposed to know the size of your monitor? And even if it knew it was a 17'' monitor, how is it supposed to know how big the screen's display area has been set to by means of the buttons on the front of the monitor?
There are som DC functions you can use to get an *estimate*. Set your mapping mode to one of the fixed-size ones (MM_TWIPS, MM_LOENGLISH, MM_HIENGLISH etc) an use the LPToDP and DPToLP functions. But there's no satisfaction guarantee!
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Use CDC::GetDeviceCaps(LOGPIXELSX) or CDC::GetDeviceCaps(LOGPIXELSY). These calls will return the number of logical pixels per inch. Having this, calculating centimeters into pixels should be easy - just remember that one inch is 2.54 centimeters.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks! I will try this.
Erm...I need to get the DeviceContext (DC) from my monitor fist, right?
How do I do this?
|
|
|
|
|
Not exactly. If you're using MFC, you'll have DC passed to OnDraw. If you're playing on Win32 API level, your DC will come out from BeginPaint.
However, you'll sometimes need to create your own display DC - for example, during processing of mouse messages. In such case, use GetDC(NULL) or CreateDC("DISPLAY", NULL, NULL, NULL). You can also use CreateIC instead of CreateDC when DC will be used only to retrieve the attributes, like LOGPIXELSX.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How I can import Flash animation in my Doc/View project?
Ivan Eryshov.
|
|
|
|
|
There is a Flash SDK on the web, and newsgroups for Flash developers. Look up David Mitchie in google and see what you find.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
How I can print unicode symbols using SetWindowText or ReplaceSel function?
Ivan Eryshov.
|
|
|
|
|
hi I've developed an application it seems to be somehow dependent on SHLWAPI.dll and i'm unable to locate why it is dependent on this can anyone help me out
|
|
|
|
|
Run Dependency Viewer on your EXE. The left-hand tree will show all the DLLs it links with. Click shlwapi.dll in the tree, and Depends will show you which functions you're calling in that DLL.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
|
(ex: code runs faster because it's in the same namespace? less memory used? etc...)
Nope, namespaces are just a way to localize class/object names, and are handled at compile time. Grouping stuff in namespaces has no impact on the binaries.
--Mike--
http://home.inreach.com/mdunn/
Ford: How would you react if I said that I'm not from Guildford after all, but from a small planet somewhere in the vicinity of Betelguese?
Arthur: I don't know. Why, do you think it's the sort of thing you're likely to say?
|
|
|
|
|
Hello. I have programmed several applications with MFC. For my next program, I would like to get text from a window in another program to use within my own program. I have looked at the window in spy++, but that really hasn't helped any. Can someone point me in the right direction? Thanks.
|
|
|
|
|
Have a look at WM_GETTEXT.
|
|
|
|
|
Hello, the codegurus around the world.;)
Currently, I'm working to check the version number of Windows XP.
On RC1, Windows XP's the major number is 5 as Windows 2000 does.
And, the minor version number of XP is 1, but that of Windows 2000 is 0.
Recently, my friend got Windows XP evaluation version at the computer show in Atlanta, GA, and its version number is 2002?
Does anybody get the true information of Windows XP version number?
Thank you in advance.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Windows XP = Windows NT 5.1
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
I have a CDisplay class (CWnd), and I want to programatically add a configurable menu to it, ie, no class wizard junk. Problem is, that I want to support 3-4 instances of this object in one app while maintaining system-wide resource ID integrity and the ability to relay UI msg's when the user clicks the menu. Any creative suggestions?
|
|
|
|
|
In a dialog based app. how can I detect WM_MOUSEMOVE on a CBitmapButton?
I´ve declared a CBitmapButton m_add and then WM_MOUSEMOVE (OnMouseMove) but the CBitmapButton just doesn´t detect when mouse is over it...
Here´s the code sample.
CBitmapButton m_add;
void CMyDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CRect rect;
m_add.GetWindowRect(rect);
if (rect.PtInRect(point))
{
AfxMessageBox("Add button");
}
/*
if(WindowFromPoint(point) == GetDlgItem(IDC_BASEADD))
{
AfxMessageBox("Add Button");
}
*/
CDialog::OnMouseMove(nFlags, point);
}
None of the above two methods works in a dialog based app. Can anybody help me out??? It would make my day sort of speak... Thanks!!!
Jesper S.
|
|
|
|
|
CYourDlg::OnMouseMove will be called only if there's no other control under the cursor. Otherwise, the control handles the message. You have two options:
1) derive a class from CBitmapButton and handle WM_MOUSEMOVE
2) handle PreTranslateMessage in CYourDlg. The mouse and keyboard messages go through message queue before they reach the handlers - this function is the place to intercept them.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I´ve thought of deriving a class from CBitmapButton but being pretty "green" I don´t know how to do it like I do with the other MFC classes!
Can you show me how to derive a class from CBitmapButton in MS VC++?
If so I would be very thankfull!
The second method has also come to my attention but again I lack the skills!
Sorry but I´m still learning from, you guys...
Jesper S.
|
|
|
|
|
Never mind I´ve solved the problem! Thanks.
Jesper S.
|
|
|
|
|
I am planning on creating a kind of file transfer client.
The thing is:
1)how is the CASyncSocket at transferring binary info (is there another alternative?)
(Will there arise any unforeseen problems with CASyncSocket?)
2)is CString an alternative AT ALL when considering storing the info received from the sockets. (How is it at storing BINARY INFO, that is)
Or should one use char buf[SIZE] or something?
I have only been thinking about this, not studying the CString or CASyncSocket classes in depth.
I thought that I should check it with someone here with experience on this.
-Oddis-
|
|
|
|