|
I've always thought that it's mostly the stuff that isn't also visible in the code, that makes compiler errors so hard to read, whereas the namespace symbols help separate the mangled symbols into managable bits that can be easier to understand.
Personally, when I look at unfamiliar code and try to locate a problem, seeing std:: or the like helps me exclude parts that I know I don't need to bother about. Similarly, when I try to understand what a particular piece of code does, I often start with the bits that call out 'STL' to me, because that is what I have the least trouble to grasp. In short, to me the namespace qualifiers within the code are more helpful than obstructive.
Of course, it might depend on the code you're looking at. If you're faced with types like
std::list<std::pair<MyClassA, MyClassB>, MyAllocator<std::pair<MyClassA, MyClassB> >::const_iterator
then you're in need of a typedef or two
|
|
|
|
|
i'll use it in a .cpp unless i'm feeling particularly masochistic that day and want to type "std::" a hundred times.
|
|
|
|
|
It's worth noting that it can be used in any scope, not just globally. For example, you could use it in a function like this:
void DoStuff()
{
using namespace std;
cout << "Yeah!" << endl;
}
You can also selectively "lift" something into a namespace with a using declaration:
void DoStufff()
{
using std::cout;
using std::endl;
cout << "Yeah!" << endl;
}
Steve
modified 1-Oct-11 2:46am.
|
|
|
|
|
Hey, thanks, I actually never thought of that!
Yes, I suppose if you have some dedicated IO functions it would be quite reasonable to add a using directive in there. Good idea!
|
|
|
|
|
There is a great article here:
Printing Class Library[^]
on how to print. I have read the article since 1999 and am hoping there are others out there
that use this class. There is this function:
pPage->PrintRotatedText(2.30,0.72,0.50,0.85,TEXT_NORMAL|TEXT_NOCLIP,9,"some text",90*10);
which will rotate the text 90 degrees. My problem is, the text is rotated and left justified
and I need it to be rotated and right justified. If I try changing the flags to TEXT_RIGHT
or TEXT_CENTER, the text still is left justified.
Any chance, any one knows how to rotate text and make it right justified. Im trying to rotate
these numbers and it looks silly having them left justified.
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
I haven't tested this, but a quick look through the source suggests that the line
m_PrtDesc.uTextFlags = flags;
is missing in the PrintRotatedText function.
If you vote me down, my score will only get lower
|
|
|
|
|
I just tried adding that code and recompiled and it still is left justified.
Any other ideas and I'll try them. Please any response any one can give me will
be greatly appreciated.
|
|
|
|
|
Good evening to all;
I have a small problem that I can not solve:
from a C program must call weka classes and accurately Apriori algorithm,
I use this syntax
system ("\" C: \ \ Program Files \ \ Weka-3-6 \ \ weka.jar \ "weka.associations.Apriori");
In this way I can just start the program and I have to do everything manually.
you tell me where the mistake?
Thank you all for the help.
|
|
|
|
|
salv03 wrote: In this way I can just start the program and I have to do everything manually.
As opposed to what?
salv03 wrote: you tell me where the mistake?
What's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
|
|
I have an application that is based on TabControl (CFormView), but for now, it appears as the dialog box that did, and I would like that it occupy the window into the framework.
How can I do it?
|
|
|
|
|
You'd call the SetWindowPos[^] member function.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Yes I know. This is the method that resize the tabControl
[code]
void CMyTabCtrl::SetRectangle()
{
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;
GetClientRect(&tabRect);
GetItemRect(0, &itemRect);
nX=itemRect.left;
nY=itemRect.bottom+1;
nXc=tabRect.right-itemRect.left-1;
nYc=tabRect.bottom-nY-1;
m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
for(int nCount=1; nCount < m_nNumberOfPages; nCount++){
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
}
}
[/code]
But I dont know how to get the size of the framework. What parameter I have to change?
|
|
|
|
|
What do you mean "the size of the framework"?
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
|
First, you're calling GetClientRect() in the wrong context. GetClientRect() gets "this" windows client rectangle, not the parents'. If you want to get the parents' client rectangle (the framework as you call it), in the context of the child, then call GetParent()->GetClientRect().
The way I would do what you're trying to do is the following:
1. Using the ClassWizard, add a WM_SIZE and WM_CREATE message handler to your View class, or
2. alternatively add ON_WM_SIZE() and ON_WM_CREATE() to your View class's message map and add the following overrides to your View class's header file:
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
4. add the following code (if you used the ClassWizard to add the WM_SIZE and WM_CREATE handlers, then cut and paste the code as appropriate).
void CMyTabExampleView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
m_myTabs.MoveWindow(0, 0, cx, cy);
}
int CMyTabExampleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rect;
GetClientRect(&rect);
m_myTabs.Create(0, rect, this, 9999);
m_myTabs.ShowWindow(SW_SHOW);
return 0;
}
Of course, the style and ID of the "m_myTabs" window needs to be what you need them to be. Adjust accordingly.
Hope this helps. Good luck. Call if you need more help.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
Hi
How to load ICON file in Dialog application client area in VC8.
|
|
|
|
|
Hi,
Just use the LoadImage function[^] and cast the return HANDLE into a HBITMAP. Then you would just BitBlt[^] the bitmap onto the dialog.
Best Wishes,
-David Delaune
|
|
|
|
|
Or insert a PictureControl and change the "Type" property of PictureControl to "Icon", then assign an ICON resource to "Image" property of PictureControl.
|
|
|
|
|
Use the ICON [^] resource control.
|
|
|
|
|
I read the characters from local file compressed by gzip, and want to uncompress the characters into another bytes buffer, not into local file.
How can I get it.
|
|
|
|
|
Perhaps with the zLib library?.
It is what gzip used in the first place, after all. With the added advantage of not needing to load the file first, and the additional bonus of being able to seek/read from a compressed file as though it were a standard non-compressed file. zLib gzip file access functions[^]
|
|
|
|
|
Using managed GZipStream[^] class. For unmanaged apps check CGzip[^] class found in codeproject.
|
|
|
|
|
Back to my MimeMap Question, but with more focus on the issue
If I get the value of the key that doesn't exist, comm return an empty array in the format I need, (I think so) which is empty. Maybe I can create a new safearray in the exact format, or just add my values to the existing array.
What do you think?
mimeMap | safearray of VARIANT = [0]()
VARIANT mimeMap;
VariantInit(&mimeMap);
hr = pADs->GetEx(CComBSTR("MimeMap"), &mimeMap);
|
|
|
|
|