trouble with Form.Activate(); FormSelect(); Form.BringToFront();
-
hi , I created a fullscreen form, setting its topmost prperty to true and provide 2 textboxes in it (for username and password) so i create a lock screen program usin this way. i use a Timer that ticks every 500msec: it causes the form stays on top even if user press ALT-CNTRL-DLT
void aTimer_Tick(object sender, EventArgs e )
{try { this.Activate(); this.Select(); this.BringToFront(); } catch { } }
then i put the address of my program as a startup program, and it will run each time i login but the problem is when i log in!! if i quicly run a program(beform my (Lock)form open) then i can hack the lock screen and it won't come to top,unless i click it! it seems that this.Activate(); this.Select(); this.BringToFront(); doesn't work when first the form is not active! any suggestions?
-
hi , I created a fullscreen form, setting its topmost prperty to true and provide 2 textboxes in it (for username and password) so i create a lock screen program usin this way. i use a Timer that ticks every 500msec: it causes the form stays on top even if user press ALT-CNTRL-DLT
void aTimer_Tick(object sender, EventArgs e )
{try { this.Activate(); this.Select(); this.BringToFront(); } catch { } }
then i put the address of my program as a startup program, and it will run each time i login but the problem is when i log in!! if i quicly run a program(beform my (Lock)form open) then i can hack the lock screen and it won't come to top,unless i click it! it seems that this.Activate(); this.Select(); this.BringToFront(); doesn't work when first the form is not active! any suggestions?
-
Always on top? is it a property? i think it is TopMost property that i have set to true!
Take a look at the SetWindowPos API call. You might also Google 'make form always on top c#'. There are loads of 'solutions' to this problem, some of them might do what you want.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
hi , I created a fullscreen form, setting its topmost prperty to true and provide 2 textboxes in it (for username and password) so i create a lock screen program usin this way. i use a Timer that ticks every 500msec: it causes the form stays on top even if user press ALT-CNTRL-DLT
void aTimer_Tick(object sender, EventArgs e )
{try { this.Activate(); this.Select(); this.BringToFront(); } catch { } }
then i put the address of my program as a startup program, and it will run each time i login but the problem is when i log in!! if i quicly run a program(beform my (Lock)form open) then i can hack the lock screen and it won't come to top,unless i click it! it seems that this.Activate(); this.Select(); this.BringToFront(); doesn't work when first the form is not active! any suggestions?
SetForegroundWindow: makes the specified window the current foreground window and gives it the focus. This function should only be used with windows which your program owns. Of course this function should be used with caution, since the user usually doesn't expect the foreground window to change unexpectedly. The function tells Windows to somehow draw the user's attention to the window, such as by flashing its icon in the taskbar. The function returns 1 if successful, or 0 if an error occured. maybe i should disable the feature of flashing in taskbar?