05-27-2015 03:07 AM
i have just read about """"toolslib\custctrl\pwctrl.fp""""" but in my case i have developed a cvi project which is almost complete and now i want to add a password panel to my current project so that when the program starts it asks for the username and password and then on correct password it displays my orignal data display user interface. it will be helpful if you guide me on how to achieve this in steps and a Code Example will be a added plus point , i will be thankful to you,
regards
Ahsan
05-27-2015 03:21 AM
The password control is one of the simplest in use you can find in CVI: simply create a panel with a string control and operate on it for example this way:
int tmpH, ctrl; char buf[64]; // Password request errChk (tmpH = LoadPanel (0, "myUirFile.UIR", pswd)); PasswordCtrl_ConvertFromString (tmpH, pswd_pswd); InstallPopup (tmpH); while (TRUE) { GetUserEvent (1, 0, &ctrl); if (ctrl == pswd_quit) { DiscardPanel (tmpH); return 0; } PasswordCtrl_GetAttribute (tmpH, pswd_pswd, ATTR_PASSWORD_VAL, buf); if (!strcmp (buf, requestedPassword)) break; MessagePopup ("Password", "Incorrect password entered."); } DiscardPanel (tmpH);
This example assumes you have a panel with the string control and "Ok" and "Abort" buttons.
05-27-2015 03:22 AM
I have also found an example on NI site: I havent looked into it but you may want to give it a try.
05-29-2015 12:52 AM
:manfrustrated:
i am very confused. i have used two panels in single "" .uri "" . i set my main panel as parent panel and password panel as child panel and i discard my child panel when password is correct and i can see my orignal screen but my issue is that when my program starts it displays my password screen but when i maximise my screen i can see my parent panel at background and its panel title as well although my child panel size is same as my parent panel.
i dont want to see my screen until correct password is entered.
05-29-2015 01:17 AM
You shouldn't use a child panel but a popup panel instead.
05-29-2015 01:47 AM
Wolfgang ha scritto:
You shouldn't use a child panel but a popup panel instead.
...and you shouldn't load your main panel until the user has eneterd the correct password.
05-29-2015 02:10 AM
thanks alot for solution
well i have used same parent panel and child panel approch , i load both pannels at same time where as my child panel which requires password is not moveable or resizeable and child panel will only discardpanel on correct password but still size of parent and child panel on resize is not same. well its working for me although not hundrad%