Thread: What's wrong with this winproc please

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    What's wrong with this winproc please

    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
         HDC         hdc ;
         PAINTSTRUCT ps ;
         RECT        rect ;
         
         switch (message)
         {
    
    
    	 case WM_COMMAND:
    		 switch (LOWORD(wParam))
    		 {
    
    			 //case to be changed later this is just for now
    			 case ID_ARCHIVO_NUEVOCLIENTE:
    				//create new window or dialog window	
    				 NuevoClienteWindow = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DIALOG1), hwnd, NuevoCliente);
    				 //we have to show the new window after it has been created
    				 ShowWindow(NuevoClienteWindow, SW_SHOW);
    
    					break;
    		 }
    
         case WM_CREATE:
    		 {
    
    
    		HWND ToolBar;
    
    		ToolBar= CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL);
    
              
              return 0 ;
    		 }
              
         case WM_PAINT:
    		 {
    
              hdc = BeginPaint (hwnd, &ps) ;
              
              GetClientRect (hwnd, &rect) ;
              
              DrawText (hdc, TEXT ("Long Project"), -1, &rect,
                        DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
              
              EndPaint (hwnd, &ps) ;
              return 0 ;
    		 }
    
              
         case WM_DESTROY:
              PostQuitMessage (0) ;
              return 0 ;
         }
         return DefWindowProc (hwnd, message, wParam, lParam) ;
    }

    //###############################//
    ERRORS:

    --------------------Configuration: Project - Win32 Debug--------------------
    Compiling...
    Main.cpp
    D:\Documents and Settings\incognito\My Documents\Project\Project\Main.cpp(133) : error C2143: syntax error : missing ')' before ';'
    D:\Documents and Settings\incognito\My Documents\Project\Project\Main.cpp(133) : error C2660: 'CreateWindowExA' : function does not take 10 parameters
    D:\Documents and Settings\incognito\My Documents\Project\Project\Main.cpp(133) : error C2143: syntax error : missing ';' before ','
    D:\Documents and Settings\incognito\My Documents\Project\Project\Main.cpp(133) : error C2059: syntax error : ')'
    Error executing cl.exe.

    Main.obj - 4 error(s), 0 warning(s)
    Last edited by incognito; 10-05-2003 at 04:35 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    never mind this was the problem


    #define IDC_MAIN_TOOL 102

    I had a ; after it

    I had
    #define IDC_MAIN_TOOL 102;
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Lol. Un poco de español.

  4. #4
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Originally posted by golfinguy4
    Lol. Un poco de español.
    lol yeah.


    yet another problem...........

    Code:
            case WM_CREATE:
    		 {
    
    
    		HWND ToolBar;
    
    		ToolBar= CreateWindowEx(0, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwnd, (HMENU)IDC_MAIN_TOOL, GetModuleHandle(NULL), NULL);
    
    				
    		
    		     // Send the TB_BUTTONSTRUCTSIZE message, which is required for
         // backward compatibility.
    		SendMessage(ToolBar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
    
    		TBBUTTON tbb[1];
    		TBADDBITMAP tbab;
    
    	    tbab.hInst = HINST_COMMCTRL;
            tbab.nID = IDB_STD_SMALL_COLOR;
    
            SendMessage(ToolBar, TB_ADDBITMAP, 0, (LPARAM)&tbab);
    
    		ZeroMemory(tbb, sizeof(tbb));
    		 
    
    		tbb[0].iBitmap = STD_FILENEW;
    		tbb[0].fsState = TBSTATE_ENABLED;
    		tbb[0].fsStyle = TBSTYLE_BUTTON;
    		tbb[0].idCommand = ID_ARCHIVO_NUEVOCLIENTE;
    
    
    		SendMessage(ToolBar, TB_ADDBUTTONS, sizeof(tbb)/sizeof(TBBUTTON), (LPARAM)&tbb);
    
    
              
              return 0 ;
    		 }

    My toolbar is not showing up...........
    Last edited by incognito; 10-05-2003 at 06:24 PM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  5. #5
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Try sending your toolbar a WM_SIZE message when handling the WM_SIZE notification message of your window.

  6. #6
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    This is the error I am getting right after CreateWindowEx()
    #define ERROR_CANNOT_FIND_WND_CLASS 1407L

    //
    // MessageId: ERROR_WINDOW_OF_OTHER_THREAD
    //
    // MessageText:
    //
    // Invalid window; it belongs to other thread.
    //

    I dunnno what to do.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  7. #7
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Are you using Dev-C++? If so, are you linking libcomctl32.a?

  8. #8
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    I was missing this..........

    Code:
    		//******************Ensure that the commom control is loaded***************//
    		INITCOMMONCONTROLSEX icex;
    		icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    		icex.dwICC  = ICC_BAR_CLASSES;
    		InitCommonControlsEx(&icex);
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM