|
If you want to be really accurate, you should call DeviceCapabilities() to open the device that you will be printing to. One of the parameters to OpenPrinter is a good old DEVMODE struct (lots of good info).
Also, you should look at the PHYSICALOFFSETX and
PHYSICALOFFSETY to determine the non-printable areas of the physical page (YOUR MIN MARGIN). On laser printers, this is usually 0.25 inches around.
|
|
|
|
|
In print/preview in your OnPrint() procedure which generates the output, the paper size can always be found in the CPrintInfo::m_rectDraw object. So you should be able to read this rect value and StretchBlt the pic to this size.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks Roger! It works!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hey guys,
Im only new to this and have got lots of help from other peoples posts before. Now its my turn.
How do you set the window to be maximized upon startup in visual C++?
I've looked everywhere but cant seem to find it!!!
thanx in advance
clubbyr8
|
|
|
|
|
What kind of project do you use ???
If it's a SDI application, go to the InitInstance() function from your application class (C*****App) and replace the line:
m_pMainWnd->ShowWindow(SW_SHOW);
by:
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
Hope this helps
|
|
|
|
|
sorry its an MFC application. Hope this helps out a lil more.
clubbyr8
|
|
|
|
|
Yes ok, but what kind of MFC application? When you create a new MFC project, you can choose the type of application you want to create: single document, multiple document or dialog based.
For a SDI (single doc) or MDI (multiple doc), you can do what I posted in the previous message.
Hope this helps!
|
|
|
|
|
clubbyr8 wrote:
sorry its an MFC application.
What do you mean? Cedric's solution was for MFC.
Lemme spell it for you:
You derive a class from CWinApp , don't you? Let's assume you call it MyApp . When you define the function InitInstance() within that class, you'll have to create a Frame object (typically, but not always instantiated from a class derived from CFrameWnd ) within that using a pointer, which I'll assume you call p . After that, include these lines:
m_pMainWnd=p;
p->ShowWindow(SW_SHOWMAXIMIZED);
return TRUE;
That should work. If it doesn't, something's seriously wrong.
Vikram.
-----------------------------
My site due for a massive update
Radioactive cats have 18 half-lives.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Thanx heaps guys, got it to work.
clubbyr8
|
|
|
|
|
clubbyr8 wrote:
got it to work.
Glad you could do it. I'll recommend a couple of books : "Programming Windows with MFC" by Jeff Prosise and "Programming MS VC++" by Wingo, Kruglinski and Shepherd.
And yeah, get MSDN!
Vikram.
-----------------------------
My site due for a massive update
Radioactive cats have 18 half-lives.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
clubbyr8 wrote:
How do you set the window to be maximized upon startup in visual C++?
Yes, I did see what Cedric told you. Thought I might add that if you're using the Win32 API (as opposed to MFC), you'll have to use WS_MAXIMIZED in the style parameter for CreateWindow() .
clubbyr8 wrote:
I've looked everywhere but cant seem to find it!!!
And another tip- get MSDN!
Vikram.
-----------------------------
My site due for a massive update
Radioactive cats have 18 half-lives.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Hi,
I've developed a COM object that uses DDE library functions. When I used that COM object in any VB application DDE calls are working fine. But, when I used that COM object in a web application, which is developed with ASP & IIS server, DDE calls are failing. Any suggestions please?
thanks
ramulu
|
|
|
|
|
Hi All,
What are the Pro's and Con's of using ActiveX control over OLE automation
in MFC application? I appreciate your help.
|
|
|
|
|
my view is derived from CView;
there are two rulers on the top and left.like ms word.
i want scroll the graphic view but rulers by call the funtion
ScrollWindow() to scroll window party.
the question is how can i deal with the area out of view?
fjn
|
|
|
|
|
I would like to have registration keys for my program that I am about to release. The thing is that from the suggestions that I have read online, I kind of get the feeling that I should not use GetWindowsText() or GetDlgItemText() because crackers set breakpoints on those functions. I should use low level routines. But I have no clue on how to do that. Could I get any suggestions? Any tutorials?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Add a CString variable that corresponds to the editbox of the registration key.
Kuphryn
|
|
|
|
|
That can still be captured by setting a breakpoint to GetWindowsText.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I do not think securing the process getting text from an editbox is going to matter in terms of program security. A secure project will require encryption based on, say, the NIC.
Kuphryn
|
|
|
|
|
kuphryn wrote:
do not think securing the process getting text from an editbox is going to matter in terms of program security
I am not sure about that. Setting a breakpoint on GetWindowsText will stop the program at the point where the entered key is being read. From there, the program can be single steped until this key is compared the real key. It is irrelevant whether the key has been encrypted or not because a simple jmp instruction can bypass the testing. The whole idea is to prevent someone from tracing the program after a registration key has been entered. I mean if they don't have a starting point they can't trace. Writing low level routines to read text is not something I came up with. I've read about it on several websites but nobody explains how to do it.
kuphryn wrote:
A secure project will require encryption based on, say, the NIC.
What do you mean by that? Could you suggest any websites where I can read more about that subject?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
You could avoid this approach by doing your registration check at the start of the application. Once the user enters the key, save it (registry/disk), force them to restart the app.
Then again, anybody with any lick of knowledge in SoftIce could easily break when a reference to that regkey or disk file is made.
Nothing is crackproof unfortunately, though there are a few really good third-party methods out there.
Mike.
|
|
|
|
|
Thank you everyone
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
iv looked here but all the examples are terribly complicated and require starnge stuff and what not. What i am looking for is a way to play a wave file with as little trouble as possible. any recommendations for tutorials or whatever would be very helpful. thanks
Have a nice day
|
|
|
|
|
try the sndPlaySound() API[^].
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
What is the fastest way to write formated text to a file. I am currently using "fprintf".
Just wondered if there is a faster way.
|
|
|
|
|
Depends on how you define "fast".
If you meant small code: use fopen fprintf and fclose.
If you meant fast writing: use Win32 file API or/and mapped files.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|