|
Hi,
In my application the dialog is set with the background bitmap .I have some buttons in that dialog.Now how can i make the button look flat and should mix with the background of the dialog window i.e,it should not resemble as a button and it should resemble just like a static text.
Thanks in advance,
Radhika.
|
|
|
|
|
You need to make button owner drawn.
see this[^]article to get some help.
|
|
|
|
|
I need to calculate distance (along curver) between 2 points on an ellipse.
I can not find answer from google.
do you still remember the math, or any links?
thx
|
|
|
|
|
|
Hi!
I need to process both ascii and chinese chars to 2 bytes? How do i do that? They are both stored in std::string. Please give an example.
Thanks very much!
|
|
|
|
|
when you say 2 bytes do you mean wchar_t data type? Use the MultiByteToWideChar() function. Although I very often have problems with chinese characters being mapped into two wchar_t characters. Make sure to specify the correct codepage.
|
|
|
|
|
How to specify the correct code page?
|
|
|
|
|
936 = Chinese Simplified
950 = Chinese Traditional
I should also tell you that there are two functions to do this. The one I told you MultiByteToWideChar() takes a codepage, but the second function mbtowc() only takes the strings. I usualy have many probles with the first function, instead of mapping a single character to 1 wchar_t , it instead splits it to 2, which is not unicode. The second function has never failed me. I suggest you try both of them.
|
|
|
|
|
about template
i create template class
<<<<<m_templatedata.h>>>>>>>>
template <class t=""> struct CTDbNode
{
T Data;
CTDbNode(T Value):Data(Value){}
};
<<<<<<<m_templatestructure.h>>>>>>>>>>>
#pragma once
#include "m_TemplateData.h"
template<class t="">class CTDbList
{
public:
CTDbList()
{
pCurrent=NULL;
}
void CTInsert(T Value)
{
pCurrent=new CTDbNode(Value);
}
public:
CTDbNode<t> *pCurrent;
};
example
CTDbList<cstring> d;
d.CTInsert(_T("ddd"));
error:
e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2955: 'CTDbNode' : use of class template requires template argument list
e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode'
e:\mystudio\project\shared\shared\m_templatestructure.h(11) : while compiling class template member function 'void CTDbList<t>::CTInsert(T)'
with
[
T=CString
]
e:\mystudio\project\shared\shared\cm_selectquery.cpp(6) : see reference to class template instantiation 'CTDbList<t>' being compiled
with
[
T=CString
]
e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2514: 'CTDbNode' : class has no constructors
e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode'
thank
|
|
|
|
|
Tick the "Ignore HTML tags in this message" button when you post: none of the the "<" or ">" characters can be seen in you post and it's poorly formatted.
Steve
|
|
|
|
|
I'm using a CFile to write to a binary file, and I want to modify some text in it. I would like to know if there is another way then rewriting everything after the position of what i want to modify(by modify i mean that it's probably be longer text). I tried the modeReadWrite to rewrite everything after the position, but for an unknow reason it doesent want to read anything(even in shareDenyNone). I even tried to make two CFile objects, one for reading and another one for writing and it still doesn't work. If you have any idea, please let me know.
|
|
|
|
|
nobody can help me
|
|
|
|
|
Has anyone found a way yet to comprehensively parse a CPP Decorated name, to recover the Original Declaration.
LateNightsInNewry
|
|
|
|
|
That depends entirely on the compiler being used. Here's[^] an article on the name mangling scheme in Visual C++. I don't know how correct it is, but I assume it is. I've seen the mangling scheme before in material published by Microsoft (can't remember where though, sorry!).
--
Transmitido en Martian en SAP
|
|
|
|
|
|
I want to know is it possible to to make a constant variable to hold a value the user of my application at the run of the program choose and i want him to not not chang it again.
thank you
******************
******************
** Ahmed Ismail **
******************
******************
|
|
|
|
|
Ahmed Ismail Mohamed wrote: I want to know is it possible to to make a constant variable to hold a value the user of my application at the run of the program choose and i want him to not not chang it again.
const is an official C++ qualifier.
|
|
|
|
|
but i think that a pointer have the address of const var can do changes, but when i make that i failed
Ahemd Ismail
|
|
|
|
|
If you are declaring a variable as const, and do not want to change it, why on earth are you trying to change it?
|
|
|
|
|
Hello
Ahmed Ismail Mohamed wrote: I want to know is it possible to to make a constant variable to hold a value the user of my application at the run of the program choose
No problem! Make an input and store in that variable.
Ahmed Ismail Mohamed wrote: and i want him to not not chang it again.
Don't call the above function again!!
PS.
I know you are talking about the const_cast operator, but why??
Here is a sample code for what you want quoted from MSDN:
#include <iostream>
using namespace std;
class CCTest {
public:
void setNumber( int );
void printNumber() const;
private:
int number;
};
void CCTest::setNumber( int num ) { number = num; }
void CCTest::printNumber() const {
cout << "\nBefore: " << number;
const_cast< CCTest * >( this )->number--;
cout << "\nAfter: " << number;
}
int main() {
CCTest X;
X.setNumber( 8 );
X.printNumber();
}
-- modified at 1:16 Sunday 3rd September, 2006
In addition to the above, I forgot to mention another more standard way of doing what you want:
1- Declare your data type as a const member of a class.
2- Take the input from the user in a temp variable.
3- Put the value in your const member using the initialization list of the class' constructor.
Regards
|
|
|
|
|
The Standard of English in the phrasing of this request was so bad, I still do not understand what it was all about. The Code snippet above is quite clear, but I've still no idea what question it was realy supposed to answer. I suggest that the poser of this question purchases a copy of Kernighan & Ritchie, and Read it from Cover to Cover.
If nothing else, this will introduce the poser of the question to the English Language
LateNightsInNewry
|
|
|
|
|
Hello
LateNightsInNewry wrote: I still do not understand what it was all about
I believe he was asking about casting a const variable to remove its constancy, change its value once, then recasting it back into a const .
LateNightsInNewry wrote: this will introduce the poser of the question to the English Language
Come on! You already have spent enough time around here to learn CP language!;)
Regards
|
|
|
|
|
Nader Elshehabi wrote: I believe he was asking about casting a const variable to remove its constancy
not so. i believe he wants to know how to initialize a const var whose value will be known only at runtime.
your answer though was correct. making the const var a class member can delay init till runtime. but it is expensive. a better way is to put it in a function as a static const and then init it with an incoming value which has a default. like this:
const int var_name (const int var_val = 0)<br />
{<br />
static const int var = var_val;<br />
return var;<br />
}
then you can use it like this:
var_name (temp1);
temp3 = var_name (temp2);
but beware that if your first call doesn't pass a value the default will be set.
one more advantage is that this way it is much more difficult to use a pointer and modify the value.
-- modified at 5:46 Sunday 3rd September, 2006
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|
|
Hello
Thank you for your reply Mayank.
MayankT wrote: but it is expensive
You didn't specify in what exactly, but I'll assume you mean in excution speed. Why? What's the difference between declaring a variable as a class member or as a static in a function in a class??
Also in your way you store the true value in the static member. But from your code most of the work will be on the returned value not the original const . You can change temp3 to whatever you want after the call. While in the initialization list of a constructor -i hope you read my modified post-, you set that memebr to public and operate on it with no problem!
Again, about the whole idea!! I can't think of one good practical -not hypothtical- scenario where we should use this approach instead of just making our variable as private, or just use another approach!!
MayankT wrote: one more advantage is that this way it is much more difficult to use a pointer and modify the value.
I hope you don't mean reverse engineering? From what I heard there are monsters out there that can decipher assembly as easy as you read english! With a cup of coffee, some brains, and a good memory dump tool, you can't hide aything anywhere!!
Regards
|
|
|
|
|
Nader Elshehabi wrote: What's the difference between declaring a variable as a class member or as a static in a function in a class??
Actually I meant that a class might not be necessary. And if it is an existing class that is being used then it could be difficult to change the design in a manner as to provide the var at object creation time.
This function can be put outside a class or if inside it wont require change to construction code.
One difference is that the member var will be unique to each object but as static in a function in a class it will have to be shared.
Nader Elshehabi wrote: You can change temp3 to whatever you want after the call.
Right! I was tempted to return a val by ref but realized that the guy had already tried to use pointers to manipulate a const var. So this seems safer. Also, even a public class member can be assigned to a temp and anything can be done.
Nader Elshehabi wrote: scenario where we should use this approach
as in the differences above
Nader Elshehabi wrote: I hope you don't mean reverse engineering?
Not at all . Only in this case even if someone uses a pointer to the returned val they will not be changing the actual var storing the const.
Actually, only the first line was for you Yes your approach is excellent if there is an existing class which is being instantiated after the value is known. I should have thought about that. Thanks for the reply!
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|