|
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!
|
|
|
|
|
If you want to be able to encrypt using either the "User" or "Master" password, but want to be able to decrypt data encrypted using the "User" password with either the "User" or "Master" passwords, but prevent decryption of "Master" encrypted data using the "User" password, I do not know of a specific encryption algorithm that allows this.
However, you may be able to do what you ask by encrypting the data with static static/internal passwords, and write a signature at the beginning of the data indicating if the "user" or "master" encrypted the data. You can then use application logic to determine of the "user" should be allowed to decrypt the data.
For example, you internally maintain two passwords: User-"ABC", Master-"123". Data is encrypted depending on who saved it, and is stored with a flag indicating if the "User" or "Master" encryption was used. At decryption time, you can read the flag, and determine if the current user is a "User" or "Master", and determine if you should decrypt the data or not. For example, a "User"-level user is trying to read two units of data from the database, one saved with the "User" password, one with "Master".
First, the data was saved with "User" is read back. The data's flag is checked (which is "User"), and the current user is allowed to decrypt it (because they are "User" or "Master"-level), so decrypt the data.
Now, the second set of data saved with "Master" is read back. The data flag is checked (which is "Master"), and the current user is not allowed to decrypt it (because they only have "User"-level access), so you raise an appropriate message.
A bit quick&dirty, but it might work for a Monday implementation... :/
The most important thing to do when working with encryption, IMHO, is to clearly specify exactly what you need encrypted, and to what extent, then approach possible solutions.
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!)
|
|
|
|
|
Quick and dirty sounds about right for this weekend. Though I think you missunderstood what I want.
The "master" would never be encrypting anything, it's sole purpose is for administrators to read the encrypted data or incase of lost passwords. Basicaly I need to be able to decrypt data using one of two passwords.
As a quick and dirty solution, I will allow the user to create a password and use this as the encryption key, I will then encypt this password using a master key and store it alongside the data. Using program logic, if the user password fails, try decrypting the users password instead and intern use that.
Hey it's already Friday night, and I want some beer tomorrow night
|
|
|
|
|
|
Thanks for the links, although after reading the mentioned articles I have found them to be unsuitable for this particular project for the following 2 reasons:
1) They do not support the use of 2 keys, which is really what I need.
2) The data block has to be formatted to a multiple of 8 bytes. Most of the strings I am dealing with are in the form of "101.89". I would first have to pad this, I know it's only 1 byte, but then in order to safley store it I would have to convert the encrypted string to a hex value. Now I have gone from 7 bytes to 17 bytes. If I do this for each of the 4000+ strings you can imagine the speed decrease and the final file size.
At the moment I am thinking of creating a hash of the users password, then using this hash as a one time pad. I know the security will not be of the highest level, but all I need is to prevent non-authorised users from reading the data.
|
|
|
|
|
Hi ,
Can anyone tell me how to create 2 column List Box with default fields and in the 2nd column with variables which can passed during runtime.
(1st column) (2nd column)
Property | Value
Location
Word count
Document count
File size
Last Updated
Created
Please tell how to declare the default values in the 1st column ??
Regards,
Parichay BP
|
|
|
|
|
A better option would be CListCtrl .
Nibu thomas
Software Developer
|
|
|
|
|