Can someone please tell me why when I check one of my boxes, and click the button I get no message box
in accordance to which checkbox I checked.

#include <windows.h>
#include <dos.h>
#include <stdlib.h>
#include <fstream>
using namespace std;

#define IDC_MAIN_BUTTON 101         // Button identifier
#define IDC_MAIN_EDIT   102         // Edit box identifier


HWND hEdit;
HWND  *ptbox2;
HWND hwnd2;
HWND hwnd1;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

static char *title = TEXT("MVMG NT RESET by: Cody Oebel");

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine, int nCmdShow )
{
  MSG  msg ;
  WNDCLASS wc = {0};
  wc.lpszClassName = TEXT( "PasswordResetTool" );
  wc.hInstance     = hInstance ;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpfnWndProc   = WndProc ;
  wc.hCursor       = LoadCursor(0, IDC_ARROW);


  RegisterClass(&wc);
  CreateWindow( wc.lpszClassName, title,
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                150, 350, 430, 190, 0, 0, hInstance, 0);

  while( GetMessage(&msg, NULL, 0, 0)) {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{

  switch(msg)
  {

      case WM_CREATE:
      {
          // Create an edit box
            hEdit=CreateWindowEx(WS_EX_CLIENTEDGE,
                "EDIT",
                "",
                WS_CHILD|WS_VISIBLE|
                ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL,
                10,
                100,
                300,
                50,
                hwnd,
                (HMENU)IDC_MAIN_EDIT,
                GetModuleHandle(NULL),
                NULL);
            HGDIOBJ hfDefault=GetStockObject(DEFAULT_GUI_FONT);

            SendMessage(hEdit,
                WM_SETFONT,
                (WPARAM)hfDefault,
                MAKELPARAM(FALSE,0));


            SendMessage(hEdit,
                WM_SETTEXT,
                NULL,
                (LPARAM)"Enter users name");

            // Create a push button
            HWND hWndButton=CreateWindowEx(NULL,
                "BUTTON",
                "Reset Password",
                WS_TABSTOP|WS_VISIBLE|
                WS_CHILD|BS_DEFPUSHBUTTON,
                40,
                60,
                290,
                24,
                hwnd,
                (HMENU)IDC_MAIN_BUTTON,
                GetModuleHandle(NULL),
                NULL);
            SendMessage(hWndButton,
                WM_SETFONT,
                (WPARAM)hfDefault,
                MAKELPARAM(FALSE,0));


        HWND hwnd1 = CreateWindow(TEXT("button"), TEXT("Reset Password"),
                     WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                     20, 20, 200, 35,
                     hwnd, (HMENU) 1, ((LPCREATESTRUCT)lParam)->hInstance, NULL);

                  CheckDlgButton(hwnd1, 1, BST_CHECKED);


       HWND hwnd2 = CreateWindow(TEXT("button"), TEXT("Unlock"),
                     WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                     225, 20, 100, 35,
                     hwnd, (HMENU) 1, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
                    //ptbox2 = &hwnd2;   
                   CheckDlgButton(hwnd2, 1, BST_CHECKED);                                  
        break;
      }

  case WM_COMMAND:


            switch(LOWORD(wParam))
{

      case IDC_MAIN_BUTTON:
         {

         BOOL checked = IsDlgButtonChecked(hwnd1, 1);
         BOOL checked2 = IsDlgButtonChecked(hwnd2, 1);
                if(checked)
                {
                        MessageBox(0,
                        "CHECKBOX 1 ",
                        "OOPS",
                        MB_ICONINFORMATION); 

                };

                if(checked2)
                {
                        MessageBox(0,
                        "CHECKBOX 2 ",
                        "OOPS",
                        MB_ICONINFORMATION); 

                };


         };

  };

        break;

      case WM_DESTROY:
      {
           PostQuitMessage(0);
           break;
      }
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}

This looks like it was copy/pasted with some modifications from another coding site.
For the sake of consistency, you should always use CreateWindowEx and the WNDCLASSEX struct as CreateWindow and WNDCLASS are deprecated.
You also need to check function return values and handle any errors.
As for the main problems with this code:
You need to specify identifiers for each checkbox. At present they're both set to (HMENU) 1.
e.g

#define IDC_CHECKBOX1   200
#define IDC_CHECKBOX2   201

CheckDlgButton(hwnd1, 1, BST_CHECKED) needs to be sent to the HWND of your main window with the appropriate identifier. The same goes for BOOL checked = IsDlgButtonChecked(hwnd1, 1) which would be better if it was defined as
BOOL checked = (IsDlgButtonChecked(m_hwnd, IDC_CHECKBOX1) == BST_CHECKED);

Before you enter the message loop at line 37, there should be:

ShowWindow(m_hwnd, nCmdShow);
UpdateWindow(m_hwnd);

Where m_hwnd is the HWND returned from creating the main window.

m_hwnd = CreateWindowEx(...);
if (m_hwnd == NULL)
{
    // handle error and exit
}

If you are coding in C++ then use the appropriate C++ headers rather than the C headers. (Do a google search for cstdlib vs stdlib.h) and only include the headers that you will be using.

Have fun. :)

commented: Deep knowledge +15

Hey Null pointer, thanks buddy. After I build these machines out (imaging). I'm going to take what your telling me here, and apply it. I'm by no means a full time programmer.. just an IT guy with some C programming novice experience trying to shine at this new job praying for permanent hire. Thanks buddy I'll get back on this post in a little and if what you helped me with solves my issue I will mark as solved.

Hope this helps.
Thanks to Ancient Dragon, and Nullptr

#include <windows.h>
#include <dos.h>
#include <stdlib.h>
#include <fstream>
using namespace std;

#define IDC_MAIN_BUTTON 101         // Button identifier
#define IDC_MAIN_EDIT   102         // Edit box identifier
#define IDC_CHECKBOX   103         // Edit box identifier 2
#define IDC_CHECKBOX   104

HWND hEdit;
HWND hEdit2;
//HWND hwnd2;
HWND *hwndPTR;
HWND hwnd2;


LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

static char *title = TEXT("MVMG NT RESET by: Cody Oebel");

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine, int nCmdShow )
{

  MSG  msg ;
  WNDCLASS wc = {0};
  wc.lpszClassName = TEXT( "PasswordResetTool" );
  wc.hInstance     = hInstance ;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpfnWndProc   = WndProc ;
  wc.hCursor       = LoadCursor(0, IDC_ARROW);


  RegisterClass(&wc);
  CreateWindow( wc.lpszClassName, title,
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                300, 375, 350, 250, 0, 0, hInstance, 0);


  while( GetMessage(&msg, NULL, 0, 0)) {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{

  switch(msg)
  {

      case WM_CREATE:
      {



          // Create an edit box
            hEdit=CreateWindowEx(WS_EX_CLIENTEDGE,
                "EDIT",
                "",
                WS_CHILD|WS_VISIBLE|
                ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL,
                10,
                100,
                300,
               30,
                hwnd,
                (HMENU)IDC_MAIN_EDIT,
                GetModuleHandle(NULL),
                NULL);
            HGDIOBJ hfDefault=GetStockObject(DEFAULT_GUI_FONT);

            hEdit2=CreateWindowEx(WS_EX_CLIENTEDGE,
                "EDIT",
                "",
                WS_CHILD|WS_VISIBLE|
                ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL,
                10,
                140,
                300,
                30,
                hwnd,
                (HMENU)IDC_MAIN_EDIT,
                GetModuleHandle(NULL),
                NULL);
                 HGDIOBJ hfDefault2=GetStockObject(DEFAULT_GUI_FONT);



            SendMessage(hEdit,
                WM_SETFONT,
                (WPARAM)hfDefault,
                MAKELPARAM(FALSE,0));


            SendMessage(hEdit,
                WM_SETTEXT,
                NULL,
                (LPARAM)"Enter NT login ID here");

                  SendMessage(hEdit2,
                WM_SETFONT,
                (WPARAM)hfDefault2,
                MAKELPARAM(FALSE,0));

                SendMessage(hEdit2,
                WM_SETTEXT,
                NULL,
                (LPARAM)"If PW reset. Password will be displayed here");


            // Create a push button
            HWND hWndButton=CreateWindowEx(NULL,
                "BUTTON",
                "and... ACTION!!",
                WS_TABSTOP|WS_VISIBLE|
                WS_CHILD|BS_DEFPUSHBUTTON,
                110,
                60,
                100,
                24,
                hwnd,
                (HMENU)IDC_MAIN_BUTTON,
                GetModuleHandle(NULL),
                NULL);

            SendMessage(hWndButton,
                WM_SETFONT,
                (WPARAM)hfDefault,
                MAKELPARAM(FALSE,0));


        CreateWindow(TEXT("button"), TEXT("Reset PW"),
                     WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                     20, 20, 200, 35,
                     hwnd, (HMENU) 103, ((LPCREATESTRUCT)lParam)->hInstance, NULL);

     CreateWindow(TEXT("button"), TEXT("Unlock User"),
                     WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX,
                    230, 20, 125, 35,
                     hwnd, (HMENU) 104, ((LPCREATESTRUCT)lParam)->hInstance, NULL);

                hwndPTR = &hwnd2;

        break;
      }


  case WM_COMMAND:


            switch(LOWORD(wParam))
               {

     case IDC_MAIN_BUTTON:
               {

             BOOL ResetPW = IsDlgButtonChecked(hwnd, 103);
             BOOL UnlockAC = IsDlgButtonChecked(hwnd, 104);


            if(ResetPW)
            {
            SendMessage(hEdit2,WM_SETTEXT,NULL,(LPARAM)"Users new password is: Password123");

                LPWSTR buffer[256];
                SendMessage(hEdit,
                WM_GETTEXT,
                sizeof(buffer)/sizeof(buffer[0]),
                reinterpret_cast<LPARAM>(buffer));

                /*MessageBox(0,
                (LPCSTR)buffer,
                "Information",
                MB_ICONINFORMATION);
                */
                ofstream out;
                out.open("c:\\UserReset.dat");
                out<<(LPCSTR)buffer;
                out.close();
                ifstream in;
                in.open("c:\\UserReset.dat");
                string userid;
                in>>userid;
                in.close();
                string defID = "Enter";
                if(userid == defID)
                {
                MessageBox(0,
                        "You forgot to enter their NT login ID",
                        "WHOOOPS TRY AGAIN",
                        MB_ICONINFORMATION);
                        break;

                };
                string cmd = "/C net user "+userid+" Password123 /domain /active:yes";
                LPCSTR lpcmd = cmd.c_str();
                //system(cmd.c_str());  Need to shellexcute command line invisible here
                ShellExecute(0, "open","cmd.exe",lpcmd, 0, SW_HIDE);
                   MessageBox(0,
                        "Reset users NT PW to: Password123",
                        "Resetting NT Password",
                        MB_ICONINFORMATION);
            //Unlock users account, and reset password to Password123
            break;
             }
            else if(UnlockAC)
            {
                LPWSTR buffer[256];
                SendMessage(hEdit,
                WM_GETTEXT,
                sizeof(buffer)/sizeof(buffer[0]),
                reinterpret_cast<LPARAM>(buffer));

                /*MessageBox(0,
                (LPCSTR)buffer,
                "Information",
                MB_ICONINFORMATION);
                */

                ofstream out;
                out.open("c:\\UserReset.dat");
                out<<(LPCSTR)buffer;
                out.close();
                ifstream in;
                in.open("c:\\UserReset.dat");
                string userid;
                string defID="Enter";
                in>>userid;
                in.close();
                if(userid == defID)
                {
                MessageBox(0,
                        "You forgot to enter their NT login ID",
                        "WHOOOPS TRY AGAIN",
                        MB_ICONINFORMATION);
                        break;

                };
                string cmd = "/C net user "+userid+" /domain "+"/active:yes";
                LPCSTR lpcmd = cmd.c_str();
                //system(cmd.c_str());  Need to shellexcute command line invisible here
                ShellExecute(0, "open","cmd.exe",lpcmd, 0, SW_HIDE);
                 MessageBox(0,
                        "Unlocked User in Active Directory",
                        "Resetting NT Password",
                        MB_ICONINFORMATION);
            //Unlock users account, and reset password to Password123
            break;
            }



        };

  };

        break;

      case WM_DESTROY:
      {
           PostQuitMessage(0);
           break;
      }
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.