Quickes way: Setup the dialog fields in OnInitDialog() and then call OnOk or OnBnClickedOk() ...it's a quick thing but i don't like it verry much. A better way is to process the login info in a method not depending on UI. Just pass the login fields as params to your method. In this method, display the dialog if you need to (ie: your user did not check the autologin option or something). The best thing about this is that you can call the same method in your UI validation procedure afterwards.