|
Dear All
Could anyone please let me know how to print jpeg/bmp images in vc++?
When i do so, i get the image in the top left corner of the page,very small size.
I use the mm_loenglish mapping mode.
Alternatively can i use cximage for printing?but how do i do?
Would be great if u cud help me..
Thankyou very much.
|
|
|
|
|
You're problem is probably related to the page size / dpi of the printer. Printers typically have very large pixel counts - 300 dpi or more. You need to use GetDeviceCaps to get the vertical and horizontal pixel counts of the printer and scale your image accordingly.
|
|
|
|
|
I tried printing, but perhaps am making some mistake..
Could u please give me an example of how to do?Should i use it in onprepareprinting?Wud b great if u cud help me.
Thankyou.
|
|
|
|
|
Hi,
I've made a key accelerator for my program (I did it by using the resource view), and I want to 'attach' it to my windows. How can I make sure that the accelerator table is associated with the window?
Thanks
|
|
|
|
|
If you're using MFC, and the window in question is a frame window (derived from CFrameWnd ), it already has support for accelerators. To make the frame window load the accelerator table at the same time as the menu and other resources, give it the same resource ID as the menu and use LoadFrame to create the frame window.
If you want an alternate set of accelerators, use LoadAccelTable .
For a non-CFrameWnd window, you'll need to call LoadAccelerators to load the table, and insert a call to TranslateAccelerator in an override of PreTranslateMessage , returning TRUE if TranslateAccelerator does.
I don't know enough WTL to offer a suggestion.
If you're using the raw Win32 API, insert a call to TranslateAccelerator before your call to TranslateMessage in your message loop.
|
|
|
|
|
Hi,
I need to build some kind of app which, display a picture and after 10 seconds the next, etc......
To do that, I'll need some kind of timer conrol (like the Timer in .NET), is there something like that in MFC. If there is (I thinks there is), can somebody tell me how to use it?
Thanks
|
|
|
|
|
There is a sleep function that you can use. I just use it as a puase between command, so if i think you want to use it for the same purpose it would be ok. Maybe you can display the first pic, then sleep, then remove the first pic and display the second pic?
Sleep(time)
btw, time is in milliseconds.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
Sleep is a blocking call. No Windows messages can be processed while your thread is blocked. This means that the rest of the user interface will be very unresponsive.
If you don't need the timer to be very accurate, use SetTimer to have Windows send you a message when a timer expires.
|
|
|
|
|
|
CreateWaitableTimer() and SetWaitableTimer() can also be used
"Committee--a group of men who individually can do nothing but as a group decide that nothing can be done." - Fred Allen
|
|
|
|
|
Thanks you everybody; after reading your hints, I finally succeeded in building this part of the app!
;)
|
|
|
|
|
Hi all,
I am having trouble coding this and wanted to know how to check if a user enters a filename to open. Basically I want to check to make sure the file name is not all spaces and that it is not blank. I am not using CFileDialog right now, just have a editbox and a browse button that i got from a CP article.
Does anyone have code out there that does this? Can someone lead me in the right direction?
Thanks for all your help .
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
You can get at the string in the edit box with
CString FileName;
MyEditCOntrol.GetWindowText(&FileName);
You can then perform all of the validation on FileName.
To verify the edit box wasn't blank:
if(!FileName.Getlength())
//handle error here - zero length filename
To verify that no illegal filename characters were entered:
CString InvalidFilenameChars = ""; // put all invalid filename chars in this string
if(FileName.FindOneOf(InvalidFilenameChars) != -1)
//handle error here - filename contains invalid character
There may be a pre-built MFC way of handling all of this.........
|
|
|
|
|
:(hello
I need the source code in c++, for information extraction from html tables , and to generate with those data a XML document.
Please help me
Marco Javier Suarez Baron
|
|
|
|
|
One way is to use the MSHTML control and iterate the HTML Elements. Have a look at the articles here on using the HTML control and on MSDN.
Another option is HTMLTree http://homepage.mac.com/pauljlucas/software/html_tree/[^] however this is GPL, which may be a problem for you.
And finally Google search: HTML parser.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
I am in need of a variable that can hold a type (variable-type ex: int or double) and not a value of the specific type, just the type. Something that works like this:
VARTYPE Type;
Type = int;
switch (Type) {
case short:
break;
case int:
break;
case float:
break;
case double:
break;
} I know I can simply declare a bunch of constant numbers, who each represents a variable type. But that would be very non-optimal if there already exists an easier way. Could I use templates to achieve this or the use of preprocessors/macros? Just to be clear, I am looking for a variable that only contains a type and not a value.
Any help or tips are most appreciated.
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
almost:
switch(sizeof(type))
{
case sizeof(short): //need pre-defined
break;
includeh10
|
|
|
|
|
|
|
|
|
|
Ian Darling wrote:
Of course, IIRC, typeid and type_info are platform dependant, so code isn't necessarily portable, right?
Not sure what you mean... Comparing type_info s generated on two different platforms probably won't work, if that's what you had in mind.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
CP SearchBar v2.0.2 released
|
|
|
|
|
Michael Dunn wrote:
Not sure what you mean... Comparing type_infos generated on two different platforms probably won't work, if that's what you had in mind.
Nope. Just that you couldn't rely on certain things about the type_info implementation always being the same across platforms, for example, what typeinfo::name() returns.
My reading of "Design and Evolution of C++" suggests that there is scope for differing definitions of the type_info class on different C++ platforms.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|