Click here to Skip to main content
16,007,111 members
Home / Discussions / C#
   

C#

 
GeneralWebRequest.Create method is not thread safe as claimed in MSDN?! Pin
Meysam Mahfouzi12-Jun-04 16:13
Meysam Mahfouzi12-Jun-04 16:13 
GeneralRe: WebRequest.Create method is not thread safe as claimed in MSDN?! Pin
Heath Stewart12-Jun-04 18:18
protectorHeath Stewart12-Jun-04 18:18 
GeneralRe: WebRequest.Create method is not thread safe as claimed in MSDN?! Pin
Meysam Mahfouzi13-Jun-04 1:57
Meysam Mahfouzi13-Jun-04 1:57 
GeneralVertical text in a DataGrid column header Pin
quilkin12-Jun-04 13:11
quilkin12-Jun-04 13:11 
GeneralRe: Vertical text in a DataGrid column header Pin
Heath Stewart12-Jun-04 18:13
protectorHeath Stewart12-Jun-04 18:13 
GeneralToolbar that doesn't steal focus Pin
David M. Kean12-Jun-04 12:54
David M. Kean12-Jun-04 12:54 
QuestionDll? Pin
SherKar12-Jun-04 12:36
SherKar12-Jun-04 12:36 
AnswerRe: Dll? Pin
Heath Stewart12-Jun-04 18:00
protectorHeath Stewart12-Jun-04 18:00 
There's three types of ways to handle Windows messages in .NET:
  1. Override the WndProc method of a control (including Form, which derives from Control). The Message structure contains the necessary information. You can use the Marshal class and the GCHandle structure to assist with marshaling the WPARAM and LPARAM. This is a Window hook.
  2. Implement IMessageFilter and add it to the collection of message pump filters using Application.AddMessageFilter. This is an application hook.
  3. Finally - and you should be very careful and write good, efficient, error-checking code - are global system hooks like WH_CALLWNDPROC. See the article Global System Hooks in .NET[^] for more information
Decide whether you really need a global hook that applies to all Windows though. Using any language, this can decrease the performance and stability of Windows, but using a managed language will definitely decrease performance because of the runtime. In most cases, this is not necessary.

Just today I recommended handling these very notification messages by simply overriding WndProc on a form to prevent it from being moved or resized. This would be the most efficient way and would not affect other applications.

 

Microsoft MVP, Visual C#
My Articles
GeneralAssemblies in .NET Pin
richard nixon12-Jun-04 10:13
richard nixon12-Jun-04 10:13 
GeneralRe: Assemblies in .NET Pin
Heath Stewart12-Jun-04 10:28
protectorHeath Stewart12-Jun-04 10:28 
Generalunhandled exeption in ListView Pin
Aron Henning12-Jun-04 5:23
Aron Henning12-Jun-04 5:23 
GeneralRe: unhandled exeption in ListView Pin
leppie12-Jun-04 5:41
leppie12-Jun-04 5:41 
GeneralCONTROLLING PROCESSES Pin
_Comet_Keeper_12-Jun-04 4:52
_Comet_Keeper_12-Jun-04 4:52 
GeneralRe: CONTROLLING PROCESSES Pin
Heath Stewart12-Jun-04 5:00
protectorHeath Stewart12-Jun-04 5:00 
GeneralRe: CONTROLLING PROCESSES Pin
_Comet_Keeper_12-Jun-04 10:07
_Comet_Keeper_12-Jun-04 10:07 
GeneralRe: CONTROLLING PROCESSES Pin
Heath Stewart12-Jun-04 10:34
protectorHeath Stewart12-Jun-04 10:34 
GeneralBandwidth usage info Pin
Liskl12-Jun-04 2:19
Liskl12-Jun-04 2:19 
GeneralRe: Bandwidth usage info Pin
Heath Stewart12-Jun-04 4:47
protectorHeath Stewart12-Jun-04 4:47 
GeneralNewbish Question on Child/Parent Issues Pin
Anonymous11-Jun-04 23:39
Anonymous11-Jun-04 23:39 
GeneralRe: Newbish Question on Child/Parent Issues Pin
bneacetp12-Jun-04 0:45
bneacetp12-Jun-04 0:45 
GeneralRe: Newbish Question on Child/Parent Issues Pin
Heath Stewart12-Jun-04 5:10
protectorHeath Stewart12-Jun-04 5:10 
GeneralTimeZone problem Pin
Andy *M*11-Jun-04 23:34
Andy *M*11-Jun-04 23:34 
GeneralRe: TimeZone problem Pin
Dave Kreskowiak12-Jun-04 2:08
mveDave Kreskowiak12-Jun-04 2:08 
GeneralRe: TimeZone problem Pin
Andy *M*12-Jun-04 2:58
Andy *M*12-Jun-04 2:58 
GeneralRe: TimeZone problem Pin
Heath Stewart12-Jun-04 5:07
protectorHeath Stewart12-Jun-04 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.