|
Is there anybody who can tell me how i can set the paper-orientation of the
printer. I have searched some different books or sites about the printing-subject but i haven't found anything about setting of the orientation.
J Vriend
e-mail: JVriend@ooms.nl
|
|
|
|
|
There you go... I have found it somewhere in CP but cannot remember where.. so apologies to the person who deserves credits!
<br />
void CYourApp::SetPrintOrientation(bool isLandscape)<br />
{<br />
if ( isLandscape )<br />
{<br />
PRINTDLG pd;<br />
pd.lStructSize = (DWORD)sizeof(PRINTDLG) ;<br />
BOOL bRet = GetPrinterDeviceDefaults(&pd) ;<br />
if (bRet)<br />
{<br />
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(m_hDevMode) ;<br />
pDevMode->dmOrientation = DMORIENT_LANDSCAPE ;<br />
::GlobalUnlock(m_hDevMode) ;<br />
}<br />
}<br />
else<br />
{<br />
PRINTDLG pd;<br />
pd.lStructSize = (DWORD)sizeof(PRINTDLG) ;<br />
BOOL bRet = GetPrinterDeviceDefaults(&pd) ;<br />
if (bRet)<br />
{<br />
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(m_hDevMode) ;<br />
pDevMode->dmOrientation = DMORIENT_PORTRAIT ;<br />
::GlobalUnlock(m_hDevMode) ;<br />
}<br />
}<br />
}<br />
And does someone know how tabs can be displayed properly in CP?
|
|
|
|
|
> And does someone know how tabs can be displayed properly in CP?
Try using <pre> rather than <code> to surround your code snippets .
--
Andrew.
|
|
|
|
|
I’m about to make a SAFEARRAY and pas it into a this function:
<br />
void IAcadSelectionSet::AddItems(const VARIANT& pSelSet)<br />
{<br />
static BYTE parms[] =<br />
VTS_VARIANT;<br />
InvokeHelper(0x7, DISPATCH_METHOD, VT_EMPTY, NULL, parms,<br />
&pSelSet);<br />
}<br />
At first I don’t really know why I know the pSelSet is a SAFEARRAY.
I know I have to do something like:
<br />
VARIANT var;<br />
VariantInit( &var );<br />
var.vt = VT_ARRAY;<br />
But when I do then do this call:
<br />
myIAcadSelectionSet.AddItems( var );<br />
it craches!!
Of course the array is empty but would the call crash cause of that?
I’m soon clear with the meaning of COM-calls but now I’m stucked.
_____________________________
...and justice for all
APe
|
|
|
|
|
This will generate a safe array of BSTRs. Hope the example helps.
VARIANT var;
int nSize = <enter size here>;
VariantInit(&var);
var.vt = VT_ARRAY | VT_BSTR;
SAFEARRAY* pSA;
SAFEARRAYBOUND bounds = {nSize, 0};
pSA = SafeArrayCreate(VT_BSTR, 1, &bounds);
BSTR* bstrArray;
SafeArrayAccessData(pSA, reinterpret_cast<void**>(&bstrArray));
for (int i = 0; i < nSize; i++)
{
bstrArray[i] = <enter data here>;
}
SafeArrayUnaccessData(pSA);
var.parray = pSA;
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Perfect!! And Really thanks!
Don't reply to this if you don't have time...
You made an array of BSTR.
Howto if I'd like to make an array of VT_VARIANT's containing BSTR's?
I'm starting to become a VARIANT-friend soon.
_____________________________
...and justice for all
APe
|
|
|
|
|
Why not have a play with the code and see what you can do?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Yeah. Right now I'm coding to death . No lunch here.
I hope I'll soon have something good...
_____________________________
...and justice for all
APe
|
|
|
|
|
I have a problem with using COM in my application. For example, I create a simple dialog-based application in VC6 and I want to use COM here. What header files and where do I have to add, may be something I have to change in project settings.
|
|
|
|
|
Just make sure you call CoInitialize[Ex] to create a COM apartment and CoUnInitialize to destroy it (before exiting your app).
It can do no harm to include comdef.h if you want to use some of the COM helper classes such as _variant_t.
Also, you might want to set the _WIN32_DCOM preprocessor directive which will include all the relevant COM headers.
Hope that helps...
|
|
|
|
|
Is there any Windows API to enable hibernation support?
I survey the "Power Management" part of MSDN,
and find that IsPwrHibernateAllowed() function can get
the status of hibernation support.
But I don't find fuction or other way to set the hibernation support
Jesa
|
|
|
|
|
Hi,
look at SetSystemPowerState function. This allows you either to set the system into Stand-by or hibernate states.
MSDN Says:
The SetSystemPowerState function suspends the system by shutting power down. Depending on the ForceFlag parameter, the function either suspends operation immediately or requests permission from all applications and device drivers before doing so.
...
The calling process must have the SE_SHUTDOWN_NAME privilege.
Hope that helps
|
|
|
|
|
hi ,
i use the following code which works fine in Debug mode.
AFX_MODULE_STATE *pstMngSt;
pstMngSt = AfxGetStaticModuleState();
AFX_MANAGE_STATE(pstMngSt);
AfxSetModuleState(pstMngSt);
m_hInstance = pstMngSt->m_hCurrentInstanceHandle;
But when i use the same in Release version, i get
error LNK2019: unresolved external symbol "public: __thiscall AFX_MAINTAIN_STATE2::~AFX_MAINTAIN_STATE2(void)" (??1AFX_MAINTAIN_STATE2@@QAE@XZ) referenced in function "public: void __thiscall CModeMGMT::DispatchDllMsg(struct HWND__ *,unsigned int,unsigned int,long)"
Any library file to be included ?? Pls help me..
Thx
Sugu
|
|
|
|
|
The easiest way to solve this problem is to compare the DEBUG settings with the RELEASE settings.
You will find that you have additional DEBUG libraries that are missing from the RELEASE settings. Add these to the RELEASE settings and all should be OK. I would advise you clean and rebuild the project (after you have made the changes).
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Is it quaranteed that operations to basic datatypes are atomic? Or can I safely do the following:
<br />
INT g_i;<br />
<br />
void main()<br />
{<br />
...<br />
...<br />
}<br />
<br />
DWORD WINAPI ThreadProc(LPVOID lpParameter)<br />
{<br />
...<br />
g_i++;
...<br />
}<br />
I started wondering this after noticed functions such as InterlockedIncrement in MSDN. Where are these functions used? I have always thought that individual increase statement as above are always atomic..
Cohen
|
|
|
|
|
that will most likely crash eventually, especially on a multi processor box
You should use InterlockedIncrement or a critical section
|
|
|
|
|
No. The assembly opperation is something like this: (on some silly machine that I just made up on the spot, but most CPU instruction sets are similear).
10: read memory location X into register
20: add 1 to register
30: store register into memory at location X
Notice there are 3 steps. Now remember that the Pentium 4 has something like 30 stages in the pipeline, I don't know exactly how they do this operation, but there could be 30 cycles between loading the memory and the store! Thats a lot of time for something else to happen.
One thing that could happen is at 20: your timeslice runs out and the OS switches the other thread in, which then manipulates X (particularly changing the value of X!) before your thread gets run again where you write your X, which had 1 added to it.
This is worse if your compiler is really smart, it might notice that you are manipulating g_i all over in that section of code, so the compiler loads g_i into a register, changes the value, but doesn't write it into memory right away, instead it uses the register. There are a lot of rules about when and how a compiler can do this, and most are not smart enough to make it s large problem, but unless you are locking g_i in your code the compiler has no way to know that you expect two threads to access it at the same time.
I suppose there might exist an architcure where there is an atomic incriment memory operation, but if so I have never seen it. That wouldn't surprize me, I've only done assembly on 4 platforms (only one that I compiled, the rest where simplified versions of a real machine for a homework but it was never compiled)
|
|
|
|
|
using regex++ is it possible to do search and replace just the case of the text?
For example if I had:
I was HeRe, BuT NOw i'm GONE!!!
could a regex convert it to...
i was here, but now i'm gone!!!
How owuld I accomplish this using regex???
TIA!!!
How do I print my voice mail?
|
|
|
|
|
i dont know but how about CString::MakeLower() or ctype::tolower from the stl
|
|
|
|
|
Has to be a regex
How do I print my voice mail?
|
|
|
|
|
I don't know regex++ library, but in Perl, you'd do it with a translation regular expression, like this:-
$var = "I was HeRe, BuT NOw i'm GONE!!!";
$var =~ tr/[A-Z]/[a-z]/;
=~ is the reg.exp. operator
tr means translation
[...] group character classes
A-Z is the character class for UPPER CASE
a-z is the character class for lower case.
Bob is therefore your mother's brother.
#include <beer.h>
|
|
|
|
|
|
Hi,
Wt r HotKeys and wt r Shortkeys ?
as i guess that start with Alt r short keys
and that start with Ctrl and Shift r Hotkeys
Is it ???
thanx
Regards.
|
|
|
|
|
Short cut keys are the "key" or "key combinations" that can be used instead of actual action e.g."Alt+F+P" prints a document in word; the acual action is clicking file menu and then selecting print option. (they are short cut to an action)
Hotkeys are related to what we see at screen (not in menus) a character within a text with an underline, pressing that character activates thet particular action. They are single character.
kriaz.
|
|
|
|
|
kriaz wrote:
."Alt+F+P" prints a document in word
i'm a quite "off topic" but the '+' caracter in such expressions means that the keys are pressed at the same time ; in the case of the print action in Word, the key combinations should be : "Alt, F, P ".
TOXCCT >>> GEII power
|
|
|
|