|
When I draw text in DirectX using DrawText, capital W's at the left edge of the text have the upper left pixels mysteriously cropped off. Has anyone else encountered this, who knows of a fix? I'm at Wit's End.
Dave Goodman
dgoodman@infoway.com
www.dkgoodman.com
"Actio sequitur esse."
|
|
|
|
|
Is this with ID3DXFont or CD3DFont (or something based on it)? I've seen this problem with ID3DXFont; it seems that when it draws the text using certain fonts, the kerning bumps the W just out of the texture. Try inserting a space before the W maybe?
I'm using a custom derivative of CD3DFont that decouples the font texture from the renderer, and lets me fiddle with the U,V coords for the characters (and "bake in" stuff like drop shadows). It's not as convenient as ID3DXFont and doesn't support Unicode, but it's a lot more flexible for playing with
- Mike
|
|
|
|
|
This will probably be an easy question for most people, but I'm still somewhat new using the visual studios, and I haven't had much luck researching scrollbars. I am not trying to use a scrollbar to control my main dialog, which is what most articles refer to. I am trying to put a scroll bar in the middle of a dialog that will manipulate a separate control. Basically, I don't know how to wire up my scroll bar after I've added it to my dialog, and there isn't an easy way to add a message handler. If this is just a message map solution, could you please show me a small example with your answer? Thanks a ton!! ;)
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
Handle WM_VSCROLL or WM_HSCROLL, depending on which direction your scroll bar goes. The last parameter has a pointer to the scroll bar that is sending the message.
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"
|
|
|
|
|
Any tools out there for simplifying touch screen application development. Specifically, an onscreen keyboard which is "attached" to an existing CEdit control would be great. Otherwise, I'll have to roll my own.
Thanks!
|
|
|
|
|
Hi,
When you create a splitter window there are some bars between the views. You can use there bars to redimension the views. Is there a way to hide these bars? So that the views will appear as one single view...
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Derive your own class from CSplitterWnd, then override the OnDrawSplitter function. Look in winsplitt.cpp to see the original implementation.
|
|
|
|
|
Is there an equivalent to .Net's GetCurrentMethod for Visual C++ 6?
|
|
|
|
|
Not easily. C++ doesn't provide reflection type information in the way .NET and Java do, meaning that it is very difficult to determine what method you are in etc. unless you implement an appropriate framework yourself.
The other alternative is to build your application with symbols, and then use the stack walking functions to determine where you are - that's not a particularly nice way of doing it though.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Hiya I have a global variable in my lib called 'end'. I really need to have it there, otherwise I would just take it out. My problem is that I need to get the lenght of my file in bytes, so I use
ReadFile.Seek( 0,CFile::end );
MyFileSize = ReadFile.GetPosition();
But this is giving me a error of "constant: illegal token on right side of '::', because of my global variable named the same.
Is there another way to get the lenght of my file without using CFile::end in MFC??
Thanks.
|
|
|
|
|
|
|
Wouldn't the CRT function _filelength() be faster?
onwards and upwards...
|
|
|
|
|
There are two ways to do that:
1) If you have already opened the file use this:
CFileStatus status;
ReadFile.GetStatus(status);
LONG size = status.m_size;
2) more general way is this:
CFileStatus status;
CFile::GetStatus(_T("myfile.dat"),status);
LONG size = status.m_size;
|
|
|
|
|
I'm doing a get text on a drop down box into a CString. I then do a strcpy to a char array so that I can pass this info off to a LPSTR in a cobol DLL.
When I do a GetWindowText on this combo box and then do my strcpy I get an Assertion failed.
So how can I get this info and convert it to a LPSTR with out doing a strcpy. And How do I delete the char array when I'm finished with it?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The assertion generally means that the code has detected that you are calling it incorrectly. So:
1) Post the code that is causing the problem.
2) Where is the assertion occurring? Is it in the GetWindowText()? In the strcpy()? Or somewhere in your code?
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Okay. Here is some of my code.
CString CSRAgcy;<br />
char shold[4];<br />
<br />
m_CBAgencyList.GetWindowText(CSRAgcy);<br />
strcpy(shold, CSRAgcy);
It errors out when I do the strcpy. If I comment out that line my program works fine.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
What's probably happening is that your string is longer than 3 characters, and so the assertion is warning you that you are overwriting memory that you shouldn't.
You need to allocate enough memory to hold the entire string:
CString sTmp;
m_CBAgencyList.GetWindowText( sTmp );
char* pszAgency = new char[sTmp.GetLength()+1];
strcpy( pszAgency, sTmp );
// Do something with pszAgency
delete[] pszAgency;
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks dave that did it. Can you explain in english what the line:
char* pszAgency = new char[sTmp.GetLength()+1];
does? Is it redefining a char array?
Thanks
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The new operator allocates a block of memory, which is an array of chars, of length sTemp.GetLength()+1. The +1 is needed because in C/C++, strings are null-terminated, and the length of a string does not include the null-terminator.
char* pszAgency defines a pointer to a character, which in this case is the start of the block of memory we have just allocated.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Again thanks for the help. That explained it clearly.
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
wouldn't be a little more efficient to just send the CB_GETTEXT message, passing the LPSTR to be filled in directly, rather than creating a CString, having the framework do what I just said, and converting it to an LPSTR? Also, I think that the other message would be CB_GETTEXTLEN?
onwards and upwards...
|
|
|
|
|
It would be more efficient, but probably not worth the effort, here as it is to be used in a cobol DLL. Since the text is to be retrieved from a combo box, it is unlikely to be very long either, so the little execution time saved is probably not very relevant here.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
While using simple MAPI in VC++ , how should I be specifying the Mail server addresses ?
|
|
|
|
|
Either by host name or IP address. If you use host name and it doesn't work, it could indicate a DNS problem.
|
|
|
|