Advertisement

09.12.2008 at 11:51AM PDT, ID: 23727419
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

WndProc(ref Message m) - Need help interpreting WndProc() messages which are causing excessive calls to SQL

Asked by John500 in Microsoft Visual C#.Net, C# Programming Language

Tags:

Greetings,

I recently took over a project where the previous developer is gone.  I'm trying to discover why a particlar bug is happening.  Specifically, why an extra seven calls are made to a particular SQL procedure.  In short, the user clicks the OK button to input their status (time & work) which is seen in the following event:

 private void BValidate_Click(object sender, EventArgs e)
{  
        ...
        gone = this.SaveStatus(TBServers.Text);
        ...
}

SaveStatus() calls a stored procedure to push:

private bool SaveStatus(string system)
{
          ...
          s.Push(false);
          ...
}

Push calls a procedure to the database:

public void Push(bool flush)
{
          ...
          this.SaveToSQL(new SqlManager("Database_1"));
          ...
}

The whole thing returns back to WndProc():

protected override void WndProc(ref Message m)
        {
            if (m.Msg == SESSION_CHANGE_MESSAGE)
            {
                if (m.WParam.ToInt32() == SESION_LOCK_PARAM)
                {
                    Console.WriteLine("Session Locked");
                    _SessionLocked = true;
                }
                else if (m.WParam.ToInt32() == SESSION_UNLOCK_PARAM)
                {
                    Console.WriteLine("Session Unlocked");
                    _SessionLocked = false;
                }
            }
            else if (m.Msg == SESSION_QUERY_END)
            {
                _CanExit = true;
            }
            else if (m.Msg == Program.MessageID)
            {
                this.Activate();
                this.Focus();
            }

            base.WndProc(ref m);           //  THIS LINE IS THE ONLY LINE HIT FOR MESSAGE '537'
            return;
        }

I threw some print statements in the code to get a signature on program execution.  Below is the way it looks.  As you can see it also includes the CheckStatus() method which is not directly involved with the procedures above.  This CheckStatus() method is interacting with a queue.  I threw the queue methods at the bottom to provide an idea of what's happening.

I'm just looking for a little input to see what's going on - something, anything!!  

I think the Windows Messaging queue is being utilized in the event systems are down but I don't understand why WndProc() keeps triggering SaveToSQL as the result of CheckStatus()??

Thanks!!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
**********************  Push()  
PushCount: 1
**********************  SaveToSQL()  
Return:  StatusID: 152172  GroupID: 149555
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-354201752-733547374-10437515811126611618
Hash code: -948327932
**********************  SaveToSQL()  
**********************   PopOut(bool force)  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-354202148-733547374-10437515811468324492
Hash code: 200803906
**********************  SaveToSQL()  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-1598071401-733547374-10437515811197482567
Hash code: -2127009094
**********************  SaveToSQL()  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-2095682454-733547374-1043751581-1284966584
Hash code: -1563909521
**********************  SaveToSQL()  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-522918619-733547374-1043751581-40202611
Hash code: -410101924
**********************  SaveToSQL()  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-1733307371-733547374-1043751581-501016020
Hash code: -1336051219
**********************  SaveToSQL()  
**********************  CheckStatus()  
Returning status of: True
**********************  GetHash()  
Hash value: 1414245136-774948317-733547374-10437515811031098386
Hash code: -2083604487
**********************  SaveToSQL()  
 
****************************************************************************************
 
namespace CCObjects.Status2G     // THE CONTROL THAT ACCEPTS USER INPUT
{
    interface IQueueObject
    {
        void Push(bool flush);
        bool CheckStatus();
        int SaveToSQL(SqlManager manager);
        string Hash
        {
            get;
        }
    }
}
 public string Hash
        {
            get
            {
                if (CheckStatus())
                    return Session.GetHash(user_, server_, tstarted_.ToString());
                return null;
            }
        }
 
 public bool CheckStatus()
        {
            if (user_.Length == 0 ||
                ((server_ != null) && server_.Length == 0))
                return false;
            return true;
        }
 
Keywords: WndProc(ref Message m) - Need h…
 
Loading Advertisement...
 
[+][-]09.14.2008 at 01:42PM PDT, ID: 22474217

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 07:06AM PDT, ID: 22478686

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 07:45AM PDT, ID: 22479088

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 08:23AM PDT, ID: 22479552

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 08:41AM PDT, ID: 22479759

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 09:46AM PDT, ID: 22480441

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 02:26PM PDT, ID: 22483089

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.16.2008 at 01:46AM PDT, ID: 22486157

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, C# Programming Language
Tags: VS 2005 C#
Sign Up Now!
Solution Provided By: _Katka_
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.16.2008 at 02:18PM PDT, ID: 22493385

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628