|
Accessing some Invalid index would be a quick guess. Did you try using the great DEBUGGER to know where and why the assertion is popping up...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
The line in the. pls advice,
What would be the cause
File: afxcmn.inl
Line: 449
AFXCMN_INLINE int CSliderCtrl::SetTipSide(int nLocation)
|
|
|
|
|
Why do you need the _endthread() call?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Have you looked at line 449 of afxcmn.inl ? That would be a big clue as to what condition is asserting.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I want to know how to set the window size in an sdi application to 770*550.After setting it to the desired size it does not have any scroll bars.Also where can I put the corresponding code.
please help,,
its urgent...
|
|
|
|
|
johnthecoder wrote: I want to know how to set the window size in an sdi application to 770*550.After setting it to the desired size it does not have any scroll bars.Also where can I put the corresponding code.
The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window.
The scroll bars won't be visible if the application fits to the window. you can check this behavior with IE
johnthecoder wrote: its urgent...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
It sounds like you may have a FormView application and your form is larger than the default window size. If that's the case, look in your view class at the OnInitialUpdate method. You can change
ResizeParentToFit(); to be
ResizeParentToFit(FALSE);
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
|
You can set the size in PreCreateWindow(..) of MainFrm.cpp of your SDI.
Loot at below.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
cs.cx=450;
cs.cy=600;
return TRUE;
}
|
|
|
|
|
Hi all,
can someone tell me how to create fonts or create a .ttf file for a new language on windows.
I need to know the mannual method of doing this and not to use some utility.
You can assume that I need to write an utility to create font.
modified on Thursday, August 21, 2008 6:17 AM
|
|
|
|
|
This isnt in first place a programmic topic. It is a question of the .tff file format. I think it ia a black& white raster bitmap where every charcater has its place.
Greetings from Germany
|
|
|
|
|
just FYI, TTFs are vector-based, not bitmap-based. that's how they can scale smoothly.
|
|
|
|
|
Greetings Kartenk.
I need that information to create an application. I need to display a character in my mother tongue. The character has a unicode value.
|
|
|
|
|
Hello everyone,
Today I have some free time to debug into string class itself. Here is the related sample code I debugged.
Two questions,
1. I have debugged that for small buffer (size <= 15), string will use buffer on stack, char array, and for larger buffer (>15), the space on heap is used (and destructor of string will free the space on heap), correct?
2. What is the function of the internal member variable _Bx._Buf and _Bx._Ptr? I have posted my debug results and why sometimes _Bx._Ptr is bad ptr and sometimes _Bx._Ptr has valid content.
I debugged under VS 2008.
#include <string>
using namespace std;
string foo()
{
string b;
b.append ("msdn");
b.append (".microsoft");
b.append (".com");
return b;
}
int main()
{
string s1 = foo();
return 0;
}
thanks in advance,
George
|
|
|
|
|
George_George wrote: 1. I have debugged that for small buffer (size <= 15), string will use buffer on stack, char array, and for larger buffer (>15), the space on heap is used (and destructor of string will free the space on heap), correct?
I guess only looking at the source of the string class will tell this certainty.
Personally, I'm not sure at all about this point, so i won't answer at the risk of saying a mistake.
[add] looking at the piece of code provided by CPallini, you seemed to be right here [/add]
George_George wrote: 2. What is the function of the internal member variable _Bx._Buf and _Bx._Ptr? I have posted my debug results and why sometimes _Bx._Ptr is bad ptr and sometimes _Bx._Ptr has valid content.
Again, looking at the source of the string class will ensure you about their use.
looking at the name of the attributes however, i'd say for sure that _Buf is the internal buffer of the string instance, the place which stores the characters you put within the string actually.
_Ptr may be invalid for some optimization reasons, but again here, i'm not sure at all, and stepping into the append() method code will tell you exactly how it's used and what for...
|
|
|
|
|
Thanks toxcct,
I come here to ask for some experience of guys who has debugged before.
Actually I have debugged into append, but the template functions, you know looks very confusing.
regards,
George
|
|
|
|
|
get used to it
|
|
|
|
|
Me too, now I am addicted to managed code.
regards,
George
|
|
|
|
|
George_George wrote: 1. I have debugged that for small buffer (size <= 15), string will use buffer on stack, char array, and for larger buffer (>15), the space on heap is used (and destructor of string will free the space on heap), correct?
I haven't checked that, but it appears a quite reasonable (and desiderable) behaviour.
George_George wrote: 2. What is the function of the internal member variable _Bx._Buf and _Bx._Ptr? I have posted my debug results and why sometimes _Bx._Ptr is bad ptr and sometimes _Bx.
Hint (STL source code):
union _Bxty
{
_Elem _Buf[_BUF_SIZE];
_Elem *_Ptr;
} _Bx;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks CPallini,
1.
So, your answer to my question 1 is _Buf is used to hold small sized content, and _Ptr is used to hold larger sizes content. Small sized content is on stack and larger sized content is on heap, correct?
2.
What is your answer to my original question item 2? I think because when the content is small, only _Buf is used and _Ptr is empty, so _Ptr is bad ptr? Correct understanding?
regards,
George
|
|
|
|
|
George_George wrote: 1.
So, your answer to my question 1 is _Buf is used to hold small sized content, and _Ptr is used to hold larger sizes content. Small sized content is on stack and larger sized content is on heap, correct?
Yes (and, as I stated that is a clever and desiderable behaviour).
George_George wrote: 2.
What is your answer to my original question item 2? I think because when the content is small, only _Buf is used and _Ptr is empty, so _Ptr is bad ptr? Correct understanding?
It is a bit more subtle: since _Buf & _Ptr share the same (at least sizeof(_Ptr) ) memory locations, because both of them belongs to a union , hence _Prt is a bad pointer when
(1) The context requires _Buf usage (i.e. short string).
(2) the initial characters of the string (for instance {_Buf[0], _Buf[1], _Buf[2], _Buf[3]} for ANSI strings), interpreted as a pointer, give an invalid address.
For instance the following code
union Foo
{
char a[4];
char *p;
};
void main()
{
Foo f;
f.a[0]='m';
f.a[1]='s';
f.a[2]='d';
f.a[3]='n';
}
(as side effect) assigns 0x6e64736d , i.e. an invalid address to f.p .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Cool, CPallini!
1.
In item 2, you mean when the content is big, the first 4 bytes of _Buf is actually the address of the heap (i.e. the value of _Ptr) where the content resides?
2.
In my original code, I return local variable b to main function variable s1, is it dangerous code?
3.
Another of my confusion is, when return b is called, we return the reference of variable b or create a new temp instance and making s1 in main references it?
regards,
George
|
|
|
|
|
George_George wrote: 1.
In item 2, you mean when the content is big, the first 4 bytes of _Buf is actually the address of the heap (i.e. the value of _Ptr) where the content resides?
Yes (union s my friend, union s).
George_George wrote: 2.
In my original code, I return local variable b to main function variable s1, is it dangerous code?
Nope, because:
George_George wrote: when return b is called it creates a new temp instance and making s1 in main references it .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks CPallini,
1.
So, in my original code, there are 3 instances,
- instance b and copied b to a new temp instance as the return value;
- instance s1 which is copy contructed from the temp instance.
Correct understanding?
2.
If I change the code in the following way, return the reference to local variable b, is it safe code?
#include <string>
using namespace std;
string& foo()
{
string b;
b.append ("msdn");
b.append (".microsoft");
b.append (".com");
return b;
}
int main()
{
string& s1 = foo();
return 0;
}
regards,
George
|
|
|
|
|
George_George wrote: 1.
So, in my original code, there are 3 instances,
- instance b and copied b to a new temp instance as the return value;
- instance s1 which is copy contructed from the temp instance.
Correct understanding?
Yes.
George_George wrote: 2.
If I change the code in the following way, return the reference to local variable b, is it safe code?
It's a mistake.
Change slightly the main function to see some output:
int main()
{
string& s1 = foo();
cout << s1 << endl;
return 0;
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|