|
Easy. Just do a little math on it. Multiply your number by 100, get the integer of that, then divide that result by 100. Instant 2 decimal truncation. Quick and dirty:
public static double Truncate(double value, double precision)
{
double x = Math.Pow(10, precision);
return (double)((int)(value * x)) / x;
}
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This isn't necessarily a C# question. Any ideas how to prevent PrtScn from doing it's thing?
I know there's a variety of screen capture programs out there, but let's assume for the moment that the client's environment is sufficiently controlled that a third party screen capture app isn't an issue. But we do want to stop the built-in prtscn from working so that an unscrupulous client can't take screen shots of sensitive information.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
i have an idea and i think it may help you
==========================================
you can check all your open ports in your pc and then listen to them all and then refuse the connection request comes from any port this is the idea behind any firewall application i guess so ..............
about the designing of this programmer is very easy to preform
Thank you my brother....
Miss With The Best And Die Like The Rest
|
|
|
|
|
i think he meant printscreen, not portscan... either that or im even more confusticated than i thought .
on the other hand, listening to open ports to stop a a printscreen sounds like an interesting challenge for masochists
|
|
|
|
|
How about a keyboard hook that gets loaded at system startup and swallows all PrintScreen keypresses?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I agree with Kumar. A keyboard hook will let you stop the PrintScreen key from ever reaching the system. I wrote up something similar in C++ a few years back to eat the Windows key.
I also seem to remember hearing somewhere that if you change the Opacity of the form, even to 99%, PrintScreen won't see your form. Try it, see what happens. But the down side to this is that it might not work like this with all video drivers and versions of Windows, especially future versions. Ack! Forget I mentioned it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
i think i wrote meaningful article mr.mav.northwind
but here is my question again :
i need to make the same option in my chat application as the option in subseven (Remote administrattion tool) which you can put some options to configure the server and then you can build it up ? anybody worked with subseven when you open the client file for the first time you have to configure your server and then you push create button and it creates the server for you with the information you entered as Your email address which it will send the ip address of the computer to ...
i need to make the samething in my application any help with that .....
|
|
|
|
|
Is your keyboard broken?
Without meaningful interpunctuation it's hard/impossible to understand what you want.
Try forming full sentences ending in a full stop (.)
That way somebody might be able to understand and help you.
Regards,
mav
|
|
|
|
|
How to drop down an activeX component on the form?
I used to write programs in C++, and in the Visual C++ it is easy to click it on menu "Add ActiveX Component", bud i can't find the same menu in the C# IDE...
|
|
|
|
|
Open up the ToolBox (View->Toolbox). Right click in an empty area and click "Add/Remove Items". Go the COM Components tab. You should see you ActiveX control there. You can then drag and drop the control from the toolbox to a form.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Since you didn't specify which IDE you are using for writing C#, I am going to suppose you are talking about Ms Visual Studio .NET 2003 which is the most common one.
Right-click on the toolbox and click on the "Add/Remove Items" menu item. This should pop-up a dialog with two tabs; the ".NET Framework Components" and the "COM Components". The latter one is the one you are after. Tick the components you want and click on OK. (Note that if they are not listed you can browse for them). Click on OK.
Now you can look for them on your toolbox. They should be on there.
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank you, i used this way, but i thought that it wasn't the right way to insert ActiveX components .
|
|
|
|
|
Well, now you know
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
I set an object to clipboard
then when I get from Clipboard I get null value.
my code is here.
Class1 cls = new Class1();
cls.str = "Test string";
Clipboard.SetDataObject(cls);
IDataObject a;
a = Clipboard.GetDataObject();
Class1 aa=new Class1();
aa = (Class1) a.GetData(cls.GetType());
anyone help me!!!!
thanks in advance.
|
|
|
|
|
the problem here that you cannot set all data to the clipboard. the clipboard cannot handle all types of data. it can only handle data in the formats given in the enum DataFormats.
example:
string str = (String)iData.GetData(DataFormats.Text);
|
|
|
|
|
hello
i need to transfer some information in persian language betwine my client/server program . but when i use the encoding to encode my string to send at the other side i can not resive the true string . Encoding make my string wrong and send it .
i don'thave this problem with english strings.
for sending data i must use an array of bytes and in normal way i can't get the array byte of my string.
thank's for your help :
|
|
|
|
|
hi,i developed mailing software in c# usinf SMTP ,the problem is that when i try to send the mail i receive the exception "Can not access 'CDO.Message' Object", can anyone help me, i will be thankful to you.
|
|
|
|
|
|
thankx 4 sending the link, i think it will help me.
|
|
|
|
|
Is it possible to invoke API function RegisterClass in C#? I need to register a new class, and handle messages for it. How can I do that?
C++ libraries at a give-away price on www.neatcpp.com: TWAIN, DirectShow, Interprocess Communications, etc...
|
|
|
|
|
What exactly do you want to do? If all you want is a message pump, you can call Application.Run() passing the form as a parameter. That'll handle the messages and fire appropriate events in the form for you.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have an app written in VC++ 6, which sends out some data via WM_COPYDATA to all instances of windows created with a specific class name. In order to be able to receive those data in VS.NET i need to have a window created with exactly the same class name. How can I do that?
C++ libraries at a give-away price on www.neatcpp.com: TWAIN, DirectShow, Interprocess Communications, etc...
|
|
|
|
|
You can try deriving your own class from System.Windows.Forms.Form and override WndProc . That way, you'll be able to see all messages sent to the window. But I've no idea how to set the class name.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I knew I could do that much, but the trick i need to do is with API function RegisterWindow. I can import it in without problem, but it takes WNDCLASS structure for initialization, which has one field - pointer to the function that will receive all windows events. And I don't know how to declare and initialize such field correctly. I know that in VB6 you could do that by using keyword "AddressOf" to get address of a function, but i don't know how this works in C#.
C++ libraries at a give-away price on www.neatcpp.com: TWAIN, DirectShow, Interprocess Communications, etc...
|
|
|
|