|
Is there a way to change the print page orientation to
landscape in a dialog mode, i e I'm not using Document-
View mode? To print I've previously used ShellExecute
method.
|
|
|
|
|
Look this code:
PRINTDLG pd;
pd.lStructSize=(DWORD)sizeof(PRINTDLG);
if(AfxGetApp()->GetPrinterDeviceDefaults(&pd))
{
DEVMODE FAR *lpDevMode=(DEVMODE FAR *)::GlobalLock(pd.hDevMode);
lpDevMode->dmOrientation = (short)(bLandscape) ? ORIENT_LANDSCAPE : DMORIENT_PORTRAIT);
pDC->ResetDC(lpDevMode);
::GlobalUnlock(pd.hDevMode);
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Thanks, but I get these five errors when compiling:
error C2065: 'bLandscape' : undeclared identifier
error C2065: 'ORIENT_LANDSCAPE' : undeclared identifier
error C2059: syntax error : ')'
error C2065: 'pDC' : undeclared identifier
error C2227: left of '->ResetDCA' must point to class/struct/union
Generating Code...
Error executing cl.exe.
It seems bLandscape does not exist. Where does that variable come from? I can also not find ORIENT_LANDSCAPE in MSDN.
|
|
|
|
|
I can't write a code for yours. Just it is a sample of the code and not realy code.
bLanscape is a variable which specified what you want orient. TRUE - LANSCAPE, FALSE - PORTRAIT.
DMORIENT_LANDSCAPE is constant for DEVMODE strucrure. Therefore, you must look in MSDN DEVMODE structure and not constants.
pDC is a pointer to your context of the printer.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Thanks for your reply Eugene!
However, I'm sorry I still dont get it. I'm not using Document-View mode in which I think I know how to retreive the Device Context (pDC). I'm using Dialog mode. How can you acheive this?
I also noticed you converted bLandscape to short. Why? Isn't it only the value that's assignmed dmOrientation that needs to be short?!
Finally, does this alter the settings of my default printer straight away without showing any dialog, or what happens?
Thanks again,
Joachim
|
|
|
|
|
Hi
i will like to know how can i reflect the colour i selected from an image and have it reflected in a dialog box. I am thinking of filling up an edit box of the dialog box with the selected color on the image. Not sure how it can be done or is there another way i can go abt doing it. Please help. Not too good with programming
thanks
|
|
|
|
|
I am using visual C++ 6.0 to develop interface.
I put a listview ActiveX control on the dialog , set the property "gridlines" with TRUE and it shows the feature like Access.But what i want is that there are gridlines only on where there are data items. in other words,if there are 2 items in the listview control,there are 2 rows of gridlines in the listview control.
How can i realize that?
BTW where can i find help document about ActiveX contorl?
gucy
|
|
|
|
|
long time ago,I download the tabbed exploer source in this codeproject.
but I've lost it in accident.
now I am trying to find it.but where is the source?
can you help me to find it?
feature:
it is based on MFC,MDI
it is embedding the webbrowser control.
all browsed site page is located in a new tab window .
all popup page is also located in a new tab window .
please help me!
please
|
|
|
|
|
please, hwo can i jump a page in wizard 97 when a radio Button Is clicked.
please Help
|
|
|
|
|
Hi there,
I'm a COM newby, and I'm trying to figure out this event sink thing. The typelib I am trying to use has a coclass in it with two interfaces. One is a dispinterface derived from IDispatch, it also exposes an outgoing interface/connection point thing (derived from IUnknown) which exposes two methods. Now according to the documentation these methods will get called at the apropriate time and the parameters to the call will contain the data I need. So how on earth do I go about hooking into that outgoing interface getting some event notification??
Does anyone know? Thanks in advance....
*¨¨`)
¸¸.·´ ¸.·*¨¨`)
(¸¸.·* ¸ .·*
¸¸.·*
(¸¸.~~> Joel Holdsworth.
|
|
|
|
|
You have to implement a sink object on the client side. Do a search at CodeProject, CodeGuru, and Google for examples.
Kuphryn
|
|
|
|
|
I have been going through the book Modern C++ Design. Obviously, since it is using generic programming alot of doesn't work on VC6, but I was curious about the following error when working with Object Factory example..
I have a class defined as "Shape" and a method defined as :
Shape * CreateConcreteShape();
Now, I have a class, called ShapeFactory as following:
class ShapeFactory
{
public:
static ShapeFactory * Instance();
protected:
typedef Shape * (*CreateShapeCallback) ();
// Returns true if registeration was successful
typedef std::map <int, createshapecallback=""> CallbackMap;
ShapeFactory();
ShapeFactory(const ShapeFactory & );
ShapeFactory& operator=(const ShapeFactory&);
bool RegisterShape (int ShapeId, CreateShapeCallback CreateFn);
bool UnregisterShape(int ShapeId);
Shape * CreateShape(int ShapeId);
CallbackMap callbacks_;
private:
static ShapeFactory * m_pInstance;
~ShapeFactory(); // the destructor should not be called from outside
};
Now, I have a class Line that inherits from Shape and it contains the following:
class Line : public Shape
{
public:
Line();
virtual ~Line();
virtual Shape * CreateLine();
virtual void Draw() const;
virtual void Rotate(double angle);
virtual void Zoom (double zoomFactor) ;
private:
static ShapeFactory TheFactory;
};
When I try adding the CreateLine method of the Line class to the ObjectFactory as shown below, I get the following compile-time error:
Line::Line()
{
ShapeFactory * pShapeFactory = ShapeFactory::Instance();
if(pShapeFactory != 0)
pShapeFactory->RegisterShape(1, CreateLine());
}
Error:
error C2664: 'RegisterShape' : cannot convert parameter 2 from 'class Shape *' to 'class Shape *(__cdecl *)(void)'
There is no context in which this conversion is possible
How do I fix this problem?
thanks
|
|
|
|
|
Hold on - the second parameter of RegisterShape(1, CreateLine()); is defined as "CreateShapeCallback CreateFn", not Shape* so what is happening is the compiler is unable to convert from a pointer to Shape class returned by CreatLine() to a pointer to the actual function itself. Squarepeg -> round hole. So if you really do want to insert a pointer to the function CreateLine then you will need to remove the brackets from CreateLine in pShapeFactory->RegisterShape(1, CreateLine());, so instead of executing the fn you can just take it's pointer.
*¨¨`)
¸¸.·´ ¸.·*¨¨`)
(¸¸.·* ¸ .·*
¸¸.·*
(¸¸.~~> Joel Holdsworth.
|
|
|
|
|
hi , i m searching for a class or a function that detect if an user is connected to the internet or not,
Please Help,
Thanks,
Bye
|
|
|
|
|
I have never used this but have a look at:
BOOL InternetGetConnectedState(
LPDWORD lpdwFlags,
DWORD dwReserved
);
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I know it's going to be simple, but can anyone please tell me how can I get current tab position or ID in a dialog box?
|
|
|
|
|
send TCM_GETCURSEL message to the control
int nIndex = static_cast<int>(::SendMessage(GetDlgItem(hMyDlg, ID_MYTABCTL), TCM_GETCURSEL, 0, 0));
|
|
|
|
|
If you're talking about the currently activated tab in a tab control, then the message above is correct.
If you want to find which control is active, then use GetFocus() .
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for your help, Alex and Ryan. Send TCM_GETCURSEL message is all I needed.
|
|
|
|
|
skinnyreptile wrote:
Thanks for your help
You're welcome
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I am trying to pass a vector to a function, but something is wrong.
I think I am declairing the prototype and function incorrectly
this is what I have
in my *.h file
int static parseData(vector<double> v);
in my *.cpp file
<br />
RFMAccess::someFunction(){<br />
<br />
\\do some stuff here and pass the vector<br />
parseData(data);<br />
}<br />
<br />
<br />
int RFMAccess::parseData(vector<double> v){<br />
<br />
\\do some stuff with the vector here<br />
<br />
return 0;<br />
}<br />
I actually need to pass the vector to another function in another class, but this is the idea I am trying to do.
I would pass-by-reference but, as mentioned the function is in another class.
thanks,
Steven
|
|
|
|
|
vector is not a type, it is a template.
|
|
|
|
|
I didn't realize that the code left off the <double>
The function looked more like
RFMAccess::parseData(vector<double> v)
does this look corret?
steven
|
|
|
|
|
I think you meant to do something like
RFMAccess::parseData(vector<int>& v)
|
|
|
|
|
or
RFMAccess::parseData(const vector<int>& v)
|
|
|
|