|
David, thank you very much.
- Nick Parker My Blog
|
|
|
|
|
that's very clear !!
you watch a variable that is a pointer...
what you want from this pointer is to show the string containig the caracters at th folowing addresses, until it encounters a '\0'... that is surely what happened. The second caracter of your string is very certainly a '\0'... watch this !
TOXCCT >>> GEII power
|
|
|
|
|
|
Thank Mike, I just saw that too. The value has to be passed to a function that accepts a LPCTSTR . Should I expect any problems passing a CString to it instead (i.e.; val being of type CString )?
- Nick Parker My Blog
|
|
|
|
|
Is it ok to assign BSTR to CString under non UNICODE compilation?
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
|
hello!
i wrote a program to combine two wave files into one.
for that i read wave file using CFile class according to
the file format.i am reading samples into vector<int>
variables.i am combininig two vectors and writing to the
file according to the wav format.its playing as three waves.
that i mean each wave as two.
if u know to solve pls help me!
|
|
|
|
|
I have a real basic question. I know this is something really easy but I am not totally sure what it means. I am learning mfc and in my book I see this:
pES = (CEditStr*)mLines.GetAt(mPosActive);
What does the (CEditStr *) mean in front of the variable? Does it have to be there?? I am not sure when I would need to use it. If anyone could explain it to me that would be great......Thanks!!!
|
|
|
|
|
that code is a cast. It means that the address recorded into the pointer mLines.GetAt(mPosActive) will be interpreted as a CEditstr pointer.
If that pointer already have this type, the cast is not needed, but you can use it for your code to be "readable". Of course, if your pointer is in another type, you must explicit the cast this way...
TOXCCT >>> GEII power
|
|
|
|
|
It is casting the return value of GetAt() to a CEditStr* .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
So the GetAt functions returns a pointer of CEditStr. Perfect!
thank you everyone!!
|
|
|
|
|
If that's the case, then the cast in the code snippet you provided is redundant.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
So when would I use casting? How would the code snippet be redundant?
|
|
|
|
|
BrockVnm wrote:
So when would I use casting?
When an object needs to be coerced into acting like another type. Casting does not convert, is just represents.
BrockVnm wrote:
How would the code snippet be redundant?
The cast here is redundant since the array is holding CString* types and that's how we want to use it.
CArray< CString *, CString *> arr;
CString *p = (CString *) arr.GetAt(5); The cast here is necessary because the array is holding CWnd* types, but we want to use one of them as a CEdit* type
CArray< CWnd *, CWnd *> arr;
CEdit *p = (CEdit *) arr.GetAt(5); A simpler example might be:
double dRate = 1.997;
double d1 = (double) dRate;
int nWhole = (int) dRate;
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
My oh My what a lovely answer!!!
But i guess someone has downvoted you, i will give you a 5er.
Anyways there is one thing i would like to add.
Casting has different effect on pointers and native data types.
DavidCrow wrote:
CEdit *p = (CEdit *) arr.GetAt(5);
as you said the pointer representation is modified.
and on native data types.
DavidCrow wrote:
int nWhole = (int) dRate;
is converting the data type.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
What's the difference between
typedef struct _MYSTRUCT {<br />
int nValue;<br />
DWORD dwValue2;<br />
}MYSTRUCT;
and
struct MYSTRUCT {<br />
int nValue;<br />
DWORD dwValue2;<br />
};
With each of them I can instantiate variables of type MYSTRUCT like:
MYSTRUCT myStruct;
And I doesn't need the old C style:
struct MYSTRUCT myStruct;
So why should I use typedef combined with struct. Are there any advantages or disadvantages.
Thanks for any comment.
Konrad
|
|
|
|
|
you're not obiged to...
the reason some code use this, it is because C don't allow to use types without the struct identifier, or when your struct is typedefed...
In C++, it is only a portability reason...
TOXCCT >>> GEII power
|
|
|
|
|
In a good old C, you can use structures only with the keyword struct . In C++, the only advantage of using typedef is, that you write the struct name with one word . In your example, MYSTRUCT is an alias to struct _MYSTRUCT .
Robert-Antonio
"Czech Railways discovered, that in case of disaster the most damaged wagons
were the first and the last. So they decided to create trains without them."
|
|
|
|
|
hi eerybody,
i am having a problem with popup menus.
The handlers associated with the menus are not called when i click on the menuitem in release mode but things work fine with debug mode.
Can anyone help.
thnx in advance,
Amit
|
|
|
|
|
in debug mode, compiler do some more operations such as setting default variable values to 0 and undefined pointers to NULL. this may cause a wrong code to be run correctly, so check your code again and look for these types of errors.
Vahid Kazemi (http://www.gameprogrammer.org)
|
|
|
|
|
i looked over but didn't get any problem of type.
|
|
|
|
|
Hi everyone,
I'm writing a program in which I need to display PDF file. I used CHtmlView class and open the PDF file so that Acrobat Reader will be automatically executed. The point here is that I want to hide the toolbar of acrobat component but cann't achieve (I tried to use DDE command but it just has effect with Acrobat Reader program but not the component inside the web page.)
Now I'm in urgent. Any suggestion is really highly appreciated !!!
Best regards.
|
|
|
|
|
Have you looked at the Acrobat SDK ?
http://partners.adobe.com/asn/acrobat/docs.jsp
the Core API may be of some help to you
-=[ QuieT Cha0s ]=-
|
|
|
|
|
hello everyone:
I have source code as the following:
Class a
{
void func2();
static void func1();
}
void a::func1()
{
AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0);
}
void a::func2()
{
AfxGetMainWnd()->PostMessage(WM_CLOSE, 0, 0);
}
func1 is crashed, func2 is ok.
The reason is that the handler is null.
But I need to use function as static, could you tell me how to post the message from a static function?
Thank you.
-Freehawk
|
|
|
|
|
As far as the API AfxGet....it should work even in static functions also,can you explain in more detail? y exactly you need static function?
VikramS
|
|
|
|