CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006
    Posts
    6

    Question putting a button on a window

    ok i have been learning the code for making a window in openGL and i finally got it down. so for the past like 30 minutes ive been looking for a tut on how to include a button into the window so when it is clicked, it can either be a link or open something.. does ne one know where i can get a tut of this or maybe post some code here to explain it 4 me.. thx

  2. #2
    Join Date
    Sep 2006
    Posts
    17

    Re: putting a button on a window

    Code:
    switch (uMsg)						
    
    			// Check For Windows Messages
    	{
    		
    	case WM_CREATE :
                   hdc = GetDC (hWnd) ;
                   SelectObject (hdc, GetStockObject 
    
    (SYSTEM_FIXED_FONT)) ;
                   GetTextMetrics (hdc, &tm) ;
                   cxChar = tm.tmAveCharWidth ;
                   cyChar = tm.tmHeight + tm.tmExternalLeading ;
                   ReleaseDC (hWnd, hdc) ;
    
                 // create button
                        hwndButton = CreateWindow ("button", "PUSHBUTTON",
                                  WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                  cxChar, cyChar ,
                                  20 * cxChar, 7 * cyChar / 4,
                                  hWnd, (HMENU) 0,
                                  ((LPCREATESTRUCT) lParam) -> hInstance, NULL) ;
                   return 0 ;
    
    
    case WM_COMMAND :
                   
    // Action
    			
    break;
    Picture in attach

    It what is necessary?
    Attached Images Attached Images  

  3. #3
    Join Date
    Oct 2005
    Posts
    166

    Re: putting a button on a window

    This is good but is a eye-killer, draw a button with PaintShop and use that texture as button, it's better.

  4. #4
    Join Date
    Sep 2006
    Posts
    17

    Re: putting a button on a window

    but is a eye-killer
    О.. yes.

    But it is very simple..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured