Hi,
We have 1 windows application developed using .NET 2.0.
We have created a MSI file to install it on another machine and its installing successfully.
After installation when we starts the application a login screen appears but focus is not going on user name field. Only user name field appears highlited with default name and application icon blinks at task bar.
We want to stop this blinking and wants that after start of application the focus should directly go into user name field. This is happening on some windows XP Pro machines but on other Windows XP Pro m/c (which is VMWare image) its not happening.
Please some one help to fix this problem.
Thanks and Regards
Prasad Godbole
Loading
Prasad GodbolePosted Jun 15, 2011, 2:14 AM
I think we have got the solution for this problem. But want to know your views on this solution.
We have 1 Splash Screen and 1 MDI form in sample application. Previously we had set the MDI form as a startup form and Splash Screen through project properties and we were facing icon blinking and text box focus problem.
Now we have set the Splash screen as a start up form and set the splash screen option to none through project properties. In the splash screen we have used a timer and after timer time elapsed we are showing MDI form and then displaying login form which is normal process.
By doing this, application icon is not blinking on task bar and we are directly getting focus into user name field and its working on Windows 7 also.
Is this solution fine to implement and do we need to take any precaution OR it will create any problem ?
Please advise in this so that we will try this with our main application.
Thanks and Regards
Prasad
Prasad GodbolePosted Jun 14, 2011, 4:32 AM
I tried
Me.BringToFront()
Me.SetTopLevel(True)
But not getting effect
Sam HobbsPosted Jun 14, 2011, 3:23 AM
Me.SetTopLevel(True)
Prasad GodbolePosted Jun 14, 2011, 1:10 AM
If we run this application through visual studio then application icon never blinks on task bar.
After building the project please copy its EXE at other place and then try to run EXE . I think by doing this the problem will be reproduced at your end.
Also if you can test only EXE on live servers then there is possibility that the problem will be reproduced.
We tested this EXE on VMWare image (having OS Windows XP Pro) and another live server (having OS Windows Server 2003). On both environments we are getting icon blinking problem on task bar and due to this we are unable to type directly into txtUserName text box.
On our local machines having OS Windows XP Pro we are not facing this problem.
This is very strange behavior of application to detect the reason.
Thanks and Regards
Prasad
Sam HobbsPosted Jun 13, 2011, 7:59 PM
Vilas GitePosted Jun 13, 2011, 10:43 AM
Prasad GodbolePosted Jun 13, 2011, 8:03 AM
I have uploaded the sample application this VB.NET version but it will give idea about the problem. This sample application is also giving blinking problem.
Please have a look.
Thanks and Regards
Prasad
Vilas GitePosted Jun 13, 2011, 3:47 AM
Hi Prasad
I am not sure, but Please check it…may be helpful for your post.
http://msdn.microsoft.com/en-US/library/bfkbc5a3(v=VS.80).aspx
http://msdn.microsoft.com/en-US/library/1t310742(v=VS.80).aspx#Y480
Sam HobbsPosted Jun 10, 2011, 7:35 PM
Can you do something such as the attached? The following is the code that is in the Main method of the attached:
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormSplash());
FormLogon lf = new FormLogon();
Application.Run(lf);
if (lf.DialogResult != DialogResult.OK)
return;
FormMain mf = new FormMain();
mf.textBox1.Text = lf.Username;
Application.Run(mf);
And the rest of the code is quite simple.
Suthish NairPosted Jun 10, 2011, 9:11 AM
http://stackoverflow.com/questions/1936415/splash-screen-problems
Prasad GodbolePosted Jun 10, 2011, 7:53 AM
Due to security restrictions from client we can't give complete code but giving you required part of code. Please have a look in below C# and VB.NET version
C# Version
//'We have two projects "PNET" and "PPW"
//'The project "PNET" which contains MainForm (MDI)
//'Following is code for MainForm
private void PSMain_Shown(System.Object sender, System.EventArgs e)
{
// Need to ensure the splash screen is gone
SplashScreen1.Hide();
// Need to first log in our active user
User_login();
}
private void User_login()
{
//'NOTE : Here PPW is another project which contains Login form
//' We have created instance of it and called it here
PPW.Login frmLogin = new PPW.Login();
frmLogin.ShowDialog();
if (frmLogin.LoggedInOkay == true) {
/// If login is valid do some processing
}
}
//'###############################################
//'The code for "PPW" project is as follows
//' This "PPW" project contains "Login" form below is code for it
private void Login_Load(System.Object sender, System.EventArgs e)
{
tbUsername.Focus();
//' This is user name field
}
VB.NET Version
''We have two projects "PNET" and "PPW"
''The project "PNET" which contains MainForm (MDI)
''Following is code for MainForm
Private Sub PSMain_Shown(sender As System.Object, e As System.EventArgs)
' Need to ensure the splash screen is gone
SplashScreen1.Hide()
' Need to first log in our active user
User_login()
End Sub
Private Sub User_login()
''NOTE : Here PPW is another project which contains Login form
'' We have created instance of it and called it here
Dim frmLogin As New PPW.Login()
frmLogin.ShowDialog()
''' If login is valid do some processing
If frmLogin.LoggedInOkay = True Then
End If
End Sub
''###############################################
''The code for "PPW" project is as follows
'' This "PPW" project contains "Login" form below is code for it
Private Sub Login_Load(sender As System.Object, e As System.EventArgs)
tbUsername.Focus()
'' This is user name field
End Sub
Thanks and Regards
Prasad
Suthish NairPosted Jun 10, 2011, 7:07 AM
Prasad GodbolePosted Jun 10, 2011, 6:52 AM
We tried using Activate method but not getting any effect. Focus is not going into "User Name" field . Do we need to make any other changes ??
Thanks and Regards
Prasad
Sam HobbsPosted Jun 9, 2011, 7:45 AM
What you are doing seems reasonable and entirely possible; you just need to add a little bit more (such as activating the window) to get Windows to do what you need done. Unfortunately what many developers do is to try guess at the solution and then when things do not work they ask for help but they don't include information about what they did to try to fix problems and then it is frustrating for everyone.
Prasad GodbolePosted Jun 9, 2011, 7:12 AM
Following functionality we are using and client want to keep it as it is.
Step 1 - User will start the application through program menu.
Step 2 - Splash screen starts appearing.
Step 3 - After some time Splash screen disappears and we are showing MDI form with login window.
Step 4 - Now user should be able to enter User name directly into user name field by using keyboard only .
In our case everything is happening properly up to Step - 3. After Step - 3 the application icon starts blinking on the task bar and due to this we are not getting focus into user name field so that user can directly start typing using keyboard. Due to this problem user is using mouse to get focus into user name field.
So client don't want to use mouse here.
Sure we will try to activate the login window and will let you know how it is working.
Thanks and Regards
Prasad
VulpesPosted Jun 9, 2011, 6:59 AM
Here's an example of use (http://www.pinvoke.net/default.aspx/user32.flashwindowex).
To stop the window from flashing, you will of course need to set fInfo.dwFlags to FLASHW_STOP.
Sam HobbsPosted Jun 9, 2011, 6:39 AM
I am also not sure what you want to happen. Do you want the user to be able to start logging in before the splash screen is done? I think that the important thing is to Activate the login window. Try doing that and let me know if it helps. Also if you need more help then please specify whether the user is to be able to start logging in before the splash screen is done.
Prasad GodbolePosted Jun 9, 2011, 6:17 AM
Just now I have detected the cause of this problem.
Actually when we start the application, first splash screen appears and then a login screen appears and after that task bar starts blinking.
So I removed splash screen and now focus is directly going into user name field and task bar is not blinking.
Now it is detected that the splash screen causing problem but now next question is how to fix this problem by keeping splash screen in the application ?
I have heard about "FlashWindowEx Function" to stop task bar blinking but not sure it is advisable to use.
Thanks and Regards
Prasad
Vilas GitePosted Jun 9, 2011, 5:33 AM
If application run successfully on one machine and another its with problem means there are no problem with your application ok, just find out Machine OS and properties. :)
----------------------------------------------------------------
If this reply solve your post…then "MARK AS ANSWER"!
Prasad GodbolePosted Jun 9, 2011, 4:05 AM
Ok. I am trying reinstallation on our test VMWare image.
But I am not sure it will be possible to reinstall at client end.
Thanks and Regards
Prasad
Vilas GitePosted Jun 9, 2011, 3:29 AM
Reinstall .net framework 2.0 & Windows Installer on that machine.
Prasad GodbolePosted Jun 9, 2011, 2:55 AM
Regarding 1 st point - The icon files are present in the bin folder. When we tried to see what path has been given for icon file in application, we are not getting it. I think when we add icon file in application it embeds it in the application.
We have checked 2 nd and 3 rd point its there.
Its very strange that on other machines its working fine and on 1 m/c application is blinking with orange color at task bar.
Our client don't want this :-(
Thanks and Regards
Prasad
Vilas GitePosted Jun 9, 2011, 2:06 AM
Ensure some things....
i) Are you deploying your application with putting your icon files in bin folder of Project?
ii) Check your machines Screen resolution properties & Color quality..
iii) install .net on that machines..
---------------------------------------------------------------------------
If this reply solve your post…then "MARK AS ANSWER"!