|
There's many ways to access databases from C++.
For info on data access technologies included with Windows, see here[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
is there any way to know if the user is calling the print command from the menu/toolbar or from the button "print" that appears in the preview?
I am interested in, because in one of my views, printing is limited to a certain number of elements. The user must choose 8 from (up to) 24 to be shown in the preview / printed in paper.
At the moment, it is needed to choose the elements both times, by preview start and by print start (before choosing the printer and number of copies).
But as the selection has already been made by selecting preview. I would like to send to the printer the same elements that are shown in the preview, so I need to know where the print command is being selected.
I have tried:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CParamRegView *pView = (CParamRegView *) pChild->GetActiveView();
if (pView->IsKindOf(RUNTIME_CLASS(CMyView)))
AfxMessageBox ("CFormView");
else
AfxMessageBox ("Another");
But I alway get the same message, so it does not separate
What should I use to do it?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
I have reach what i wanted using two variables that get a value when pInfo->m_bPreview true or not, and afterwards I ask the combination (similar to an XOR) to know if the last activevie was my secondary view or the print preview.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hello,
does std::vector have an index operator,
i mean can i read data from vector directly over an index
wthout search items in it!?
like this:
vector<CObject>VectorObjects;
VectorObjects.push_back(myCObject);
myNexCObject = VectorObjects[0];
thanks in advance
termal
|
|
|
|
|
Yes, std::vector override the [] operator, so you can safely do it.
Of course, if you try to access an index that is outside the bounds your vector, then'll get an exception.
|
|
|
|
|
Hello,
thanks for answer and help!
regards
termal
|
|
|
|
|
use vector::at.
Ex. myNexCObject = VectorObjects.at(0);
|
|
|
|
|
std::vector.at() does validate the vector boundaries.
The operator[] does not. It will happily access outside the vector. No problem when you know that, though.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hello,
thanks for input!!
regards
termal
|
|
|
|
|
You mentioned seaching also. If this is something you are looking for, then I suggest using the std::map class instead of a vector.
|
|
|
|
|
is there any problem specifying custom index in TlsSetValue other than the index returned by TlsAlloc ??
//
TlsSetValue ( 1 , (LPVOID)MyData ) ;
Tahnks & regards
|
|
|
|
|
nitin3 wrote: ...other than the index returned by TlsAlloc ??
Not according to the docs.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
As long at the index was allocated by using TlsAlloc( ), then there should be no problem.
---
Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug
|
|
|
|
|
Hi All,
In my from I want such type of function which copy directory from one path to other. The function should be as
CopyDir(SourcePath,DestinationPath);
Is there any API provided by MFC for doing the same.
Thanks in Advance
Atul
|
|
|
|
|
There is no direct function to copy directory.
But you can use FindFirstFile/FindNextFile to search files in directory.
Then use CopyFile function to copy files.
|
|
|
|
|
|
Hi
How to change associativity of operators in C++,
e.g.
if we have
int a = 15;
int b = 5;
int c = a---b;
then compiler interpret this expression as
int c = (a--) - b;
what I want, is like int c = a -(--b);
is there any way to achieve this.
Please suggest me.
Thanks & Regards
|
|
|
|
|
Use proper parenthesis in your code.
|
|
|
|
|
I don't think so.
Because the compiler doesn't know your minds. All automatic parsing is defined by rules.
Like mathematics, if you calculate 5+5*6 you should begin with 5*6 and then + 5
if you specifie it (5+5)*6 you start with adding 5+5 then the *6
It's the same in programmation.
|
|
|
|
|
Hi
thanks for your replies
Is there any prgma option to do this
please suggest me
Thans & regards
|
|
|
|
|
rajeevktripathi wrote: Is there any prgma option to do this
I didn't found any.
|
|
|
|
|
NishantB++ wrote: I didn't found any.
of course you didn't, 'cause there aren't any !
this feature is a fundamental of the language itself !!!
|
|
|
|
|
rajeevktripathi wrote: Is there any prgma option to do this
No. There is no need for that.
You write the parenthesis in your code where you need them.
When in doubt, add a pair of parenthesis. Extra pairs of parenthesis won't do any harm.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: Extra pairs of parenthesis won't do any harm
no need. one pair is largely sufficient, because it can be countered with simple spaces...
|
|
|
|
|
rajeevktripathi wrote: How to change associativity of operators in C++,
changing associativity is like changing the meaning of things (so, changing the language itself), so, no way at all.
moreover, if associativity exists like it is, there are reasons over the problem you can have with it.
rajeevktripathi wrote: then compiler interpret this expression as
int c = (a--) - b;
what I want, is like int c = a -(--b);
then, why don't you just use spaces (or at least, parenthises like someone said) ?
write c = a - --b; and everything will be good.
|
|
|
|