Thread: new functions in a win32 application

  1. #16
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    here is all of the code, just in case

    Code:
    #include <windows.h>
    #include <stdio.h>
    #include <commctrl.h>
    
    #define  ID_BUTTON1 11
    #define ID_EDIT 1
    #define ID_EDIT2 2
    #define ID_EDIT3 3
    #define ID_EDIT4 4
    #define ID_BUTTON 5
    #define ID_STATIC1 6
    #define ID_STATIC2 7
    #define ID_STATIC3 8
    #define ID_STATIC4 9
    #define ID_STATIC5 10
    
    #define     ID_NEW       1000
    #define     ID_OPEN      1004
    #define     ID_CLOSE     1001
    #define     ID_EXIT      1002
    
    
    
    
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
       
        
        
        char *current;
        
      
      
      int num1 = 1;
      int buff1;
      FILE *pfile;
      FILE *pfile2;
      static HWND hwndlistbox;
      static HWND hwndEdit;
      static HWND hwndEdit2;
      static HWND hwndEdit3;
      static HWND hwndEdit4;
      static HWND hwndButton;
      static HWND hwndStatic;
      static HWND hwndStatic2;
      static HWND hwndStatic3;
      static HWND hwndStatic4;
      static HWND hwndStatic5;
    
      static int len;
      static CHAR text[1000];
      static CHAR text2[1000];
      static CHAR text3[1000];
      static CHAR text4[1000];
      CREATESTRUCT            *cs;
       HMENU                   hMenu, hSubMenu, hSubMenu2;
       char                    szText[64];
       // Menu-item identifiers 
       static   char           szMenuItem[6][10] = {"Open", "Close", "Exit", "New"};
    
      switch(msg)
      {
        case WM_CREATE:
    	/*hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
    				50, 70, 170, 140, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);
    
    	hwndEdit2 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				50, 30, 20, 20, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);
    				
    	hwndEdit3 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				120, 30, 20, 20, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);
                    
        hwndEdit4 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				190, 30, 40, 20, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);  
                    
        hwndStatic = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 1, 300, 20, hwnd, (HMENU) ID_STATIC,
    				NULL, NULL);  
        
        hwndStatic2 = CreateWindow(TEXT("static"), "/", WS_CHILD | WS_VISIBLE,
    				1, 5, 300, 20, hwnd, (HMENU) ID_STATIC,
    				NULL, NULL); 
                                                      			
        hwndStatic3 = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 3, 300, 20, hwnd, (HMENU) ID_STATIC,
    				NULL, NULL); 
    				
    	hwndStatic4 = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 4, 300, 20, hwnd, (HMENU) ID_STATIC,
    				NULL, NULL); 			
    				
    				
    	hwndStatic5 = CreateWindow(TEXT("static"), "", WS_CHILD | WS_VISIBLE,
    				20, 220, 300, 20, hwnd, (HMENU) ID_STATIC,
    				NULL, NULL);		
    				
        hwndButton = CreateWindow(
    		TEXT("button"), TEXT("set title and write to file"),       
    		WS_VISIBLE | WS_CHILD,  
    		30, 240, 200, 25,        
    		hwnd, (HMENU) ID_BUTTON, NULL, NULL);      
    */
    	cs = (LPCREATESTRUCT)lParam;
          hMenu = CreateMenu();
          SetMenu(hwnd, hMenu);
    
          hSubMenu = CreatePopupMenu();
          AppendMenu(hSubMenu, MF_STRING, ID_OPEN, "&Open");
          AppendMenu(hSubMenu, MF_STRING, ID_NEW, "&New");
          AppendMenu(hSubMenu, MF_STRING, ID_CLOSE, "&Close");
          AppendMenu(hSubMenu, MF_STRING, ID_EXIT, "&Exit");
          
          InsertMenu(hMenu, 0, MF_POPUP|MF_BYPOSITION, (UINT_PTR)hSubMenu, "File");
          
          
    
          DrawMenuBar(hwnd);
        
        break;
    
    	case WM_COMMAND:	     
             
            /* case VK_LBUTTON:
                  SetWindowText(hwndStatic5,("done")); 
                  break;
              */    
                  switch(LOWORD(wParam))
          {
          
          
          
          case ID_OPEN :
               
                static HWND hwndlistbox;
        
        char buff1;
        char *current;
        int num1;
        num1 = 1;
        FILE *pfile;
        
                        printf("open");
                        DestroyWindow(hwndEdit2);
                        DestroyWindow(hwndEdit);
                        DestroyWindow(hwndEdit3);
                        DestroyWindow(hwndEdit4);
                        DestroyWindow(hwndStatic);
                        DestroyWindow(hwndStatic2);
                        DestroyWindow(hwndStatic3);
                        DestroyWindow(hwndStatic4);
                        DestroyWindow(hwndStatic5);
                        DestroyWindow(hwndButton);	
         printf("creating");	
       hwndlistbox = CreateWindow(TEXT("LISTBOX"),"",WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_STANDARD,
             0,0,500,500,hwnd,(HMENU) ID_EDIT,
             NULL,NULL);
    			
                	printf("created");
    				 pfile = fopen("C:\\reminder\\data\\backup1.xls","r");
        
       while (buff1 = getc(pfile))
    {
         
        if(buff1 == EOF){
                 printf("end of file");
                 return 0;
                 }
        
            if (num1 != 2 && buff1 == ',')
            {
                printf(" ");
                //SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)"");
                
            }
            else if (num1 != 2 && buff1 == '"'){
                 SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)"");
                
                 }
            else if(buff1 == '¥' && num1 == 2)
            {
                 num1 = 1;
                 SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)"");
                      }
            else if(buff1 == '¥' && num1 == 1)
            {
                 num1 = 2;
                 SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)"");
                 }
            else if(buff1 == 'Ñ'){
                 printf("");
                 }
            else{
                
                printf("%c",buff1);
                // SendMessage(hwndlistbox, LB_ADDSTRING, 0, (LPARAM)buff1);
                 }
            
    }
    
               
          break;
          
        
        
         
          case ID_NEW:{
               hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
    				50, 70, 170, 140, hwnd, (HMENU) ID_EDIT,
    				NULL, NULL);
    
    	hwndEdit2 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				50, 30, 20, 20, hwnd, (HMENU) ID_EDIT2,
    				NULL, NULL);
    				
    	hwndEdit3 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				120, 30, 20, 20, hwnd, (HMENU) ID_EDIT3,
    				NULL, NULL);
                    
        hwndEdit4 = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
    				190, 30, 40, 20, hwnd, (HMENU) ID_EDIT4,
    				NULL, NULL);  
                    
        hwndStatic = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 1, 300, 20, hwnd, (HMENU) ID_STATIC1,
    				NULL, NULL);  
        
        hwndStatic2 = CreateWindow(TEXT("static"), "/", WS_CHILD | WS_VISIBLE,
    				1, 5, 300, 20, hwnd, (HMENU) ID_STATIC2,
    				NULL, NULL); 
                                                      			
        hwndStatic3 = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 3, 300, 20, hwnd, (HMENU) ID_STATIC3,
    				NULL, NULL); 
    				
    	hwndStatic4 = CreateWindow(TEXT("static"), "please insert your date:", WS_CHILD | WS_VISIBLE,
    				1, 4, 300, 20, hwnd, (HMENU) ID_STATIC4,
    				NULL, NULL); 			
    				
    				
    	hwndStatic5 = CreateWindow(TEXT("static"), "", WS_CHILD | WS_VISIBLE,
    				20, 220, 300, 20, hwnd, (HMENU) ID_STATIC5,
    				NULL, NULL);		
    				
        hwndButton = CreateWindow(
    		TEXT("button"), TEXT("set title and write to file"),       
    		WS_VISIBLE | WS_CHILD,  
    		30, 240, 200, 25,        
    		hwnd, (HMENU) ID_BUTTON1, NULL, NULL);                
    				
    	DestroyWindow(hwndlistbox);				
          
          
          }
          break;
          
          
          case ID_CLOSE :
          case ID_EXIT :
             
             sprintf(szText, "You chose %s", szMenuItem[LOWORD(wParam) - 1000]);
             MessageBox(hwnd, szText, "MenuApp", MB_OK);
             break;
          }
          break;
      
      
      
     if(HIWORD(wParam) == BN_CLICKED)
    {
      switch(LOWORD(wParam))
      {
        case ID_BUTTON1://I #defined this above.
          MessageBox(hwnd,"Message box","Title",MB_OK);
          break;
      }
    }
    
                  
                    
                    
                    
    	case WM_DESTROY:
    		MessageBox(hwnd,"are you sure you want to exit?","exit",MB_YESNO);
            PostQuitMessage(0);
    	
        break;
      }
      return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
    			LPSTR lpCmdLine, int nCmdShow )
    {
      MSG  msg ;    
      WNDCLASS wc = {0};
      wc.lpszClassName = TEXT( "Edit Control" );
      wc.hInstance     = hInstance ;
      wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
      wc.lpfnWndProc   = WndProc ;
      wc.hCursor       = LoadCursor(0,IDC_ARROW);
    
      
      RegisterClass(&wc);
      CreateWindow( wc.lpszClassName, TEXT("Edit control"),
                    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                    1000, 420, 280, 350, 0, 0, hInstance, 0);  
    
      while( GetMessage(&msg, NULL, 0, 0)) {
        
        TranslateMessage(&msg);
        DispatchMessage(&msg);
      }
      return (int) msg.wParam;
    }


    and thank you again

  2. #17
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    I had to reformat your code to understand what it was doing.

    Hopefully my code is easier to understand.

    Code:
    //global variables for this window
    HWND g_hwndlistbox=NULL;
    HWND g_hwndEdit=NULL;
    HMENU g_hMenu=NULL;
    
    LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    	switch(msg)
    	{
    		case WM_CREATE:
    			return OnCreate(hWnd);
    		break;
    		case WM_COMMAND:	     
    			switch(LOWORD(wParam))
    			{
    				case ID_OPEN :
    					return OnOpenMenu(hwnd);
    				break;
    				case ID_NEW:
    					return OnNewMenu(hwnd);
    				break;
    				//new code to handle the button msgs
    				case ID_BUTTON1:
    					//what type of event happened to the button?
    					if(HIWORD(wParam) == BN_CLICKED)//it was clicked
    					{
    						return OnButton1Click(hwnd);//call our click handler code
    					}
    					//else let this fall thru to the DefWindowProc handler
    				break;
    			}
    		break;
    		case WM_DESTROY:
    			MessageBox(hwnd,"are you sure you want to exit?","exit",MB_YESNO);//what happens if you click NO?
    			PostQuitMessage(0);
    
    			//TODO code to clean up the edits and listview
    
    		break;
    	}
    	return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    //WM_CREATE
    int OnCreate(HWND hwnd)
    {
    	//create the menu
    	g_hMenu = CreateMenu();
    	SetMenu(hwnd, g_hMenu);
    	HWND hSubMenu = CreatePopupMenu();
    	AppendMenu(hSubMenu, MF_STRING, ID_OPEN, "&Open");
    	AppendMenu(hSubMenu, MF_STRING, ID_NEW, "&New");
    	AppendMenu(hSubMenu, MF_STRING, ID_CLOSE, "&Close");
    	AppendMenu(hSubMenu, MF_STRING, ID_EXIT, "&Exit");
    	InsertMenu(g_hMenu, 0, MF_POPUP|MF_BYPOSITION, (UINT_PTR)hSubMenu, "File");
    	DrawMenuBar(hwnd);
    	//create the edits
    	g_hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
    		50, 70, 170, 140, hwnd, (HMENU) ID_EDIT,
    		NULL, NULL);
    
    	//etc.......
    	//create the LV
    	//why has the listbox got the ID == ID_EDIT?
    	g_hwndlistbox = CreateWindow(TEXT("LISTBOX"),"",WS_CHILD | WS_VISIBLE | WS_BORDER | LBS_STANDARD,0,0,500,500,hwnd,(HMENU) ID_EDIT,NULL,NULL);
    
    	//show we handled the WM_CREATE msg successfully
    	return 0;
    }
    //WM_COMMAND HANDLERS
    //ID_BUTTON1 BN_CLICKED
    int OnButton1Click(HWND hwnd)
    {
    	MessageBox(hwnd,"OnButton1Click","Title",MB_OK);
    	//show we handled the WM_COMMAND msg successfully
    	return 0;
    }
    //ID_NEW menu item
    int OnNewMenu(HWND hwnd)
    {
    	//show all the edits
    	ShowWindow(g_hwndEdit, SW_SHOW); 
    
    	//ect......             
    
    	//hide the listview
    	ShowWindow(g_hwndlistbox, SW_HIDE);		
    	//show we handled the WM_COMMAND msg successfully
    	return 0;
    }
    //ID_OPEN menu item
    int OnOpenMenu(HWND hwnd)
    {
    	printf("open");
    	//hide all the edits
    	ShowWindow(g_hwndEdit, SW_HIDE); 
    	//etc....
    	//show the listview
    	ShowWindow(g_hwndlistbox, SW_SHOW);		
    	printf("creating");	
    
    	//etc....
    
    	//show we handled the WM_COMMAND msg successfully
    	return 0;
    }
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #18
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    (staring in awe and amazement)... Wow ... Thank you very very much. this is much easier to understand. I will try indenting and using functions like this for the rest of my life.

    Thanks again!

  4. #19
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Some things I missed...

    A window created with the WS_CHILD style _should_ be cleaned up automatically when its parent window gets a destroy msg (so you probably do not need to implicitly destroy your edits and LV, not that it will do any harm to clean them up).

    You should remove the WM_VISIBLE style from all the controls you do not want to show up at creation.

    I recommend also...

    ALWAYS init your variables.
    In debug mode the IDE will usually init them hiding the issue. I have seen 1,000's of bugs caused by garbage values in uninitialised variables.

    Learn to take full advantage of the IDE's tools (debugger, error look-up and resource editor).

    Use GetLastError() at this stage it could save you a lot of time.

    Code:
    g_hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE,
    		50, 70, 170, 140, hwnd, (HMENU) ID_EDIT,
    		NULL, NULL);
    if(g_hwndEdit == NULL)//failed to create edit
    {
    	int iError = GetLastError();
    	//msg box error
    	char szBuf[MAX_PATH] ={0};
    	_snprintf(szBuf, MAX_PATH-1,"Failed to created edit1 with error: %d.",iError);
    	MessageBox(hwnd, szBuf, "My App Error!",MB_OK|MB_ICONERROR);
    }
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #20
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    I was reformatting my code so I threw a calender and stuff in there and I found out that my button still does not work

    here is my code, I have followed everything I have seen




    Code:
    #define ID_BUTTON 1
    
    #include <windows.h>
    #include <commctrl.h>
    #include <stdio.h>
    #include <tchar.h>
    
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    void GetSelectedDate(HWND, HWND);
    int OnButton1click(HWND hwnd);
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
      HWND hwnd;
      MSG  msg ;    
      WNDCLASS wc = {0};
      wc.lpszClassName = TEXT("Month Calendar");
      wc.hInstance     = hInstance ;
      wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
      wc.lpfnWndProc   = WndProc ;
      wc.hCursor       = LoadCursor(0,IDC_ARROW);
      
      RegisterClass(&wc);
      hwnd = CreateWindow(wc.lpszClassName, TEXT("Month Calendar"),
                    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                    100, 100, 250, 300, 0, 0, hInstance, 0);  
    
    
      while( GetMessage(&msg, NULL, 0, 0)) {
        DispatchMessage(&msg);
      }
      return (int) msg.wParam;
    }
    
    LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
    {
    
      
      static HWND hwndMonthCal;
      static HWND hwndLabel;
      INITCOMMONCONTROLSEX icex;
      LPNMHDR lpNmHdr;
      static HWND hwndbutton;
    
      switch(msg)  
      {
    	case WM_CREATE:
                
                hwndLabel = CreateWindow("Static","", 
                WS_CHILD | WS_VISIBLE,
                100, 230, 80, 30,
                hwnd, (HMENU)ID_BUTTON, NULL, NULL);
    
                hwndbutton = CreateWindow("Button","save",
                WS_CHILD | WS_VISIBLE,
                10, 230, 80, 30,
                hwnd, (HMENU), NULL, NULL);
    
                icex.dwSize = sizeof(icex);
                icex.dwICC  = ICC_DATE_CLASSES;
                InitCommonControlsEx(&icex);
    
                hwndMonthCal = CreateWindowEx(0, MONTHCAL_CLASS, TEXT(""),          
                            WS_BORDER | WS_CHILD | WS_VISIBLE | MCS_DAYSTATE,  
                            20, 20, 200, 200, hwnd, (HMENU)2, NULL, NULL);
                GetSelectedDate(hwndMonthCal, hwndLabel);
                break;
    
          
            case WM_NOTIFY:
              lpNmHdr = (LPNMHDR) lParam;
            
              if (lpNmHdr->code==MCN_SELECT) {
                  GetSelectedDate(hwndMonthCal, hwndLabel);
              }
              break;
    
          case WM_DESTROY:
              PostQuitMessage(0);
              break; 
          
           
          switch(LOWORD(wParam))
    			{
    				printf("click");
                    case ID_BUTTON:
    					//what type of event happened to the button?
    					printf("click");
                        if(HIWORD(wParam) == BN_CLICKED)//it was clicked
    					{
    					//	return OnButton1click(hwnd);
                          //MessageBox(hwnd,"...hello","hello...",MB_OK);
                            
                            return OnButton1click(hwnd);//call our click handler code
    					}
    					//else let this fall thru to the DefWindowProc handler
    				break;
    			}
          
      
      }
        
          
          
          
          
          
               
          
          
        
      return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    
    
    void GetSelectedDate(HWND hwndMonthCal, HWND hwndLabel)
    {
      int month;
      SYSTEMTIME time;
      TCHAR date[50];
    
      ZeroMemory(&time, sizeof(SYSTEMTIME));
      SendMessage(hwndMonthCal, MCM_GETCURSEL, 0, (LPARAM) &time);
      
      _stprintf(date, _T("%d/%d/%d"), time.wMonth, time.wDay, time.wYear);
      
      
      
      SetWindowText(hwndLabel, date);
    }
    
    int OnButton1click(HWND hwnd)
    {
        
        
        MessageBox(hwnd,"hi","hi",MB_OK);
        return 0;
        }

    HOPE YOU CAN HELP... oops I had caps lock on O_o
    Last edited by xniinja; 07-22-2010 at 03:26 PM.

  6. #21
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You are missing the WM_COMMAND switch.

    That is, the code in red should start with 'case WM_COMMAND:'

    and end with 'break;'

    PS: Formatting the code properly would help to show these missing lines (as you would be able to match a case XXX: to it's closing 'break;')
    Last edited by novacain; 07-22-2010 at 10:01 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #22
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    Wow... I feel stupid

  8. #23
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Opps...I missed....

    The button does not have a value in its HMENU param. It has a cast but you have missed out the 'ID_BUTTON' (so the LOWORD(wParam) can never be ID_BUTTON).



    I would also create a global HINSTANCE variable and capture the HINSTANCE hInstance in WinMain().
    Use this when creating your controls etc (2nd last param in CreateWindow())

    Code:
    int OnButton1click(HWND hwnd);
    HINSTANCE hInst = NULL;
    
    .........
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
          hInst = hInstance;
    
    ..........
    
    
                hwndbutton = CreateWindow("Button","save",
                WS_CHILD | WS_VISIBLE,
                10, 230, 80, 30,
                hwnd, (HMENU)ID_BUTTON, hInst, NULL);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  9. #24
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    Hey um I made a textbox just like this...

    Code:
    hwndEdit = CreateWindow(TEXT("Edit"),NULL,
                WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                250, 20, 200, 200,
                hwnd, (HMENU)ID_EDIT, NULL, NULL);
    but i cant type anything in it. so yea....this happened before, I just don't know how I fixed it...
    But thanks again.
    EDIT:

    sorry forgot code

    Code:
    #define _WIN32_IE 0x0300
    #define ID_BUTTON 1
    #define ID_EDIT 2
    #include <windows.h>
    #include <commctrl.h>
    #include <stdio.h>
    #include <tchar.h>
    HINSTANCE g_hinst;
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    void GetSelectedDate(HWND, HWND);
    int OnButton1click(HWND hwnd);
    int FileCreate(HWND hwnd);
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
      HWND hwnd;
      MSG  msg ;    
      WNDCLASS wc = {0};
      wc.lpszClassName = TEXT("Month Calendar");
      wc.hInstance     = hInstance ;
      wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
      wc.lpfnWndProc   = WndProc ;
      wc.hCursor       = LoadCursor(0,IDC_ARROW);
      
      g_hinst = hInstance;
      
      RegisterClass(&wc);
      hwnd = CreateWindow(wc.lpszClassName, TEXT("Month Calendar"),
                    WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                    100, 100, 520, 300, 0, 0, hInstance, 0);  
    
    
      while( GetMessage(&msg, NULL, 0, 0)) {
        DispatchMessage(&msg);
      }
      return (int) msg.wParam;
    }
    
    LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
    {
      static HWND hwndEdit;
      HWND hwndprgbar;
      static HWND hwndMonthCal;
      static HWND hwndLabel;
      INITCOMMONCONTROLSEX icex;
      LPNMHDR lpNmHdr;
      static HWND hwndbutton;
      
      switch(msg)  
      {
    	case WM_CREATE:
                
                hwndEdit = CreateWindow(TEXT("Edit"),NULL,
                WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                250, 20, 200, 200,
                hwnd, (HMENU)ID_EDIT, NULL, NULL);
            
                hwndLabel = CreateWindow("Static","", 
                WS_CHILD | WS_VISIBLE,
                100, 230, 80, 30,
                hwnd, (HMENU)ID_BUTTON, NULL, NULL);
    
                hwndbutton = CreateWindow("Button","save",
                WS_CHILD | WS_VISIBLE,
                10, 230, 80, 30,
                hwnd, (HMENU)ID_BUTTON, NULL, NULL);
    
                icex.dwSize = sizeof(icex);
                icex.dwICC  = ICC_DATE_CLASSES;
                InitCommonControlsEx(&icex);
    
                hwndMonthCal = CreateWindowEx(0, MONTHCAL_CLASS, TEXT(""),          
                            WS_BORDER | WS_CHILD | WS_VISIBLE | MCS_DAYSTATE,  
                            20, 20, 200, 200, hwnd, (HMENU)2, NULL, NULL);
                GetSelectedDate(hwndMonthCal, hwndLabel);
                break;
    
          
            case WM_NOTIFY:
              lpNmHdr = (LPNMHDR) lParam;
            
              if (lpNmHdr->code==MCN_SELECT) {
                  GetSelectedDate(hwndMonthCal, hwndLabel);
              }
              break;
    
          case WM_DESTROY:
              PostQuitMessage(0);
              break; 
          
           case WM_COMMAND:
          switch(LOWORD(wParam))
    			{
    				
                    case ID_BUTTON:
    					//what type of event happened to the button?
    				
                        if(HIWORD(wParam) == BN_CLICKED)//it was clicked
    					{
    					//	return OnButton1click(hwnd);
                          //MessageBox(hwnd,"...hello","hello...",MB_OK);
                            
                            return OnButton1click(hwnd);//call our click handler code
    					}
    					//else let this fall thru to the DefWindowProc handler
    				break;
    			}
          
     break;
      }
         
          
          
          
          
          
               
          
          
        
      return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    
    
    void GetSelectedDate(HWND hwndMonthCal, HWND hwndLabel)
    {
      FILE *pfile;
      int month;
      SYSTEMTIME time;
      TCHAR date[50];
    
      ZeroMemory(&time, sizeof(SYSTEMTIME));
      SendMessage(hwndMonthCal, MCM_GETCURSEL, 0, (LPARAM) &time);
      
      _stprintf(date, _T("%d/%d/%d"), time.wMonth, time.wDay, time.wYear);
      pfile = fopen("date.txt","a");
      fprintf(pfile,"%d,%d,%d",time.wMonth, time.wDay, time.wYear);
      
      
      SetWindowText(hwndLabel, date);
    }
    
    int OnButton1click(HWND hwnd)
    {
        FILE *pfile;
        
        pfile = fopen("Date.txt","r");
    
        if(pfile == NULL)
        {
                 if(MessageBox(hwnd,"The file for storing dates needs to be made or has been deleted, would you like to make one?","Database",MB_YESNO) == IDYES)
                 {
                                         return FileCreate(hwnd);
                                         
                                         
                                         }
                 
                 else
                 {
                     if(MessageBox(hwnd,"if you dont have this file the program will not be able to store dates\nare you sure you don't want to make a file to store dates?\n(press no to make the file)","DataBase",MB_YESNO) == IDNO)
                     {
                                       return FileCreate(hwnd);
                                       }
                                       
                                       
                                       
                                       else
                                       {
                                           MessageBox(hwnd,"this  program will NOT store dates now.\nIf you ever change your mind just goto \"file\" then \"create file\".","file",MB_OK);
                                           
                                            
                     
                     
                     return 0;
                     }
                 
                 
                 
              
        }
        
        
        
        
        
        }
       
       if(pfile != NULL)
       {
                fclose(pfile);
                pfile = fopen("date.txt","a");
                }
    
    
    
    
    MessageBox(hwnd,"the file would be appended here","append",MB_OK);
    
    
    
    
    
    }
    
    int FileCreate(HWND hwnd)
    {
    FILE *pfile;
        
        pfile = fopen("date.txt","a");
        
        MessageBox(hwnd,"File created","file",MB_OK);
        
        
        
        
    }
    
    
    
    
    
    
    void FileWrite(HWND hwndMonthCal, HWND hwndLabel)
    {
      FILE *pfile;
      int month;
      SYSTEMTIME time;
      TCHAR date[50];
    
      ZeroMemory(&time, sizeof(SYSTEMTIME));
      SendMessage(hwndMonthCal, MCM_GETCURSEL, 0, (LPARAM) &time);
      
      _stprintf(date, _T("last date saved: %d/%d/%d\nFor:"), time.wMonth, time.wDay, time.wYear);
      pfile = fopen("date.txt","a");
      fprintf(pfile,"%d,%d,%d",time.wMonth, time.wDay, time.wYear);
      
      
      SetWindowText(hwndLabel, date);
    }

    Textbox in red
    Last edited by xniinja; 07-27-2010 at 02:15 PM.

  10. #25
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Check the ID numbers you have given the controls (remembering what I told you previously about the restrictions on these ID numbers).

    And add the HINSTANCE as I previously mentioned.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  11. #26
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    May I please ask what does the HINSTANCE actually do

  12. #27
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Two things identify your app from to another apps, the class name and the HINSTANCE.

    Other apps (or multiplie copies of your app running simultaniously) can have the same class name but will have differing HINSTANCES.

    The HINSTANCE + class name combo allows msgs to be routed to the correct app.

    In Win NT using NULL for the HINSTANCE called GetModuleHandle() but I am not sure if this happens in later MS OS's.

    Also disregard the MSDN versions which state that the HINSTANCE is ignored in XP etc, that is an error in the docs.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  13. #28
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    Is this why my text box isn't working? Because it doesn't know which app to go to?.... I don't know.

  14. #29
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    What ID does the textbox have? (2)

    Is there another control (on this window/dlg)with the same ID? (yes)

    Will that cause an issue? (yes)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  15. #30
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    231
    wait....Wheres the other one, didn't I make it like
    Code:
    #define _WIN32_IE 0x0300
    #define ID_BUTTON 1
    #define ID_EDIT 2
    #include <windows.h>
    #include <commctrl.h>
    #include <stdio.h>
    #include <tchar.h>
    Isn't this right or am I missing something

    If you want the updated code to run in your compiler or look over it. Thanks

    Code:
    #define _WIN32_IE 0x0300
    #define ID_BUTTON 1
    #define ID_BUTTONSA 2
    #define ID_BUTTONSB 3
    #define ID_EDIT 4
    #define ID_EDITA 5
    #define ID_LABLE1 6
    #define ID_LABLE2 7
    #define ID_STATIC 8
    
    #define     ID_OPEN        1000
    #define     ID_CLOSE       1001
    #define     ID_EXIT        1002
    #define     ID_CUT         1003
    #define     ID_COPY        1004
    #define     ID_PASTE       1005
    
    #define     ID_1           1006
    #define     ID_2           1007
    #define     ID_3           1008
    
    #include <windows.h>
    #include <commctrl.h>
    #include <stdio.h>
    #include <tchar.h>
    HINSTANCE g_hinst;
    int cals = 3;
    
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    void GetSelectedDate(HWND, HWND, HWND);
    int OnButton1click(HWND hwnd,HWND, HWND, HWND,HWND);
    int FileCreate(HWND hwnd);
    int CalenderSwitch(HWND hwnd,HWND,HWND,HWND,HWND);
    int TextSwitch(HWND hwnd,HWND,HWND,HWND,HWND);
    int FileWrite(HWND hwnd, HWND, HWND,HWND);
    HINSTANCE hInst = NULL;
    
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
      HWND hwnd;
      MSG  msg ;    
      WNDCLASS wc = {0};
      wc.lpszClassName = TEXT("Month Calendar");
      wc.hInstance     = hInstance ;
      wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
      wc.lpfnWndProc   = WndProc ;
      wc.hCursor       = LoadCursor(0,IDC_ARROW);
      
      hInst = hInstance;
      
      g_hinst = hInstance;
      
      RegisterClass(&wc);
      hwnd = CreateWindow(wc.lpszClassName, TEXT("Reminder+"),
                    WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE,
                    100, 100, 500, 350, 0, 0, hInstance, 0);  
    
    
      while( GetMessage(&msg, NULL, 0, 0)) {
        DispatchMessage(&msg);
      }
      return (int) msg.wParam;
    }
    
    LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
    {
     
      static HWND hwnddateStatic;
      static HWND hwnddateEdit;
      static HWND hwndbutton2;
      static HWND hwndbutton3;
      static HWND hwndEdit;
      static HWND hwndMonthCal;
      static HWND hwndLabel;
      INITCOMMONCONTROLSEX icex;
      LPNMHDR lpNmHdr;
      static HWND hwndbutton;
      int calenders;
       CREATESTRUCT            *cs;
       HMENU                   hMenu, hSubMenu, hSubMenu2;
       char                    szText[64];
       static   char           szMenuItem[6][10] = {"Open", "Close", "Exit", "Cut", "Copy", "Paste"};
    
      
      
      
      switch(msg)  
      {
    	case WM_CREATE:
                
                
                cs = (LPCREATESTRUCT)lParam;
          hMenu = CreateMenu();
          SetMenu(hwnd, hMenu);
    
          hSubMenu = CreatePopupMenu();
          AppendMenu(hSubMenu, MF_STRING, ID_OPEN, "&Open");
          AppendMenu(hSubMenu, MF_STRING, ID_CLOSE, "&Close");
          AppendMenu(hSubMenu, MF_STRING, ID_EXIT, "E&xit");
          AppendMenu(hSubMenu, MF_SEPARATOR, 0, NULL);
          InsertMenu(hMenu, 0, MF_POPUP|MF_BYPOSITION, (UINT_PTR)hSubMenu, "File");
          
          hSubMenu2 = CreatePopupMenu();
          AppendMenu(hSubMenu2, MF_STRING, ID_1, "File 1");
          AppendMenu(hSubMenu2, MF_STRING, ID_2, "File 2");
          AppendMenu(hSubMenu2, MF_STRING, ID_3, "File 3");
          InsertMenu(hSubMenu, 5, MF_POPUP|MF_BYPOSITION, (UINT_PTR)hSubMenu2, "Recent &Files");
          DestroyMenu(hSubMenu2);
          DestroyMenu(hSubMenu);
    
          hSubMenu = CreatePopupMenu();
          AppendMenu(hSubMenu, MF_STRING, ID_CUT, "Cut");
          AppendMenu(hSubMenu, MF_STRING, ID_COPY, "Copy");
          AppendMenu(hSubMenu, MF_STRING, ID_PASTE, "Paste");
          InsertMenu(hMenu, 1, MF_POPUP|MF_BYPOSITION, (UINT_PTR)hSubMenu, "Edit");
          DestroyMenu(hSubMenu);
          DestroyMenu(hMenu);
    
          DrawMenuBar(hwnd);
                
                
                hwnddateStatic= CreateWindow(TEXT("Static"),"Date:",
                WS_CHILD | WS_VISIBLE,
                105, 0, 200, 200,
                hwnd, (HMENU)ID_STATIC, hInst, NULL);
                
                hwnddateEdit = CreateWindow(TEXT("Edit"),"Date here",
                WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                145, 0, 100, 18,
                hwnd, (HMENU)ID_EDIT, hInst, NULL);
                
                 ShowWindow(hwnddateEdit,SW_SHOW);
    
                
                hwndEdit = CreateWindow(TEXT("Edit"),"I am ze terminator",
                WS_CHILD | WS_VISIBLE | ES_MULTILINE,
                250, 20, 200, 200,
                hwnd, (HMENU)ID_EDIT, hInst, NULL);
                
                ShowWindow(hwndEdit,SW_SHOWNORMAL);
                
                hwndbutton = CreateWindow("Button","hide",
                WS_CHILD | WS_VISIBLE,
                20, 0, 80, 20,
                hwnd, (HMENU)ID_BUTTONSA, NULL, NULL);
                
                ShowWindow(hwndbutton,SW_HIDE);
                
                hwndbutton2 = CreateWindow("Button","Calendar",
                WS_CHILD | WS_VISIBLE,
                20, 0, 80, 20,
                hwnd, (HMENU)ID_BUTTONSB, NULL, NULL);
                ShowWindow(hwndbutton2,SW_SHOW);
                
                hwndLabel = CreateWindow("Static","loading...", 
                WS_CHILD | WS_VISIBLE ,
                100, 230, 500, 500,
                hwnd, (HMENU)ID_LABLE1, NULL, NULL);
    
                hwndbutton3 = CreateWindow("Button","save",
                WS_CHILD | WS_VISIBLE,
                10, 230, 80, 30,
                hwnd, (HMENU)ID_BUTTON, NULL, NULL);
    
                icex.dwSize = sizeof(icex);
                icex.dwICC  = ICC_DATE_CLASSES;
                InitCommonControlsEx(&icex);
    
                hwndMonthCal = CreateWindowEx(0, MONTHCAL_CLASS, TEXT(""),          
                            WS_BORDER | WS_CHILD | WS_VISIBLE | MCS_DAYSTATE,  
                            20, 20, 200, 200, hwnd, (HMENU)2, NULL, NULL);
                GetSelectedDate(hwndMonthCal, hwndLabel, hwnddateEdit);
                ShowWindow(hwndMonthCal,SW_HIDE);
                
                
                
                
                
                
                
                break;
    
          
            case WM_NOTIFY:
              lpNmHdr = (LPNMHDR) lParam;
            
              if (lpNmHdr->code==MCN_SELECT) {
                  GetSelectedDate(hwndMonthCal, hwndLabel, hwnddateEdit);
                  return CalenderSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
              }
              break;
    
          case WM_DESTROY:
              PostQuitMessage(0);
              break; 
          
           case WM_COMMAND:
          switch(LOWORD(wParam))
    			{
    				
                    case ID_BUTTON:
    					//what type of event happened to the button?
    				
                        if(HIWORD(wParam) == BN_CLICKED)//it was clicked
    					{
    					//	return OnButton1click(hwnd);
                          //MessageBox(hwnd,"...hello","hello...",MB_OK);
                            
                            return OnButton1click(hwnd,hwndMonthCal, hwndLabel, hwndEdit, hwnddateEdit);//call our click handler code
    					}
    					//else let this fall thru to the DefWindowProc handler
    				break;
    			
                    case ID_BUTTONSA:
                         
                         if(HIWORD(wParam) == BN_CLICKED)
                         {
                                           if(cals == 1){
                                                        
                                             return CalenderSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                             
                                             
                                             
                                             }
                                              
                                              else if(cals == 3)
                                           {
                                                 return TextSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                                 
                                                 }
                                              
                                                        
                                           else
                                           {
                                               
                                               return TextSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                               SetFocus(hwndMonthCal);
                                               }              
                                           
                                           
                         }
                         break;
                case ID_BUTTONSB:
                         
                         if(HIWORD(wParam) == BN_CLICKED)
                         {
                                           if(cals == 1){
                                                        
                                             return CalenderSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                             
                                             }
                                                        
                                           else if(cals == 3)
                                           {
                                                 return TextSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                                 
                                                 }
                                           
                                           else
                                           {
                                               SetFocus(hwndMonthCal);
                                               return TextSwitch(hwnd,hwndMonthCal,hwnddateEdit,hwndbutton,hwndbutton2);
                                               }              
                                           
                                           
                         }
                         break;
                
                
          
          
          
     break;
      }
         
          
          
          }
          
          
               
          
          
        
      return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    
    
    void GetSelectedDate(HWND hwndMonthCal, HWND hwndLabel, HWND hwnddateEdit)
    {
      
      int month;
      SYSTEMTIME time;
      TCHAR date[50];
    
      ZeroMemory(&time, sizeof(SYSTEMTIME));
      SendMessage(hwndMonthCal, MCM_GETCURSEL, 0, (LPARAM) &time);
      
      _stprintf(date, _T("%d/%d/%d"), time.wMonth, time.wDay, time.wYear);
      
      
      
      SetWindowText(hwnddateEdit,date);
      SetWindowText(hwndLabel, date);
    }
    
    int OnButton1click(HWND hwnd,HWND hwndMonthCal, HWND hwndLabel, HWND hwndEdit,HWND hwnddateEdit)
    {
        FILE *pfile;
        
        pfile = fopen("Date.txt","r");
    
        if(pfile == NULL)
        {
                 if(MessageBox(hwnd,"The file for storing dates needs to be made or has been deleted, would you like to make one?","Database",MB_YESNO) == IDYES)
                 {
                                         return FileCreate(hwnd);
                                         
                                         
                                         }
                 
                 else
                 {
                     if(MessageBox(hwnd,"if you dont have this file the program will not be able to store dates\nare you sure you don't want to make a file to store dates?\n(press no to make the file)","DataBase",MB_YESNO) == IDNO)
                     {
                                       return FileCreate(hwnd);
                                       }
                                       
                                       
                                       
                                       else
                                       {
                                           MessageBox(hwnd,"this  program will NOT store dates now.\nIf you ever change your mind just goto \"file\" then \"create file\".","file",MB_OK);
                                           
                                            
                     
                     
                     return 0;
                     }
                 
                 
                 
              
        }
        
        
        
        
        
        }
       
       if(pfile != NULL)
       {
                fclose(pfile);
                
                }
    
    
    
    
    return FileWrite(hwndMonthCal, hwndLabel, hwndEdit,hwnddateEdit);
    
    
    
    
    
    }
    
    int FileCreate(HWND hwnd)
    {
    FILE *pfile;
        
        pfile = fopen("date.txt","a");
        
        MessageBox(hwnd,"File created","file",MB_OK);
        
        
        
        
    }
    
    
    
    
    
    
    int FileWrite(HWND hwndMonthCal, HWND hwndLabel, HWND hwndEdit, HWND hwnddateEdit)
    {
      FILE *pfile;
      int month;
      SYSTEMTIME time;
      TCHAR date[50];
      TCHAR dateedit[1000];
      TCHAR Edit[1000];
    
      ZeroMemory(&time, sizeof(SYSTEMTIME));
      SendMessage(hwndMonthCal, MCM_GETCURSEL, 0, (LPARAM) &time);
      GetWindowText(hwnddateEdit,dateedit,1000);
      GetWindowText(hwndEdit,Edit,1000);
      //_stprintf(date, _T("last date saved: %d/%d/%d\nFor:%s"), time.wMonth, time.wDay, time.wYear,Edit);
      _stprintf(date, _T("last date saved: %s\nFor:%s"), dateedit,Edit);
      pfile = fopen("date.txt","a");
      
      fprintf(pfile,"%d/%d/%d...%s\n",time.wMonth, time.wDay, time.wYear,Edit);
      fclose(pfile);
      
      SetWindowText(hwndLabel, date);
    }
    
    
    int CalenderSwitch(HWND hwnd,HWND hwndMonthCal,HWND hwnddateEdit,HWND hwndbutton,HWND hwndbutton2)
    {
        cals = 2;
        ShowWindow(hwndbutton,SW_HIDE);
        ShowWindow(hwndbutton2,SW_SHOW);
        ShowWindow(hwndMonthCal,SW_HIDE);
        ShowWindow(hwnddateEdit,SW_SHOW);
        
        
        }
    
    int TextSwitch(HWND hwnd,HWND hwndMonthCal,HWND hwnddateEdit,HWND hwndbutton,HWND hwndbutton2)
    {
        cals = 1;
        ShowWindow(hwndbutton,SW_SHOW);
        ShowWindow(hwndbutton2,SW_HIDE);
        ShowWindow(hwndMonthCal,SW_SHOW);
        
        
        
    }

    Thanks again!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array of functions
    By frktons in forum C Programming
    Replies: 29
    Last Post: 06-30-2010, 09:51 AM
  2. First time Creating Win32 application with UI
    By chiefmonkey in forum Windows Programming
    Replies: 9
    Last Post: 09-23-2009, 11:44 AM
  3. Replies: 6
    Last Post: 05-15-2007, 10:47 PM
  4. Painting with Tex on a Win32 Application
    By webzest in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2004, 03:04 PM
  5. Can I Load A Sound or Music Into My Win32 Application ?
    By SonicWave in forum Windows Programming
    Replies: 8
    Last Post: 09-21-2001, 07:54 AM