|
Anonymous wrote:
How does one go about fixing it?
By changing the code into proper C++
Anonymous wrote:
Also, its interesting that I got it built easily in VS.NET but it was so much of a problem with VS.NET 2003.
Yeah, VS.NET had a new STL and some improvements, but I'm pretty sure it was 2003 that had the quantum leap.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Eh, tough audience. I guess I am looking for a list of the top areas where VC6 forced you to use non standard template code. Maybe that is too much to ask for, but I'm guessing there are commonly known issues with templates with VC6 that would give me a big head start in terms of converting. I am not a template master and anything that can help would be appreciated.
|
|
|
|
|
Here's an example:
Here's an example:
template <class T> class VertexLock<br />
{<br />
public:<br />
<br />
VertexLock( T* obj, T::LockType lock ) :<br />
m_obj(obj)<br />
{<br />
obj->lockVertices( lock );<br />
}<br />
<br />
<br />
~VertexLock()<br />
{<br />
m_obj->unlockVertices();<br />
}<br />
<br />
private:<br />
T* m_obj;
<br />
VertexLock();<br />
VertexLock( const VertexLock& );<br />
VertexLock& operator=( const VertexLock& );<br />
};
warning C4346: 'T::LockType' : dependent name is not a type
prefix with 'typename' to indicate a type
|
|
|
|
|
<small><b>Anonymous wrote:</b></small>
<i>warning C4346: 'T::LockType' : dependent name is not a type
prefix with 'typename' to indicate a type</i>
This is just a warning, it will still compile, and it's telling you the solution as well. You should check the "Do not treat <'s as HTML tags' box below the post if you want to post template code.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Sorry, there was actually an error message associated with that code, it was the following referring to the first line of the template:
error C2226: syntax error : unexpected type 'T'
error C2334: unexpected token(s) preceding ':'; skipping apparent function body
|
|
|
|
|
Anonymous wrote:
Eh, tough audience
LOL - you get extra credit for having a sense of humour
Anonymous wrote:
I guess I am looking for a list of the top areas where VC6 forced you to use non standard template code.
I don't know of any where it FORCED you, only that it ALLOWED you at times. the only case I know of is the only one that got me when I upgraded, and that only once. I used an iterator as a pointer to the item instead of converting it to be one. But then, I've always been fastidious about C++ syntax.
Anonymous wrote:
I am not a template master and anything that can help would be appreciated.
I'd be happy to help, perhaps if you post some code that is breaking ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
No problem, I know I should probably RTFM but templates is a big subject. I think once i get rolling I'll probably start to pick up the things that are making this break.
Thanks
|
|
|
|
|
I had the same problems as you describe and ended up going back to VC6 because the effort to fix all the compiler errors was not worth it.
John
|
|
|
|
|
BOOL CDC::GetCharWidth( UINT nFirstChar, UINT nLastChar, LPINT lpBuffer ) const;
I found this function a little hard to understand, as stated by MSDN, this function takes 2 UINT's as the 1st and 2nd chars in a consecutive group of characters, the 3rd parameter is an array of int's which is retrieving char widths. This leads to my confusion, in practical, we often want to determine the width of a particular char or string, not something like 'A' to 'Z' or 'a' to 'z'. For example, if I want to know width of string "Hello Code project!" then what should I do? This string has length of 19, do I need to call GetCharWidth 19 times each time pass in something like "'H' to 'H'", "'e' to 'e'", "'l' to 'l'" and so forth?
I mean, why wasn't this function like this: int CDC::GetChatWidth(TCHAR ch) const or int CDC::GetCharWidth(LPCTSTR lpString) const , simply take a char or string and return its width? Sorry if this sounds like a stupid question, but I'm really confused.
|
|
|
|
|
=[ Abin ]= wrote:
int CDC::GetChatWidth(TCHAR ch) const
You can get this by passing in just the char you want, surely ? A helper function to do what you want would be easy to write, just write a CDCFacade class.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
There are some very good applications for GetCharWidth(), determining the display width of string is not one of them. Let's just say it is far more complicated than you want to know at this point in time.
If you need to know the display width and height of a string, use one of the text extent functions: GetTextExtent(), GetTabbedTextExtent(), etc...
Internaly the text extent functions may be calling GetCharWidth() to help in determining the size of the final bitmap image.
I have used GetCharWidth() in the past in order to create DOS style binary font bitmaps for Windows fonts (TT, etc...). That is only one of 2 situation that I found where this function is useful. Of cource if you could figure out what mathimatical algorythms are used to determine charater placement strings in Windows, then by all means write an acticle and let the rest of us know.
If you tried to use GetCharWidth() to determine the displayed legnth of a string, I'm here to tell you that it is not possible unless the font used is not variable spaced. If you dig into the subject you will find that you have to deal with thing like overhang, underhang, spacing between characters, and a whole host of other variables (depending on font type).
The short of it is that GetCharWidth() is only useful in a few specelized situation.
INTP
|
|
|
|
|
Thank you for the detailed explanation.
|
|
|
|
|
How can I prevent my app from being closed (Other than from the task manager)?
What messages can I trap to prevent it from closing?
|
|
|
|
|
OnClose ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I shouldve said it was an SDI app. On close wont work there will it?
|
|
|
|
|
Why not ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system.
Here is what I am working with.
void move(char c)
{
}
void getFloor(void)
{
DWORD32 timeout;
short c;
for(;;)
{
BYTE8 floor;
SetCursorPosition(8,10);
while(!ScanCodeRdy())
MtCYield();
floor=GetScanCode();
if ( !(floor & 0x80) )
{
c=ScanCode2Ascii(floor);
PutString(" Floor ");
PutChar(c);
}
}
}
|
|
|
|
|
Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
90% of the what is true in C++ is also true in C, minus class support. In other words, the conversion is implicit in C too. Take away class support and the ability to add member functions to structures and what you have is C with much better syntax checking.
INTP
|
|
|
|
|
what elevator company do u work for?
*makes a note not to ride in those elevatots*
"there is no spoon" biz stuff about me
|
|
|
|
|
After a lot of hard work and a lot of messing around i finally finished my Layered Service Provider. So i went to test it on another machine running Win98 (i'm running XP). But WHOA arghhhh its not working right!!! It just wont install the Service provider! I read everywhere on the web that LSP's work on win98 too as long as you have Winsock 2 installed. And that machine did! But sceptic as we are, we install the Winsock2 update again, wham error: something about an unsupported operating system version. But its Win98! So i tried it on ANOTHER win98 machine, same error. ???? I'm really confused. Can anyone tell me how to get an LSP to work on Win98??
Kuniva
--------------------------------------------
|
|
|
|
|
Hi. What I want to do is create an application (Doc/View app) that does this:
1) places a widget on the (Doc/View) drawing area
2) allows the user to drag the widget to another area on screen
3) when widget is double-clicked, a new "window" opens - could be a dialog, or another View window.
4) point-click to connect widgets with a line
I did a quick search in CodeProject and found the DDRmgr example,
Drag-Drop Manager for CObjects by Wes Rogers (http://www.codeproject.com/clipboard/ddmgr.asp?target=drag%7C%2Bdrop)
but want more/another example.
Can anyone help with this?
Thanks,
Johnny
|
|
|
|
|
I have a crude example (in Flash 6, 4.5kb) if want to see more details.
-- regards, Johnny
|
|
|
|
|
OK...here is my problem...
I have an mdi aplication vith a toolbar. The toolbar has 3 buttons. any of this 3 buttons open a different view window.
button 1 -> view hith a combobox
button 2 -> view with a editbow
button 3 -> view with a list control.
so far so good. My problem is that i must "erase" the close minimize and maximize buttons form the title bar and I don't know where to do it. I tried in CMDIChildFrm :: OnPreCreateWindow to modify the cs but I managed to do that only for my first window that I open. When I open the other 2 buttons they still have the max, min and close buttons.
Question is Where and how I must define the style for all 3 view windows so that when I create them they will be created without the min, max & close buttons.
sorry for my bad english
|
|
|
|
|
Good English, very good infact!
Set a pointer to the window (the button) GEtSafewh...
The show or hide them at will.
Best Wishes,
ez_way
|
|
|
|