Click here to Skip to main content
15,899,124 members
Home / Discussions / C#
   

C#

 
QuestionLinq to Sql Pin
siva45529-Sep-11 4:01
siva45529-Sep-11 4:01 
AnswerRe: Linq to Sql Pin
Rob Philpott29-Sep-11 6:33
Rob Philpott29-Sep-11 6:33 
GeneralRe: Linq to Sql Pin
siva45529-Sep-11 16:13
siva45529-Sep-11 16:13 
AnswerRe: Linq to Sql Pin
killabyte29-Sep-11 17:30
killabyte29-Sep-11 17:30 
GeneralRe: Linq to Sql Pin
siva45529-Sep-11 17:55
siva45529-Sep-11 17:55 
GeneralRe: Linq to Sql Pin
killabyte29-Sep-11 20:08
killabyte29-Sep-11 20:08 
GeneralRe: Linq to Sql Pin
siva45530-Sep-11 18:42
siva45530-Sep-11 18:42 
QuestionI don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
fiaolle28-Sep-11 21:15
fiaolle28-Sep-11 21:15 
Hi I have trouble understanding the code that is on this page
http://www.sanity-free.org/13/numeric_text_box_number_only_text_box_control_in_csharp.html.

In PreProcessMessage I don't understand what the inparameter Message msg property WParam holds or Msg holds. When to use them and for what? I have also heard about the property LParam and HWnd, when should I use them. In WndProc we have
the code m.Result = (IntPtr)0. What holds the inparameter Message m's property Result and what is IntPtr? I have seen codes like

C#
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_GETTEXT:
string s = ModifyOriginalText(this.Text);
int charsToCopy = Math.Min(m.WParam.ToInt32(),s.Length);
// return the string
m.LParam = Marshal.StringToHGlobalAuto(s.Substring(0,
charsToCopy));
// result is the number of characters copied
m.Result = new IntPtr(charsToCopy);
return;
}
base.WndProc(ref m);
}


Here they are using the property LParam and here they make a new IntPtr with another amount on int.

I need an accurate explanation when to use Msg, LParam, WParam, Result and for what.

And when we are calling
base.WndProc (ref m);
we want something to happen or what? I mean in the NumericBox example, when it finds not a number it just returns, but why does it have to add (IntPtr)0 to m.Result before. Could they instead have written new IntPtr(0)?

What does the amount to IntPtr tell us?

I know there are many questions, but I so much want to learn this and understand it thoroughly.

Hope you can help me and explain accurate.

Many thanks
Fia
AnswerRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
Richard MacCutchan28-Sep-11 22:39
mveRichard MacCutchan28-Sep-11 22:39 
GeneralRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
fiaolle28-Sep-11 23:57
fiaolle28-Sep-11 23:57 
GeneralRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
Richard MacCutchan29-Sep-11 0:14
mveRichard MacCutchan29-Sep-11 0:14 
GeneralRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
fiaolle29-Sep-11 10:09
fiaolle29-Sep-11 10:09 
GeneralRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
Richard MacCutchan29-Sep-11 21:36
mveRichard MacCutchan29-Sep-11 21:36 
AnswerRe: I don't understand the wndProc, PreProcessMessage and how to use it's inparameter message Pin
BillWoodruff1-Oct-11 18:45
professionalBillWoodruff1-Oct-11 18:45 
QuestionListBox Binding Pin
Samir.Sh28-Sep-11 21:03
Samir.Sh28-Sep-11 21:03 
AnswerRe: ListBox Binding Pin
Dalek Dave28-Sep-11 21:46
professionalDalek Dave28-Sep-11 21:46 
AnswerRe: ListBox Binding Pin
BobJanova28-Sep-11 22:24
BobJanova28-Sep-11 22:24 
Questioncalling all datagridview experts Pin
Tom Paronis28-Sep-11 8:47
Tom Paronis28-Sep-11 8:47 
AnswerRe: calling all datagridview experts Pin
Eddy Vluggen28-Sep-11 9:40
professionalEddy Vluggen28-Sep-11 9:40 
GeneralRe: calling all datagridview experts Pin
Tom Paronis28-Sep-11 11:07
Tom Paronis28-Sep-11 11:07 
AnswerRe: calling all datagridview experts Pin
Luc Pattyn28-Sep-11 11:00
sitebuilderLuc Pattyn28-Sep-11 11:00 
GeneralRe: calling all datagridview experts Pin
BobJanova28-Sep-11 22:30
BobJanova28-Sep-11 22:30 
QuestionHelp Pin
mazroni28-Sep-11 8:34
mazroni28-Sep-11 8:34 
AnswerRe: Help Pin
Eddy Vluggen28-Sep-11 9:46
professionalEddy Vluggen28-Sep-11 9:46 
QuestionOutlook 2007 Add-In Crashes Occasionally Pin
Matt U.28-Sep-11 3:56
Matt U.28-Sep-11 3:56 

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.