PVA – Archives

Sưu tầm những bài viết hay trên internet…

Tag Archives: .NET

Get/Set Window Text using the WINAPI and C#

From: http://www.dreamincode.net/forums/blog/126/entry-594-getset-window-text-using-the-winapi-and-c%23/ Welcome to this entry on Getting / Setting window text on external applications using the Windows API, in C#. I have recently been playing with the WINAPI functions, and found them quite intriguing, and thought I’d share my experiences with you, as everyone likes a good hax every now and then just to satisfy [...]

Processing Global Mouse and Keyboard Hooks in C#

Download source files [Version 2] – 31.63 KB Download demo application [Version 2] – 6.11 KB Download source files [Version 1] – 12.43 KB Download demo application [Version 1] – 5.58 KB Introduction This class allows you to tap keyboard and mouse and/or to detect their activity even when an application runs in the background [...]

C# Single-Instance Windows Form

From: http://dotnetperls.com/single-instance-windows-form You need to block new instances of your Windows Forms program from running alongside old ones. New instances must focus old ones if they exist, and then exit. Processes that are new should start normally. Here we see a solution to this problem that is adapted from other code on the Internet, written in the [...]

Placing Your C# Application in the System Tray

From: http://www.developer.com/article.php/3336751 There are many cases when it’s advantageous to place an application’s icon in the System Tray. For example, firewall/antivirus and instant messaging applications do this so as to run in the background and still be accessible to the user without crowding up the task bar. In this week’s installment of my .NET Tips and Techniques [...]

Enable wrap and change the color of Listbox items

From: http://blogs.msdn.com/b/rahulso/archive/2007/09/18/enable-wrap-and-change-the-color-in-listbox-items.aspx Problem description> You have a Listbox where you have a lot of items which are quite large and won’t fit inside the width of your listbox. You don’t want to enable Horizontal Scroll bar, since you have don’t want your users to keep scrolling left and right in order to view the items. Now [...]

Bắt sự kiện thoát chương trình

Bạn muốn bắt sự kiện khi người sử dụng nhấp vào button có hình chữ “x” trên form. Để làm được điều này, bạn phải override hàm OnClosing như sau protected virtual void OnClosing ( CancelEventArgs e ) { //… } Xem thêm: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onclosing(v=VS.80).aspx

TCP/IP Chat Application Using C#

This is a LAN chat application with TCP/IP socket programming technology in C#. This application is a multi thread network application and works in a non-blocking way. Public and private chat is also implemented in this code. Download source files – 345 Kb Download demo – 298 Kb

Sử dụng Extension Methods trong .NET >= 3.0

Như các bạn đã biết thì khi ta muốn thêm một method nào đó vào một class thì bạn phải sửa code và biên dịch lại assembly chứa class đó. Rõ ràng điều này chỉ “tạm chấp nhận” khi code đó chính là do bạn tạo ra, do bạn giữ bản quyền chứ không thể [...]

Learning .NET Regular Expressions with Expresso

From: http://www.codeproject.com/kb/dotnet/regextutorial.aspx Did you ever wonder what Regular Expressions are all about and want to gain a basic understanding quickly? My goal is to get you up and running with a basic understanding of regular expressions within 30 minutes. The reality is that regular expressions aren’t as complex as they look. The best way to learn [...]

mẩu .NET

1. Sự khác nhau giữa các lớp Trace và Debug? – Trace dùng để theo dõi các hành động xảy ra. Nó hoạt động trong các đóng gói cả Debug lẫn Release. Trace là khả năng của chương trình tự đưa ra các thông tin về hành động của mình. – Debug dùng để tìm và sửa [...]

Follow

Get every new post delivered to your Inbox.