|
Is it a suggestion for me?
Thanks for this one . I thought I didn't need this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
oops! Sorry. I guess I pressed the wrong 'reply' button.
Tara
Fortitudine Vinsinues!
(By endurance we conquer)
|
|
|
|
|
I am working on a win32 program that requires users to create user names with passwords and log in. I assume that I need to create a file with user information and then read from it when the user tries to log in but have no idea how to go about doing so. Any help would be much appreciated. Thanks.
-Matt
|
|
|
|
|
fury 84 wrote: I assume that I need to create a file with user information and then read from it when the user tries to log in
That would be a bad assumption. It'd probably be better to assume that they'd probably want to type their credentials into a login dialog box.
-- modified at 23:25 Sunday 4th June, 2006
Using windows authentication that is. "Programming Server-Side Applications for Microsoft Windows 2000"
by Jeffrey Richter, Jason D. Clark
|
|
|
|
|
The core problem is, how do you hide this info so that someone can't just read it from your file system ? One potential way is to apply the MD5 hash to the password, and store the result, then do the same when checking the password. This is not foolproof, but it's far better than storing username/password pairs as plain text.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
fury 84 wrote: I am working on a win32 program that requires users to create user names with passwords and log in. I assume that I need to create a file with user information and then read from it when the user tries to log in but have no idea how to go about doing so. Any help would be much appreciated. Thanks.
Simplest Way to do so, is by using INI files! i.e. INI file is based on section, key and data, though it provide absolute security to your application, but for beginner level it will be easy go
try to create you INI structure some thing like this
[USERS]
noofuser=2
[USER1]
username=alok
password=alok
[USER2]
username=fury
password=fury
using this structure you can easily add user to your Application, without modifying application. here is list of ini wrapper class
http://www.codeproject.com/cpp/CIni.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
Please can you tell me how INI file provides security. I mean, if you right-click on an ini file and select 'open with notepad' , it open and shows all the contents. So, how can it be used to save usernames and passwords.
Is there any other way? How do all those huge multi-user application securely store passwords?
Thanks.
Tara
Fortitudine Vinsinues!
|
|
|
|
|
TheinstruTara wrote: ou tell me how INI file provides security
Sorry i misquoted in my sentence, i want to say it doesn't provide Absolute Security but it is good for beginning
TheinstruTara wrote: Is there any other way? How do all those huge multi-user application securely store passwords?
actaully even Highly secure application store there information inthese file only , but they encrypt the data so no body able to read that. even Windows store there data in SAM files!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Encrypt....like...for example I write some code to convert the actual password to some normally un-understandable stuff and then store it.
Is that right? Is that one way of doing it?
Tara
Fortitudine Vinsinues!
|
|
|
|
|
TheinstruTara wrote: Encrypt....like...for example I write some code to convert the actual password to some normally un-understandable stuff and then store it.
Crytography for Example i.e. RC4 algorithm hashing etc
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks a lot.
Fortitudine Vinsinues!
|
|
|
|
|
There is an X in the upper right corner. When the user clicks on
it, the program obviously closes.
How, in PreTranslateMessage(), can I determine that the user clicked
on that? Before any further action is taken, I want to quick ask
the user whether they want to save the contents before exiting. I
tried putting the command in other places and it just doesnt work
right.
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Handle the WM_CLOSE message. To stop the user closing don't pass the message on to the superclass of the window you're subclassing.
Steve
|
|
|
|
|
|
Check for WM_SYSCOMMAND and then SC_CLOSE .
When you click on those buttons on the title bar a WM_SYSCOMMAND is generated. Now what kind of event happened is determined by the wParam parameter. Check the wParam parameter to find out if X (SC_CLOSE ) was clicked.
Here is a sample done with WindowProc...
LRESULT CVolMacDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if( message == WM_SYSCOMMAND && wParam == SC_CLOSE )
{
if( MessageBox(_T( "Are you sure you want to quit?" ), _T( "Prompt?" ), MB_YESNO ) == IDNO)
return 0;
}
return CDialog::WindowProc(message, wParam, lParam);
} Well this is done with a dialog, it will work with views too but it will require some additional housekeeping too. Hope this helps.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Hi ,
Check this out :-
(In Pretranslate Message)
if ( pMsg->message == WM_NCLBUTTONDOWN) // non client LButton Down
{
if ( pMsg->wParam == HTCLOSE) // the close button is going to be pressed
{
}
}
Regards,
FarPointer
|
|
|
|
|
I have a dialog box with the Title Bar setting set to False. This means that the Minimize Bar setting is False as well. This is why I can't minimize the application when I click on the icon task bar, but I would like this to happen.Any suggestions?
Thank you!
|
|
|
|
|
Junyor wrote: This is why I can't minimize the application when I click on the icon task bar, but I would like this to happen.Any suggestions?
You can send a WM_SYSCOMMAND message with wParam parameter set to SC_MINIMIZE .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
i hope this code might be helpful to u.
bool bClientWinState = false;//define and declare this variable in OninitDialog(); of your application. handle the OnNotifyIcon event like this:
LRESULT CMyApplication::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
{
UINT uID;
UINT uMouseMsg;
uID = (UINT) wParam;
uMouseMsg = (UINT) lParam;
if ((uMouseMsg == WM_LBUTTONDOWN) || (uMouseMsg == WM_LBUTTONDBLCLK))
{
if(bClientWinState)
{
AfxGetApp()->m_pMainWnd->ShowWindow(SW_RESTORE);
AfxGetApp()->m_pMainWnd->SetForegroundWindow();
bClientWinState = false;
}
else
{
AfxGetApp()->m_pMainWnd->ShowWindow(SW_MINIMIZE);
this->ShowWindow(SW_HIDE);
bClientWinState = true;
}
}
]
jiteen tilekar
Siemens Info. systems Ltd., Pune
|
|
|
|
|
good idea, just what's the message number of clicking the icon in the taskbar instead of system tray area. I think we need to respond
the message to minimize our application.
Nothing impossible, Nothing sure
|
|
|
|
|
I answer to your question in previous message
whitesky
|
|
|
|
|
As you know, we can lock taskbar manually, But I would like to lock taskbar by my own program. I try to do it by the following code:
DWORD style = GetWindowLong(hShellTrayWnd,GWL_STYLE);
style &= ~WS_SIZEBOX;
SetWindowLong(hShellTrayWnd, GWL_STYLE, style);
Unfortunately, it didn't work as I expected. Does anyone know how to do it?
Your help would be greatly appreciated.
Nothing impossible, Nothing sure
|
|
|
|
|
I did do it sometime back but don't have the message number with me now.
Maybe I can give it you tomorrow.
This requires you to send a message to the taskbar asking it to lock itself. I did have the number but don't have it now.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Hi Tomas,
Your help would be greatly appreciated, in fact I send WM+USER+336 to taskbar, but it didn't work, which make me feel that it can't be done by sending a message.
And then I try another way below:
CToolBar* trayWnd = (CToolBar*)FromHandle(hShellTrayWnd);
DWORD barStyle = trayWnd->GetBarStyle();
barStyle |= CBRS_SIZE_FIXED;
trayWnd->SetBarStyle(barStyle);
It also didn't work, I was really frustrated, the style of taskbar vary every time even though I remove "trayWnd->SetBarStyle(barStyle)".
For example, sometimes barStyle is 380, but sometimes it is 376, and other times, it is another value. it is very strange for me.
Nothing impossible, Nothing sure
|
|
|
|
|
NianHawk wrote: Hi Tomas,
Your help would be greatly appreciated, in fact I send WM+USER+336 to taskbar, but it didn't work, which make me feel that it can't be done by sending a message.
Thanks.
This works on both Windows XP, 2000...
#define <code>WM_USERDEF_LOCKTASKBAR </code>424
static HWND hShellWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL);
if(hShellWnd != NULL)
::PostMessage(hShellWnd, WM_COMMAND, MAKELONG(<code>WM_USERDEF_LOCKTASKBAR</code>, 0), NULL);
else
hShellWnd = ::FindWindow(_T("Shell_TrayWnd"), NULL); This will work!
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|