|
InfiniBand - the only way to fly!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
That is ~205KB of data, which is a small amount of data in today's world.
Note that if you are copying the data directly into the CString in one shot, the performance will be MUCH better than if you keep appending into the CString .
If you need to be messing around with individual pages or lines a lot, you might want to use something else like an embedded editor (a hidden edit/richedit control, for example), or your own implementation of a text-row table (and array of pointers, one for each page/line) or something like that.
Lastly, it might be worth making sure that the function HAS to take a CString - there are lots of examples of poorly-designed code that take CString parameters unnecessarily, when a simple LPCTSTR would work fine.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Lastly, it might be worth making sure that the function HAS to take a CString - there are lots of examples of poorly-designed code that take CString parameters unnecessarily, when a simple LPCTSTR would work fine.
What really makes me twinge is when they specify a CString& - by reference! when an LPCTSTR would have been just fine
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
I need Introduce Yourself to Vc++ Part II,III,IV.Send it for me,please?I'm sorry because my English is bad.send to manhhung_luu@yahoo.com,please.
|
|
|
|
|
|
|
MSDN for MessageBoxEx clearly say: if message box doesn't have Cancel button ESC has no effect on message box. But in reality I can not reproduce this behaviour. My message box allways reacts on ESC, although I have only OK button on it. How to prevent this? And if I already have just OK button on it, that means I want 'X' button to be disabled (if not erased). Is there any solution for this? I hope there is and that someone will share it with me.
Thanks
Doctor Celic
|
|
|
|
|
You could overwrite the CDialog::OnCancel() method - that worked for me. Good luck!
|
|
|
|
|
OK, maybe I was not clear enough. Is it possible to use MessageBox API functions and as a result to have message box which doesn't react on ESC and with 'X' button disabled?
Doctor Celic
|
|
|
|
|
OK - first, the documentation is incorrect for the message box functions. There is a little known fact about the internals of standard message boxes that use MB_OK - that is actually a IDCANCEL button with a label of "OK". That is why you can dismiss that kind of message box using ESC or ENTER .
Second, as of Windows XP, there is no difference between using MessageBoxEx(...) or MessageBox(...) , so if you are using the Ex version, you might want to make sure you know what you are doing with it...
Lastly, I do not think that there is a way to do that without doing something like implementing your own message box-like function from scratch, or doing something like creating a Yes/No message box and then hooking its creation, relabeling one button to "OK", centering it, and hiding the second button. You might also have to handle mnemonic actions for the hidden button, though...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi Friends,
How sizeof operator works? Is it get resolved compile time? Can I write function which do the exact job of sizeof operator ? It should run on any platform and shows size of any declared variable like int,double...
VikramS
|
|
|
|
|
Isn't "sizeof" a reserved keyword? If yes, then it's resolved by the compiler.
|
|
|
|
|
yes it is...But How it works?
|
|
|
|
|
It doesn't 'work' . It is like asking how 'return' or 'class' works. It is a keyword, so there is no function associated with it.
|
|
|
|
|
Well,
I agree that it's key word and get resolved that compile time. But
there must be some funcionlity associated with it,
like
1) keyword return: make code to return from function call and populate AX register value with return value if any
2) keyword class : at design time desides type and memory layout of your custom data type.
so finally they are there to tell compiler to do some job...What about sizeof...does it tell compiler to do some job? so what is it?
|
|
|
|
|
man, stop persisting in this way.
all you can code will be resolved at runtime, not compile time... so, one again, you CANNOT do this.
keywords class and/or return don't produce code like a function does. the compiler associate some assembler instruction to them, but they don't execute specific code. what code did you like class to execute ??
one question though : why do you need this ?
|
|
|
|
|
v2.0 says:
all you can code will be resolved at runtime, not compile time... so, one again, you CANNOT do this.
comment :
A class defination. get's resolved at run time???
|
|
|
|
|
you don't code it... you tell the compiler how the memory is structured
do you use any if , for , return , break etc... instructions in class definitions ?
|
|
|
|
|
Yes, it is a compile time operator, and it resolves to a constant value.
No, I do not think that it would be easy (if possible at all) to write a function that provides the same information. For example, RTTI's type_info class does not provide size information, and comparing stack addresses/locations would be iffy due to alignment issues.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
sizeof is a language operator, which you cannot recreate.
consider this:
class CMyClass {
char[MAX] m_arr;
CAnotherType m_at;
};
CMyClass c;
sizeof(c);
can you know what this will resolve ?
no, simply because
1) you can't know all user defined types
2) you don't know the stack alignment
3) the size might be plateform dependant
|
|
|
|
|
Please don't consider my problem statement for creating a new sizeof operator.I just wanted to have a function which will produce the same result.
Also if possible how compiler finds of sizeof any variable on different hardware platforms?
|
|
|
|
|
vikrams wrote: Please don't consider my problem statement for creating a new sizeof operator
i simply don't understand what you means here. i was giving you an example to show you that you CANNOT recreate the sizeof operator behavior... won't you understand that ?
vikrams wrote: I just wanted to have a function which will produce the same result.
refer the first quotation above
vikrams wrote: Also if possible how compiler finds of sizeof any variable on different hardware platforms?
because the compiler know on which plateform it's been installed on...
|
|
|
|
|
For a given object/data type TT:
TT var[2];
size_t sz = (char*)&var[1] - (char*)&var[0];
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hi All,
I wonder if somebody could point me in the direction of which encryption algorithm to use. My program is basically a SQL frontend storing and retrieving many strings within a database. I have now been asked to add security to the project in order to prevent other users from reading the database files.
My idea is to simply encrypt the strings before inserting them into the database. Here is where I am stuck, I need to be able to decrypt this data using one of two passwords, a user password, and a master password. This among other things now has to be finished by Monday.
Could somebody possibly name an algorithm which is capable of doing what I want, or possibly even point me towards a C++ example. Thankyou so much.
|
|
|
|
|
I'm also have the same problem, but I'm using a MySQL database with ODBC. So, I encrypted / decrypted the strings with no password at all, and I set up some restriction rules on the server side. I've used two different system DSN to access that database and it worked very well. Good luck!
|
|
|
|