|
You already had an answer to displaying an arabic char - assuming you have the fonts etc etc.
But I can't let the line
str.Format(_T("%s %c"),str,i);
be without jumping on it.
You are trying to put the contents of str into str? At best this will crash, at worst it will do very strange things...
If you are trying to add new characters to the end of your string, why not just do that? Or just build up a string yourself - it;s a fixed length.
A/
CString str;
for (wchar_t i = 1500; i < 1800; i++)
str += i;
B/
wchar_t buf [301];
for (wchar_t i = 0; i < 300; i++)
buf [i] = i + 1500;
buf [i] = 0;
The choice is yours.
Iain.
|
|
|
|
|
I have a dialog based application . It Executes a third party application and displays that application inside that Window. Now i want that third party application to be non-movable inside parent window . . What i am looking specifically is to disable mouse drag messages only on the child window (3rd party application).
S.K
|
|
|
|
|
Do you mean that this child window has a caption bar and you want to prevent it being dragged in this manner, or is it dragged by it's client area and you want to prevent this?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi!
I've to declare a function which is already defined in another class. I don't want to inherit from the existing class. The function is under a namespace in the first file. When I declare the function in the new class, I got the following errors:
d:\aicharactercontrol\testai.h(84) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\aicharactercontrol\testai.h(84) : error C2143: syntax error : missing ',' before '*'
I've declared the function in the public section only. How do I declare the function in the second class?
|
|
|
|
|
Given your company's policies it is quite difficult to help you. Please post an equivalent code snippet.
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]
|
|
|
|
|
I've to declare a function which is already defined in another class. I don't want to inherit from the existing class. The function is under a namespace in the first file. When I declare the function in the new class, I got the following errors:
d:\character\test.h(84) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\character\test.h(84) : error C2143: syntax error : missing ',' before '*'
I've declared the function in the public section only. How do I declare the function in the second class?
|
|
|
|
|
He didn't ask you to repeat your question - he asked you for some actual CODE.
If you can't post the actual code, try recreating the problem with similar code - this is probably a good idea anyway. I'm guessing your code is more than 10 lines long anyway. And by recreating the problem, you may even see your own soloution.
If you only post the error message, it is very unlikely anyone can or will help you.
Iain.
|
|
|
|
|
The function I want to declare is inside a namespace. It's coded like this:
namespace dtAI
{
void AICharacter::GoToWaypoint(float dt, const Waypoint* pWaypoint)
{
mCharacter->RotateToPoint(pWaypoint->GetPosition(), dt * 3.0f);
mCharacter->SetSpeed(-float(mSpeed));
if(!mCharacter->IsAnimationPlaying("Run"))
{
mCharacter->ClearAllAnimations(0.5f);
mCharacter->PlayAnimation("Run");
}
}
}
This function is declared in the header file under public section as below :
void GoToWaypoint(float dt, const Waypoint* pWaypoint);
I've to declare the function in some other header file. I can comment the function in the first file. When I declare the function in the second file, I got the above mentioned errors. What to do?
|
|
|
|
|
OK, I'm not much clearer, as you haven't show all the places.
But to expand on Alan Balkany's answer to you, I've done a similar solution to the one he proposes (though I didn't know it had a name).
namespace Iain
{
class CIain
{
virtual BOOL DoSomethingExciting (char a, int b, void *p) = 0;
}
CIain *GetAnIainInterface ();
};
Now we have a pure virtual class and interface. Let's try and use it!
#include "Iain.h"
...
CIain *pIain = Iain::GetAnIainInterface ();
ASSERT(pIain);
pIain->DoSomethingExciting ('a', 97, NULL);
...
So far so good - but we need to actually implement it somewhere!
#include "Iain.h"
class CIainImpl : public Iain::CIain
{
....
virtual BOOL DoSomethingExciting (char a, int b, void *p)
{
return TRUE;
}
};
CIainImpl m_Iain;
Iain::GetAnIainInterface ()
{
return &m_Iain;
}
I hope that helps a little as an example!
Iain.
|
|
|
|
|
See here [^] (Iain expresses what I think even better than I'm able to ).
Probably the errors occurred have nothing to do with you requirement to include in a new class a method having the same name of some other class's method. This is the reason we're asking for the code. For sure we have no intention at all to copy 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]
|
|
|
|
|
Sorry Gentlemen! I told my company's policies only. I never think anybody will copy my code. I feel really sorry if I hurt anybody.
|
|
|
|
|
Don't worry. Just kidding. Anyway if you can post a simple sample code emulating your troubled one...
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]
|
|
|
|
|
Here it is:
The function I want to declare is inside a namespace. It's coded like this:
namespace dtAI
{
void AICharacter::GoToWaypoint(float dt, const Waypoint* pWaypoint)
{
mCharacter->RotateToPoint(pWaypoint->GetPosition(), dt * 3.0f);
mCharacter->SetSpeed(-float(mSpeed));
if(!mCharacter->IsAnimationPlaying("Run"))
{
mCharacter->ClearAllAnimations(0.5f);
mCharacter->PlayAnimation("Run");
}
}
osg::Vec3 AICharacter::GetPosition() const
{
osg::Matrix mat = mCharacter->GetMatrixNode()->getMatrix();
osg::Vec3 pos(mat(3, 0), mat(3, 1), mat(3, 2));
return pos;
}
}
This function is declared in the header file under public section as below :
void GoToWaypoint(float dt, const Waypoint* pWaypoint);
I've to declare the function in some other header file. I can comment the function in the first file. When I declare the function in the second file, I got the above mentioned errors. What to do?
|
|
|
|
|
T.RATHA KRISHNAN wrote: void GoToWaypoint(float dt, const Waypoint* pWaypoint);
The above declaration doesn' correnspond to the definition, unless it is enclosed inside the same namespace(dtAI ) and class(AICharacter ).
What do you need to do? Declare another function with the same signature outside the namespace?
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]
|
|
|
|
|
I've to declare the function in another file not only the signature but I need the functionalites also in the function that is to be declared by me in the second file.(I can comment the function inside the first file i.e included in the namespace).
|
|
|
|
|
Ahh, it was so much clearer the second time!
You might consider the Facade design pattern (http://en.wikipedia.org/wiki/Facade_pattern[^]) to give one class access to a single function another class, without coupling the classes together.
The basic idea is to declare an interface that defines the one function, and make the existing class derive from that interface. The class that uses this function sees an instance of the existing class as the interface -- not the whole class.
|
|
|
|
|
I import class from excel.exe in office 2003.
In the program, I use only basic operations to manipulate .xls files.
Will the program be compatible with .xls file create with other versions of Excel, for example Excel 2000 or 2007?
system
|
|
|
|
|
Excel 2007 has many changes i.e ribbon bar , but as far as just programming excel is concern , think a program with excel 2003 should work with excel 2007 .
Vikas Amin
My First Article on CP" Virtual Serail Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Is there any API through which processes can be enumerated on the basis of Port they are using.
Thanx
Sunit
never say die
|
|
|
|
|
i feel this API <GetExtendedTcpTable> will work for me.If any body has another solution please let me know
Sunit
never say die
|
|
|
|
|
|
Thanx a lot
never say die
|
|
|
|
|
Hi!
I've two unrelated classes named "character" and "test". I've defined a variable "flag" inside test. I've to access this variable from the other class(i.e from "character"). For this I've declared the class "character" as friend in test.h in the private section.
i.e
friend class AICharacter;
and I've also forward declared the class test in character like this:
class test;
I've used the following code to access the variable:
test friend_test = new test();
friend_test->char_flag1 = false;
But it shows the following errors:
(i)error C2079: 'friend_TestAI' uses undefined class 'TestAI'
(ii)error C2512: 'TestAI' : no appropriate default constructor available
(iii) left of '->char_flag1' must point to class/struct/union/generic type
Is there any other way to access a variable which is declared inside some other class?
|
|
|
|
|
Code missing in your post.
I don't see any TestAI class in posted code.
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]
|
|
|
|
|
Sorry. It's advised by my organisation not to post original code. Here is the modified post:
Hi!
I've two unrelated classes named "character" and "test". I've defined a variable "flag" inside test. I've to access this variable from the other class(i.e from "character"). For this I've declared the class "character" as friend in test.h in the private section.
i.e
<pre>friend class character;</pre>
and I've also forward declared the class test in character like this:
<pre>class test;</pre>
I've used the following code to access the variable:
<pre> test friend_test = new test();
friend_test->char_flag1 = false;</pre>
But it shows the following errors:
(i)error C2079: 'friend_test' uses undefined class 'test'
(ii)error C2512: 'test' : no appropriate default constructor available
(iii) left of '->char_flag1' must point to class/struct/union/generic type
Is there any other way to access a variable which is declared inside some other class?
|
|
|
|