• Welcome to Valhalla Legends Archive.
 

Unwanted Beeping

Started by Spilled, February 12, 2006, 09:54 PM

Previous topic - Next topic

Spilled

I read the post a few days back on the unwanted beeping and im getting the same problem. I tried what MyndFyre said but im still getting the beeping...

Here some code:

LRESULT CALLBACK SendProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_KEYDOWN:
{
            if((int)wParam == VK_RETURN)
            {
               
               if(GetWindowTextLength(rtbSend) != 0)
               {
                   char* g = new char[GetWindowTextLength(rtbSend)];                       
                   GetWindowText(rtbSend,g,GetWindowTextLength(rtbSend)+1);
                   buffer pBuffer;
                   pBuffer.InsertNTString(g);
                   pBuffer.SendBNCSPacket(wSock,0x0E);
                   
                   AppendWindowText(rtbChat,"\n");
                   AppendWindowText(rtbChat,"<");
                   AppendWindowText(rtbChat,sUser);
                   AppendWindowText(rtbChat,"> ");
                   AppendWindowText(rtbChat,g);
                   
                   SetWindowText(rtbSend,NULL);
                   
               }
            }
        return 0;     
        }
        break;
    default:                      /* for messages that we don't deal with */
            return CallWindowProc(myProc,hwnd,msg,wParam,lParam);
            //return CallWindowProc(xMainProc,hwnd,msg,wParam,lParam);
     }
     return 0;
}


Even in the WindowProcedure before it gets the Default, I tried this:


        case WM_KEYDOWN:
             {
             return 0;
             }
             break;


Any ideas on why it's still beeping.....?

Joe[x86]

I can almost garantee I'm wrong, but the only thing I can think of is setting (int)wParam != VK_RETURN.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Spilled

I even tried:

switch(message)
{
   case WM_CHAR:
         if((TCHAR)wParam == '\r')
   break;
}


Still beeps, any other ideas?

Zakath

Odd. Hmm...from your code it appears that you used a rich text box and not an edit box for your "send" control. Is this the case?
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Spilled

#4
Well I started off using a rtb but found it was harder to subclass so i switched to an Edit control.


                 rtbSend = CreateWindowEx(WS_EX_CLIENTEDGE,
                           TEXT("EDIT"),
                           TEXT(""),
                           WS_CHILD|WS_VISIBLE|WS_BORDER,
                           10,
                           320,
                           670,
                           20,
                           hwnd,
                           (HMENU)SendBar_ID,
                           myInst,
                           NULL
                           );


Even so, I dont see how there would be a difference? Can you clear this up for me? Thanks in advance

Zakath

I have a subclassed edit control, I capture WM_CHAR, and it doesn't beep at all. I need a bit more context. Where do you make the call that replaces the WndProc for the edit control? I do it in the WM_INITDIALOG for the parent window (if you create the main window using CreateWindowEx you'd be using WM_CREATE instead).
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Spilled

#6
Yes I Subclass the edit control in the main window procedure, Like so:


LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
        case WM_CREATE:
    rtbSend = CreateWindowEx(WS_EX_CLIENTEDGE,
            "EDIT",
            TEXT(""),
            WS_CHILD|WS_VISIBLE|WS_BORDER,
            10,
            320,
            670,
            20,
            hwnd,
            (HMENU)SendBar_ID,
            myInst,
            NULL
            );
                       myProc = (WNDPROC)SetWindowLong(rtbSend,GWL_WNDPROC,(LONG)SendProc);
             break;


Any ideas?

Edit: fixed code tags

shout

I think it has something to do with something being sent to defaultwndproc or w/e.

Spilled

but in the proc I return 0, Like so:


case WM_KEYDOWN:
{
            if((int)wParam == VK_RETURN)
            {
               
               if(GetWindowTextLength(rtbSend) != 0)
               {
                   char* g = new char[GetWindowTextLength(rtbSend)];                       
                   GetWindowText(rtbSend,g,GetWindowTextLength(rtbSend)+1);
                   buffer pBuffer;
                   pBuffer.InsertNTString(g);
                   pBuffer.SendBNCSPacket(wSock,0x0E);
                   
                   AppendWindowText(rtbChat,"\n");
                   AppendWindowText(rtbChat,"<");
                   AppendWindowText(rtbChat,sUser);
                   AppendWindowText(rtbChat,"> ");
                   AppendWindowText(rtbChat,g);
                   
                   SetWindowText(rtbSend,NULL);
                   
               }
            }
        return 0;     
        }
        break;


Am I doing soemthing wrong? Im creating it with CreateWindowEx() so i cant use WM_CHAR.... any other ideas guys?


Spilled

Solved: I wasn't returning 0 on WM_CHAR and WM_KEYUP so that was going to default proc and beeping. Thanks for the help once again guys.