|
yes..Sorry for trouble to everybody.
|
|
|
|
|
What are the steps to remember the last entered username and should be able to save the password for a faster login.
I am using win32 in .Net environment.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
amitmistry_petlad wrote: What are the steps to remember the last entered username...
Check out the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\dontdisplaylastusername registry value.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you very much for your guidline,
but should I have to make this for my own application? I mean I have make my own registery value or I have to use this value diretly? can you please elborate this?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
I'm not sure what you are asking. See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
well, I am asking you how can I use in my application its system's own.Will I have to develop my own registry folder? if yes then how can I set the username and password because we can put it open in registery.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Did you read the link I provided? That particular registry key has nothing to do with other applications. It's for the OS.
For your application, you can do it however you see fit. For example, when the application first starts, read the values from the registry (e.g., HKCU\Software\Local AppWizard-Generated Applications\AmitsApp) and pre-populate your login dialog box.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ok thank you sir
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
I have two edit controls in a dialog - the 1st is CEdit and the 2nd is a custom class derived from CEdit which supposedly accepts file and sets the edit box.
Now my problem is upon dropping a file to the 2nd edit box, I want just the filename to go to the 1st edit box.
Any thoughts on how I should go about this?
Thanks!
|
|
|
|
|
ghunzel06 wrote: upon dropping a file to the 2nd edit box, I want just the filename to go to the 1st edit box
Is your problem is with dropping the file or setting text?
SetWindowText(..), SetDlgItemText(..)
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
My problem is with setting the text in the 1st edit box which I will get from the
2nd one upon dropping the file.
The handler to the drop event is in the class of the 2nd edit box. Am I on the right
path on this? Please help.
|
|
|
|
|
ghunzel06 wrote: handler to the drop event is in the class of the 2nd edit box
Send a custom message to your parent window to set the text in 1st Edit box.
NoteIf you use local variable, to pass the string in WPARAM or LPARAM then make sure you are sending message using SendMessage API..
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
I have to send a custom message to the parent window in the handler of the 2nd edit box?
Did I get it right?
|
|
|
|
|
ghunzel06 wrote: Did I get it right?
Yes.
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
try as follows from the edit2
GetParent()->SetDlgItemText( IDC_EDIT1, csFileName );
where IDC_EDIT1 is the id of the edit 1.
nave
|
|
|
|
|
thanks! but the problem would be the reusability of the custom edit control.
|
|
|
|
|
ghunzel06 wrote: reusability of the custom edit control
In normal don't send the custom message to its parent.
You can have a member variable (may be BOOL) to identify, to notify the parent or not. Made this BOOL as FALSE as default, for the classes who need those notification can set this BOOL to TRUE, by a member function.
On drop handler, check for this member variable and act accordingly.
class CMyEdit:public CEdit
{
BOOL m_bNotifyParentOnDrop;
CMyEdit() {
m_bNotifyParentOnDrop = FALSE; }
...
void SetNotifyFlag(BOOL bVal) {
m_bNotifyParentOnDrop = bVal }
};
inDropHandler
...
if (m_bNotifyParentOnDrop)
{
}
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
We'd need to see code for the custom edit control. The code in question will probably be in the WM_DROPFILES handler.
Steve
|
|
|
|
|
void CLaunchDlg::OnDropFiles(HDROP dropInfo)
{
// Get the number of pathnames that have been dropped
WORD wNumFilesDropped = DragQueryFile(dropInfo, -1, NULL, 0);
CString firstFile= _T("");
// get all file names. but we'll only need the first one.
for (WORD x = 0 ; x < wNumFilesDropped; x++) {
// Get the number of bytes required by the file's full pathname
WORD wPathnameSize = DragQueryFile(dropInfo, x, NULL, 0);
// Allocate memory to contain full pathname & zero byte
WCHAR* npszFile = (WCHAR*) LocalAlloc(LPTR, sizeof(WCHAR) * (wPathnameSize + 1));
// If not enough memory, skip this one
if (npszFile == NULL) continue;
// Copy the pathname into the buffer
DragQueryFile(dropInfo, x, npszFile, wPathnameSize + 1);
// we only care about the first
firstFile=npszFile;
// clean up
LocalFree(npszFile);
}
SetWindowText(firstFile);
}
That's the handler of the Custom Edit Control, CDropEdit.
Any ideas?
Thanks!
|
|
|
|
|
ghunzel06 wrote: // clean up
LocalFree(npszFile);
}
SetWindowText(firstFile);
}
Instead of SetWindowText(firstFile), send a message to parent window,as
CWnd pwndParent = NULL;
pwndParent = GetParent();
if (pwndParent && pwndParent->GetSafeHwnd())
pwndParent->SendMessage(CUSTOM_MSG, WPARAM, LAPARAM);
On handling this message, set the string to the 1st edit control.
Do your Duty and Don't expect the Result Rate this Post, if I helped You
|
|
|
|
|
but how about the reusability of the custom edit control? I dont think I will be able to use it in other dialogs if in case in that dialog I dont want that behaviour.
|
|
|
|
|
ghunzel06 wrote: but how about the reusability of the custom edit control?
What about it? The parent of a control can choose whether or not to handle messages sent by its children.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Modify code like this:
void CLaunchDlg::OnDropFiles(HDROP dropInfo)
{
WORD wNumFilesDropped = DragQueryFile(dropInfo, -1, NULL, 0);
CString firstFile= _T("");
for (WORD x = 0 ; x < wNumFilesDropped; x++)
{
WORD wPathnameSize = DragQueryFile(dropInfo, x, NULL, 0);
WCHAR* npszFile = new(nothrow) WCHAR[wPathnameSize + 1];
if (npszFile == NULL)
{
continue;
}
DragQueryFile(dropInfo, x, npszFile, wPathnameSize + 1);
LPCTSTR pFileName = PathFindFileName(npszFile);
firstFile = pFileName;
delete [] npszFile;
break;
}
SetWindowText(firstFile);
}
Steve
|
|
|
|
|
sorry and thanks for the heads up
|
|
|
|
|
I should be the one saying sorry; I've just re-read your post and realised that I misinterpreted your question. I thought you wanted an edit control then when a file was dropped on just filled in the filename and not the complete path. It seems this was not the case.
Steve
|
|
|
|