LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to have password panel in labwindows

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

0 Kudos
Message 1 of 7
(5,648 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 7
(5,647 Views)

I have also found an example on NI site: I havent looked into it but you may want to give it a try.

Using the Password Control



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 7
(5,646 Views)

: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.

0 Kudos
Message 4 of 7
(5,596 Views)

You shouldn't use a child panel but a popup panel instead.

0 Kudos
Message 5 of 7
(5,594 Views)

 


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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 7
(5,587 Views)

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%

0 Kudos
Message 7 of 7
(5,582 Views)