|
This is a method in a CWnd derived class, I guess.
The call to GetDC() is getting the DC of the window, not the DC of the printer, so you need to use that HDC instead.
If you're using MFC Document/View, then a CDC* is passed into OnBeginPrinting(), and you can plug that in, in place of GetDC() in your code.
Incidentally, are you doing a corresponding call to ReleaseDC() somewhere?
Steve S
|
|
|
|
|
Yes, I use MFC document/view, and I use the CDC* passed into OnPrint(), GetDeviceCaps(pDC->GetSafeHdc(),LOGPIXELSY), but doesn't work.
|
|
|
|
|
OK, then in that case, when you say it's the wrong height, what exactly does that mean?
Here are some examples;
(a) the text is slightly smaller than the same text in Word
(b) The text is slightly larger than the same text in Word
(c) the text is way too small to read
(d) /* other option here! */
If (c), it's a mapping mode/device resolution issue.
If (a) or (b), then the definition of height is important.
Height = ascent+descent, with leading added between subsequent lines.
Steve S
|
|
|
|
|
for example in arial facefont
Word 12 points = 3mm height
My application 12 points = less than 1mm height
word 28 points = 7mm height
my application 28 points = 2mm height
I use MM_TEXT mapmode, so if you tell me
MulDiv(fh,72,GetDeviceCaps(pDC->GetSafeHdc(),LOGPIXELSY));
this function is the way to print the real height font, then I try found an error in my source code, I just want be sure about this function.
Thankyou!!
|
|
|
|
|
Ah. That explains it.
try
-MulDiv( fh, pDC->GetDeviceCaps(LOGPIXELSY), 72)
instead. I realised while I was driving home from the office that you have the params to MulDiv in the wrong order.
MulDiv(x,y,z) = (x*y)/z,
and font height in points is
(ht * dpi) / pts_per_inch
not
(ht * pts_per_inch) / dpi
Steve S
|
|
|
|
|
Can someone help me using function "IsDestinationReachable".
When I try to build my application, I got folowing error message:
OPFB error LNK2019: unresolved external symbol _IsDestinationReachableA@8 referenced in function "public: virtual int __thiscall MYPRGApp::InitInstance(void)" (?InitInstance@COPFBApp@@UAEHXZ)
If someone have some code examle how to use this function, please send me.
I include "Sensapi.h" and use library "Sensapi.lib".
Thank yoou !
|
|
|
|
|
u need have dll linked.
from help to find which dll file associated with the function.
includeh10
|
|
|
|
|
It's as simple as that. I don't know what else you've got in place that is causing this linker error. If I omit the Sensapi.lib, I get an LNK2001 error.
I was unable to find LNK2019. Is this a .NET project?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Can you show me how (few lines) including how to create some LPQOCINFO ?
This is my source part that generate this error.
if ( IsDestinationReachable("www.google.com", NULL) == TRUE)
AfxMessageBox("Google ok !");
|
|
|
|
|
QOCINFO oci;
oci.dwSize = sizeof(QOCINFO);
IsDestinationReachable("www.google.com", &oci);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Still doesn't working...thank you for your effort, but please help me one more time .. I'm gona crazy wit this...
This is part of my code. As you may see that I include Sensapi.h, and in properties of application I include library SensAPI.Lib (/IMPLIB:"SensAPI.Lib").
Do you have any earthly Idea what might be wrong with this ?
#include "stdafx.h"
#include "MYPRG.h"
#include "MYPRGDlg.h"
#include "Sensapi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
......
BOOL MYPRGApp::InitInstance()
{
...
QOCINFO oci;
oci.dwSize = sizeof(QOCINFO);
IsDestinationReachable("www.google.com", &oci);
....
|
|
|
|
|
So you have "sensapi.lib" in the Object/library modules: box on the Link tab of the Project Settings dialog?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
So where is the /IMPLIB operative being used?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Sorry...misunderstanding
From options you may see that /IMPLIB:"Sensapi.lib" is there.
/OUT:"Debug/MYPRG.exe" /INCREMENTAL /NOLOGO /DEBUG /PDB:"Debug/MYPRG.pdb" /SUBSYSTEM:WINDOWS
/IMPLIB:"Sensapi.lib" /MACHINE:IX86
I also try to include Sensapi.DLL file in this .cpp source, but still get same error.
Do you think that I have to configure, or setup, or.... I don't know what else should I and where to...
Should I put #include "Sensapi.h" directive on some particula place, should I include this library somwhere else except this (MYPROG Property Pages --> Configuration Properties --> Linker --> Advanced --> Import Library --> Sensapi.lib) ?
I try to find some source code (or project file) that use this function on Internet, but it wasn't successfully.
Do you have any other idea what might be wrong ?
|
|
|
|
|
/IMPLIB is for telling the linker to generate an import library with that name, based on the exports from your binary.
To use an import library, you include it in the list of files to link. In the Visual Studio .NET IDE, this is found under Configuration Properties > Linker > Input > Additional Dependencies.
If you've already been using /IMPLIB , your output directory will likely contain a file sensapi.lib , which could cause the linker to pick that file. If so, delete it.
|
|
|
|
|
Thank you !!!!!!!!!!!!!!!!!!!!!!!
It's working !!!
I can't believe it !!!!
Thank you !!!
|
|
|
|
|
Interesting thing is that, if I omit the Sensapi.lib, I get the same error as I get it with included library ?!
|
|
|
|
|
According to the documentation[^], the import library for IsDestinationReachable is sensapi.lib .
Have you perhaps changed configurations (e.g. from Debug to Release) and only included that library in the Link tab for one of them?
|
|
|
|
|
I want to change the internet option by my program, but I don't know which file the option is saved in. I didn't find it in registry file.
Does anyone have any good idea to solve this problem? I'll appreciate anyone know it reply my question.
|
|
|
|
|
Which option are you interested in changing?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I want to change the option in Secruit->ActiveX control and Plug-ins
|
|
|
|
|
First place to look would be in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\SO\ACTIVE_CONTENT. After that, you might need to employ Internet Explorer automation.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thank you so much. But I just wonder why I didn't find in the registry.
|
|
|
|
|
ray_li wrote:
But I just wonder why I didn't find ??? in the registry.
Why you didn't find what?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|