|
Does not make any difference on rendering quality and the quality is very poor. So, I am not using it in my code as of now.
Thanks.
|
|
|
|
|
It's not your code or my code causing poor quality...either way
should work.
Rendering some text in a 6400x4900 offscreen buffer then squishing it down to fit
a window is going to look bad.
The only way to make it look 100% correct is to make your bitmap the exact
size it will be rendered on the screen.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
oh! I got your point. I did not think about it earlier.
Thanks again.
|
|
|
|
|
The issues you may be seeing could be down to what raster operations are supported by the DC types in question.
If you had been saying it shows in preview and not on the printer I would definately have said this, but you have it reversed which makes me intrigued (and I have even come out of CP semi-retirment to answer )
The first thing I would say is drop BitBlt altogether. its not guaranteed to be compatible with both display DCs and printer DCs. Your best option would be to switch to StretchDIBits, from memory this is compatible with all DC types.
Another thing that could be causing you problems is that your creating a DC compatible with a preview DC, this means you will have all the world transforms which map from print to preview display probably active on your memory DC. Try creating your comapatible DC directtly from the screen by passing NULL instead of pDC. If that fixes the issues then I would say its down to the preview DC supporting all the world transforms and your in effect drawing of the edge of the comaptible bitmap.
If you vote me down, my score will only get lower
|
|
|
|
|
Roger Allen wrote: but you have it reversed which makes me intrigued (and I have even come out of CP semi-retirment to answer )
Special thx for that.
Roger Allen wrote: The first thing I would say is drop BitBlt altogether. its not guaranteed to be compatible with both display DCs and printer DCs. Your best option would be to switch to StretchDIBits, from memory this is compatible with all DC types.
yeah...as noted earlier, creating a DIB bitmap removes the problem with print preview but the application becomes very slow. Also, the image quality becomes very poor. You can see red, blue, green lines over the whole image.
Roger Allen wrote: Try creating your comapatible DC directtly from the screen by passing NULL instead of pDC. If that fixes the issues then I would say its down to the preview DC supporting all the world transforms and your in effect drawing of the edge of the comaptible bitmap.
No, I tried that earlier...creating a dc for monitor in print preview mode does not work.
Anyway, what I did last night is to check whether the DC is of type CPreviewDC. If it is, then I directly draw on that dc instead of creating a memory dc for it. otherwise I create a memory DC in case of print and normal view mode. It works correctly.
Also, I am thinking of creating a smaller fixed size bitmap on which to draw and then StretchBlt it on whatever the size of actual DC. This will save me from creating a bitmap every time inside OnDraw as well as painting on larger DC. As of now, the applicaion is taking large CPU power and I am trying to find out various tools for profiling that can help me find bad code.
Thanks for your suggestion.
|
|
|
|
|
Hi,
I need to lock then internet from a c++ program. the program would be a control internet manager who lock the internet access in especific time periods. Ex: 01:00 am to 06:00 am.
Some one knows what i need read or learn to create this kind of program ?
is there a program who do it, today ?
Samuel Nunes de Arruda
Brasil.
|
|
|
|
|
Interesting problem. One solution would be to block the use of the browser (note: developers can usually work around this). Another solution would be to block port 80 traffic. I've not done wither of these so I may be way off base.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
You want to lock the internet from 1am to 6am? But 6am in brasil is after I after I start work in the UK.
Frankly, it seems rather harsh to me... I hope you'll leave the keys with someone else when you go on holiday..!
Iain.
ps, As to a more serious answer, I'm really not sure. You could probably write something to turn off network access for that particular PC, but how would it know whether a network request was for a machine in Venezuela, or to Consuela in accounting?
It sounds like something for your firewall, rather than the local PC.
Iain (again).
|
|
|
|
|
SNArruda wrote: Some one knows what i need read or learn to create this kind of program ?
Well, as others Identified, this is a Firewall Issue. Your best way forward would be to study Firewall Technology. It has the ability to Pass or Block Network messages, depending on Origin and Contents.
Another solution is an ordinary Central Heating Timer, which interrupts the Telephone Line to the Computer for the barred period(s). Look at the POTS Spec for this. There are various ways to skin a cat, not all of these involve Software.
Bram van Kampen
|
|
|
|
|
Hi,
I am very confused to why this isn't working.
My starting window width size is 756
I got this result by declaring:
CRect Rect;
GetClientRect(&Rect);
Rect.Width();
I divide the 756 / 2 to plae the triangle in the centre of the
window. I have set up a message handler for the left and right
arrow key press, which moves the triagle by 10.
if the user resizes the the window, the window should
display in proportion, by the statement.
widthRatio = Rect.Width() / 756;
then * the x posistion by the widthRatio
I have tried declaring the variables 'float, double, and int
I can not seem to find a reason why this shouldn't work
the posistion remains the same if I expand, and snaps to the
left hand of the screen if the size has gone smaller
does anybody know whats going on
cheers Simon
|
|
|
|
|
simon alec smith wrote: I can not seem to find a reason why this shouldn't work
What doesn't work? What value does widthRatio contain? Since both the numerator and the denominator are integers, it will likely contain 0 . Try dividing my 756.0 instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thank you very much, I have tried 756.0 and it works
it would of taken me a hundred years to work that one out
cheers
|
|
|
|
|
Modified for the 2nd time... Looks like I missed the point with your question - dividing an integer with another integer, especially a larger one is going to give you BAD results. - Iain.
Where are you doing these calculations?
class CMyView : public CView
{
...
int m_nHorzOffset;
...
};
void CMyView::OnDraw(CDC* pDC)
{
CRect rc;
GetClientRect (&rc);
CPoint ptCentre = rc.CenterPoint ();
ptCentre.x = rc.Width () / 4;
pDC->MoveTo (ptCentre.x, rc.top);
pDC->LineTo (ptCentre.x, rc.bottom);
pDC->MoveTo (ptCentre.x + m_nHorzOffset - 100, ptCentre.y + 50);
pDC->LineTo (ptCentre.x + m_nHorzOffset + 100, ptCentre.y + 50);
pDC->LineTo (ptCentre.x + m_nHorzOffset, ptCentre.y - 100);
pDC->LineTo (ptCentre.x + m_nHorzOffset - 100, ptCentre.y + 50);
}
...
void CMyView::OnLeftABit ()
{
m_nHorzOffset -= 10;
Invalidate ();
}
I'm assuming you have the left arrow mapped via an accelerator to (eg) IDC_LEFTABIT, and have a command handler called OnLeftABit in your view class.
Hopefully that should work.
Iain.
Modified: Added centre line, some comments, and x=width/4 as an example.
modified on Thursday, September 18, 2008 12:07 PM
|
|
|
|
|
In addition to DavidCrow's reply...
simon alec smith wrote: widthRatio = Rect.Width() / 756;
then * the x posistion by the widthRatio
When working with integers like this, you can often rearrange the
calculation to avoid getting the 0. Do the multiply first, then the
divide. This way you can avoid floating point types which can give better
performance in certain situations.
Of course, if you need the ratio variable in other places, then you'll
need to make sure you do a floating point calculation as DavidCrow showed.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
I want to implement the shake hands of Windows Integrated Authentication for myself. Here is a reference link of the protocol and steps of shakehands.
http://en.wikipedia.org/wiki/NTLM
I have tried a prototype using WinInet API below, and find each time when using WinInet API InternetOpenUrl, this API will handle all underlying authentication shakehands for me. :wave:
http://TestMachine/Monitor is a web site setup by IIS with Windows Integrated Authentication, and the following invocation of InternetOpenUrl will automatically returns 200 OK and will use my current login user's credential automatically -- no change for me to parse return each time from IIS and do the shakehands by myself.
My question is, could I use WinInet level API like InternetOpenUrl to achieve my goal? Why?
My simple code.
#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include <wininet.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main()
{
HINTERNET hINet = InternetOpen(TEXT("InetURL/1.0"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
if ( !hINet )
{
return EXIT_FAILURE;
}
HINTERNET hFile = InternetOpenUrl( hINet, TEXT("http://TestMachine/Monitor"), NULL, 0, 0, 0 );
if(hFile)
{
CHAR buffer[1024]={0};
DWORD dwRead;
while ( InternetReadFile( hFile, buffer, 1023, &dwRead ) )
{
if ( dwRead == 0 )
break;
buffer[dwRead] = 0;
cout << buffer << endl;
}
InternetCloseHandle( hFile );
}
InternetCloseHandle(hINet);
return EXIT_SUCCESS;
}
thanks in advance,
George
|
|
|
|
|
Hi,
Is there a simple way to draw dashed lines with a width greater than 1 pixel on a DC?
CPen will not allow a PS_DASHED style with a width of more than 1.
TIA
|
|
|
|
|
LOGBRUSH lb;
lb.lbStyle = BS_SOLID;
lb.lbColor = RGB(0,0,0);
CPen newPen(PS_GEOMETRIC | PS_DASHED , 2, &lb);
For a dashed pen with a width of 2.
|
|
|
|
|
Cheers Cédric thats just what I was looking for!
|
|
|
|
|
I have a CSpinButtonCtrl as a resource in a dialog and I made a variable out of it using GetDlgItem. I compiled the code using WDK6000 on winXP and it compiled without any error.
But when i tried to compile it on win 98, using 95 DDK. I am getting an error :
CSpinButtonControl : undeclared identifier
I have a line in the code like this:
CSpinButtonCtrl *spinobj = (CSpinButtonCtrl *)GetDlgItem(IDC_SPN_COPY);
//IDC_SPN_COPY is the resource id.
I have declared the IDC_SPN_COPY in a header file i am using.
I tried adding #include<afxcmn.h>, but it again gave an error which is like :
cannot open afxcmn.h file.
somebody please help me out..
|
|
|
|
|
I tried adding #include<afxcmn.h>, but it again gave an error which is like :
cannot open afxcmn.h file.
|
|
|
|
|
it looks like the CSpinButtonCtrl came later than 95 DDK.
Google it out...
Update your life
Greetings from Germany
|
|
|
|
|
Man I have tried every possible way
|
|
|
|
|
Ehh, have I understood you correctly; you're building user mode applications with the Driver Kit?
I don't say it's impossible since I think it's the same compiler and linker, but I would consider the environment the wrong tool for the job.
Do you have an existing installation of some Visual Studio version?
Otherwise I doubt you even have the file you're trying to include on your disk.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
yes, i have visual studio 6 and SDK installed on the 98 system.
I am want a spin control on my printer driver UI.
I am getting the error :
CSpinButtonControl : undeclared identifier.
and I read in msdn that afxcmn.h header is for mfc common control.
so, i tried including the header, now it is giving this error.
fatal error C1083: Cannot open include file: 'afxcmn.h': No such file or directory
|
|
|
|
|
tenwang wrote: I read in msdn that afxcmn.h header is for mfc common control.
That's correct, but are you building with support for the MFC framework?
Do you include e.g. afxwin.h anywhere in your source code?
I'm not sure I can help you further, I've never built anything user mode related with any WDK/DDK.
Furthermore I'm not sure what you're trying to do; you're talking about a "printer driver UI", but a driver doesn't have a UI. You may mean a Control Panel application meant to control the driver settings and if that's the case you can check out the WDM sample "Sample Audio Control Panel Application" in the WDK help.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|