|
A client recently asked me if I could make a porgram that would have a fairly simple functionality, but with a catch.
When the program is running he wants it to be the only program available. So a user couldn't alt tab and go to another program or minimize the program and open up a web broswer. To get out might require the user to hit escape and type in a password.
I call it "Locking" but maybe there's already a phrase for this type of functionality. Is there?
Drathmar
|
|
|
|
|
The program could make itself topmost, I guess. It could also grab the input focus whenever it loses it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This could be done, but it is better left to Group Policy to do this. There are LOTS of ways to get around this "lock", and your app won't be able to cover them all.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
When you say to leave it to Group Policy? I don't exactly follow, how would you do this with "Group Policy"?
|
|
|
|
|
Pick up the Windows XP Resource Kit and you'll find out. It's covered in about half of the book. But, to give you a quick look-see, click Start, Run, then type gpedit.msc and Hit enter.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dear gurus
I have a question to generics at the following code
<br />
class ABC <br />
{<br />
<br />
void fkt<T>(T x) {<br />
double y = (double)x; <br />
}<br />
<br />
}<br />
I get the errormessage: Cannot convert Type 'T' to 'double'.
This is absolutely clear ( the compiler does not know if the conversion is possible and therefore it provides this errormessage ).
My Question is:
In my application T is either 'Int32' or 'Double'. How can I convince the compiler to compile this code for my issues (int32 and double where conversion is in fact possible)?
With kind regards
|
|
|
|
|
You have to specify a constraint that says T is is convertable to a double otherwise there is no way to know if X can be converted to a double.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi Ray,
thanks for your answer ! ! !
How must I write the code to constrain it to "int32" and "double"?
Best whiches
-- modified at 17:38 Wednesday 16th August, 2006
|
|
|
|
|
Sorry I forgot the important part:
private void Test<t>(T q) where T : IConvertible{
double x = q.ToDouble(null);
}
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Wow ! ! ! ! !
I just want to say "Thank you".
This helps me very much.
With very very very kind regards.
ups: somuch very's
|
|
|
|
|
What out for strings. If you want to be really robust you will have to make a class that can take implicitly convert from doubles and ints instead of convertible.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Nice guy !
At the moment, basic numeric types as int, double, char .... are ok.
Currently I dont need any strings.
I whish you a nice day !
From which country are you coming? I'm living in Germany
|
|
|
|
|
Sorry dear guru.
Midnight has passed here and I have my next problem.
May be I get some help before I go to bed soon
class XYZ {
void fct_1<T>(T x) where T : IConvertible {
double y = x.ToDouble(null);
}
void fct_2<T>(T x, T y) where T : IComparable {
if ( x < y ) {
// some action here
}
}
}
Function fct_1() works well now (thanks for your help)
But function fct_2 makes trouble now
The compiler says now: "operand '<' cannot be applied to operands of type 'T'"
Even if I restriected to 'Icomparable'
Do you have any hints for me?
Thanks in advance
|
|
|
|
|
I think the following should work:
void fct_2<T>(T x, T y) where T : IComparable
{
if (x.CompareTo(y) < 0)
{
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I'm voiceless.
this also works
I think you joined the microsoft generic development party )
Again: Thank you very very much.
Now I will go to bed
|
|
|
|
|
My pleasure!
Have a good night
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello,
I am using remoting in my C# 2005 server-client implementation.
In my server channel sink implementation (in ProcessMessage()), I need to (selectively) make sure that the call to "requestMsg.Properties["__MethodName"]" method is not carried out on the server.
Ideally, I want the server to remain oblivious that the client has even attempted to call that method, yet for the called method to return "false" on the client side (if at all possible).
So far all of my attempts resulted in exceptions thrown on the client side... Any suggestions, please?
Thank you,
Victoria
|
|
|
|
|
Is it possible to use a variable to update the properties of a button? For example I have a button on my app named One is the following possible if so how do I accomplish this?
string Button = "One";
Button.Visible = true
|
|
|
|
|
I can't get the issue.can you be more specific ?
if Button is a string it does not have a Visible property and if it's a button then Button="One"; is not valid.
|
|
|
|
|
Exactly, I want to be able to assign the name of my button to a variable and then use the varible instead of the button name to adjust the button properties. I do not know if it is possible, honestly I don't believe it is but I just wanted to check here before I gave up on it.
|
|
|
|
|
You can do it using reflection.(but if you can do something explicitly , Reflection is not a good alternative)
<br />
using System.Relflection;<br />
.<br />
.<br />
.<br />
Button button=new Button();<br />
string buttonKey="button";<br />
.<br />
.<br />
.<br />
<br />
PropertyInfo visibleProp=this.Controls[buttonKey].GetType().GetProperty("Visible");<br />
visibleProp.SetValue(this.Contorls[buttonKey],true);<br />
|
|
|
|
|
You already have a variable associated with your Control/Button. The designer will do this for you.
Just look for the name in the designer.
You can then use it like any normal variable:
<br />
mybutton.Text = "Something";<br />
mybutton.Visible = false;<br />
<code><br />
<br />
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have a DLL that was created with VB.NET and works just great with VB.NET
Windows apps. When I try to use the same DLL in a C# Windows app problems occur.
I have a simple C# Windows form test application and have added a reference to the DLL in question.
As soon as I create an instance of the DLL the form looses focus and when I close the form the program remains running and has to be ended from Task Manager.
Does any one have a clue as to what is going on here?
Jim Onwiler
|
|
|
|
|
Are you using any kind of unmanaged code in your VB.Net app.
(any API call or COM components ?)
Is there any kind of loop in your vb.net dll?
Any hardware resources is needed?
Can you debug your program?
|
|
|
|
|
There are COM components.
I ave not tried to run debug.
|
|
|
|