|
|
- Thanks pal!
- I try the URL you mentioned, but I can not open it.
-Can you help?
- Regards,
Maer
|
|
|
|
|
Seems to be something wrong with the CP servers.
You can get the same article from Dr. Newcomer's site at http://www3.pgh.net/~newcomer/hooks.htm
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
- Thanks pal!
- I have got the great article. It will be a lot help.
- Still have a stupid question, what means "CP" in your reply? (I am a newbie.)
- Have a nice weekend,
Maer
|
|
|
|
|
CP = Code Project
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
- Thanks pal!
- Have a nice day,
Maer
|
|
|
|
|
How can I Create a ListView with draggable icons?
(i mean that I will able to change icons position in the list by draggin them)
|
|
|
|
|
How do I format a number to kb?
//--------------------------------------
__int64 = sizeWritten;
long sw = sizeWritten / 1024;
sprintf( szBuffer, "%d Kb", sw);
//--------------------------------------
now returns something like 1234567 Kb
but i want it to return 1.234.567 Kb
is there an easy way or function to do this?
TIA
|
|
|
|
|
I dont think there is a ready-made function for that. But you can write your own huh?
Nish
p.s. I might be wrong though. There might be some obscure function.
|
|
|
|
|
The STL locale support includes functions to format numbers with correct grouping and and separators. You are right, they are obscure and nearly undocumented in MSVC++.
|
|
|
|
|
|
Amazing Michael
You sure do know all of them API calls don't you!
A for you Michael
Nish
|
|
|
|
|
Thanks for the feedback so far,
Came up with the following, how does this look?
any input, comment welcome...
//----------------------------------------------------------------
#include "string.h"
char szOutput[20];
char* formatKB(long input)
{
char szInput[20];
int j=0, k=0;
sprintf( szInput, "%d", input);
_strrev(szInput);
for (int i = 0; i < strlen(szInput); i +=3)
{
strncpy( szOutput + k, szInput + j, 3);
if (j < strlen(szInput) - 3 )
strcat( szOutput , ".");
j+=3;
k+=4;
}
_strrev(szOutput);
return szOutput;
}
int main(int argc, char* argv[])
{
long sizeWritten = 1234567890;
printf("%s Kb\n", formatKB(sizeWritten));
return 0;
}
//----------------------------------------------------------------
Xenion
|
|
|
|
|
Okay, I wrote a perl script for a signup area in my MFC application. When the user fills in the data for the perl script on my webpage, it creates a file in the settlers.net/snetdownload/users folder called $username.$password - $username being the data the person entered into the username field and $password being the password the user entered into the field.
Okay, now in my program. I have 2 edit controls. m_username and m_password. Okay, say in my perl script I entered Ashman as the username and cheese as the password it would create a file, Ashman.cheese
I need my program to check that the I have put in Ashman in the username and cheese in the password field and then validate that the file exists with the server. If I put in Ashman as the username and choose as the password, it will not find the file ashman.choose so it will say, Could not login.
Get my drift?
Ashman
|
|
|
|
|
I don't do perl, but I know a thing or two about security and I can't see much point in a password at all if its going to be so easy to see what it is.
Assuming your user names have to be unique anyway you do not need the password to be on display at all.
I would pass the username and password to the system to do the validation, then if your program wants to know who is logged in it can ask.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
- In MSDN, it is said TLS index is stored in a global variable.
- I do not know whether it is a process-wide global variable or a thread-wide variable?
- Can you help?
- Regards,
Maer
|
|
|
|
|
If I understand your question correctly, then...
The TLS *index* ("slot" location) is a process-wide global variable. The value that is stored in the TLS (slot) location referenced by the index is Thread-specific.
-=- James.
|
|
|
|
|
- Thanks pal!
- Your reply clarifies my doubts.
- Have a nice weekend,
Maer
|
|
|
|
|
I constructed a resizeable dialog and of course put a class behind it. I want to create an instance of this class and then do several DoModals on it. This means I want to open the Dialog and then close it several times. Because the window can be resized and repositioned I want to store this data and set it back when the dialog opens again. I tried it with Get/SetWindowPosition(), but if I do the SetWindowPosition() in OnInitDialog() and the window was maximized before, the window is drawn two times. The first time it is in its initial size and the second time in the correct stored size. So when the window is opened it is flickering. Has anybody an idea how to restore the old window size after the dialog is opened again without drawing it twice?
Thank you very much!
|
|
|
|
|
Good idea.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
What's a good idea?
Nish
|
|
|
|
|
Bla?
What's that mean?
Nish
|
|
|
|
|
Sorry, I hit the submit button instaed of the preview button...
I just edited the posting...
KHB.
|
|
|
|
|
Use the PreCreateWindow virtual function in your dialog class. Modify CREATESTRUCT& cs to contain your desired window size, and Bob's your Uncle.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
How do I set focus & "thick border" to a button, as If the user had Tabbed to it?
SetFocus only sets the focus (dotted rectangle). The "Default-Like" state remains at the original button.
I guess SetDefID to set the default button is the wrong way, since the default button is by default preserved when I tab away from the buttons (e.g. to an edit)
TIA
Peter
|
|
|
|