// ReverSys.cpp : Defines the entry point for the application. // #define INIT_STRING(s) { wcscpy(s, L"\0"); } #define INIT_VALUE(v) { v = 0; } #define READ_STRING(s, str) { fgetws(s, 64, str); s[wcslen(s)-1] = L'\0'; } #define READ_STRING128(s, str) { fgetws(s, 128, str); s[wcslen(s)-1] = L'\0'; } void DRAWIC(WPARAM wParam, LPARAM lParam, UINT id, UINT icon); BOOL GetRequest(int iorderid, RSRequest tempr); #include "stdafx.h" #include "ReverSys.h" #include "RSUser.h" #include "RSBuyer.h" #include "RSSeller.h" #include "RSRequest.h" #include "RSBid.h" #include #include #include #include #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // The current instance HWND hwndCB; // The command bar handle // Our Global Variables RSUser* g_User; // global user pointer RSUser* user = NULL; RSBuyer* buyer = NULL; RSSeller* seller = NULL; RSRequest request; int g_iSelectedRequest = -1; void DRAWIC(HWND hDlg, WPARAM wParam, LPARAM lParam, UINT id, UINT icon, TCHAR* szText) { if(wParam == id) { RECT rt; DRAWITEMSTRUCT* sDrawStuff; HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(icon)); sDrawStuff = (LPDRAWITEMSTRUCT) lParam; DrawIcon(sDrawStuff->hDC, 0, 0, hIcon); if(szText != NULL) { GetClientRect(GetDlgItem(hDlg, id), &rt); SetBkMode(sDrawStuff->hDC, TRANSPARENT); DrawText(sDrawStuff->hDC, szText, wcslen(szText), &rt, (DT_BOTTOM | DT_NOCLIP)); } } } static SHACTIVATEINFO s_sai; BOOL bForceSPIResize = TRUE; // login dialog procedure LRESULT CALLBACK LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); // role selection dialog procedure LRESULT CALLBACK RoleDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); // BUYER MENU procedure LRESULT CALLBACK BuyerMenuDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); // BUYER MENU -- PROFILE DIALOG LRESULT CALLBACK BuyerProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Step1_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Step2_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Step3_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Step4_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Step5_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ViewRequests_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK SellerMenuDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK SellerProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK CheckRequests_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK BidDlg_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ViewBids_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ViewOffers_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); // Forward declarations of functions included in this code module: ATOM MyRegisterClass (HINSTANCE, LPTSTR); BOOL InitInstance (HINSTANCE, int); LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM); HWND CreateRpCommandBar(HWND); // Message Procedure Handlers int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; HACCEL hAccelTable; // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_REVERSYS); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // // FUNCTION: MyRegisterClass() // // PURPOSE: Registers the window class. // // COMMENTS: // // It is important to call this function so that the application // will get 'well formed' small icons associated with it. // ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) { WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC) WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REVERSYS)); wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = szWindowClass; return RegisterClass(&wc); } // // FUNCTION: InitInstance(HANDLE, int) // // PURPOSE: Saves instance handle and creates main window // // COMMENTS: // // In this function, we save the instance handle in a global variable and // create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd = NULL; TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The window class name hInst = hInstance; // Store instance handle in our global variable // Initialize global strings LoadString(hInstance, IDC_REVERSYS, szWindowClass, MAX_LOADSTRING); LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); //If it is already running, then focus on the window hWnd = FindWindow(szWindowClass, szTitle); if (hWnd) { SetForegroundWindow ((HWND) (((DWORD)hWnd) | 0x01)); return 0; } MyRegisterClass(hInstance, szWindowClass); RECT rect; GetClientRect(hWnd, &rect); hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if (!hWnd) { return FALSE; } //When the main window is created using CW_USEDEFAULT the height of the menubar (if one // is created is not taken into account). So we resize the window after creating it // if a menubar is present { RECT rc; GetWindowRect(hWnd, &rc); rc.bottom -= MENU_HEIGHT; if (hwndCB) MoveWindow(hWnd, rc.left, rc.top, rc.right, rc.bottom, FALSE); } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return TRUE; } // // FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // // PURPOSE: Processes messages for the main window. // // WM_COMMAND - process the application menu // WM_PAINT - Paint the main window // WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; HBITMAP hBitmap; HDC BitmapDC; int wmId, wmEvent; PAINTSTRUCT ps; RECT rt; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: switch (wmId) { case IDM_USER_LOGIN: DialogBox(hInst, (LPCTSTR)IDD_LOGIN, hWnd, (DLGPROC)LoginDlgProc); break; case IDM_USER_ROLE: if(g_User->IsActive()) { DialogBox(hInst, (LPCTSTR)IDD_ROLE, hWnd, (DLGPROC)RoleDlgProc); } else { MessageBox(hWnd, L"Please login to access the system", L"Error", MB_OK); } break; case IDM_MENU_BUYER: { DialogBox(hInst, (LPCTSTR)IDD_BUYER_MENU, hWnd, (DLGPROC)BuyerMenuDlgProc); break; } case IDM_MENU_SELLER: { DialogBox(hInst, (LPCTSTR)IDD_SELLER_MENU, hWnd, (DLGPROC)SellerMenuDlgProc); break; } default: return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_LBUTTONDOWN: { DialogBox(hInst, (LPCTSTR)IDD_LOGIN, hWnd, (DLGPROC)LoginDlgProc); return 0; break; } case WM_CREATE: { user = new RSUser; g_User = user; hwndCB = CreateRpCommandBar(hWnd); break; } case WM_PAINT: { hdc = BeginPaint(hWnd, &ps); hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_SPLASHSCREEN)); BitmapDC = CreateCompatibleDC(NULL); SelectObject(BitmapDC, hBitmap); GetClientRect(hWnd, &rt); BitBlt(hdc, (rt.right - 192) / 2, (rt.bottom - 192) / 2, 192, 192, BitmapDC, 0, 0, SRCCOPY); DeleteObject(hBitmap); DeleteDC(BitmapDC); EndPaint(hWnd, &ps); break; } case WM_DESTROY: CommandBar_Destroy(hwndCB); PostQuitMessage(0); break; case WM_SETTINGCHANGE: SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } HWND CreateRpCommandBar(HWND hwnd) { SHMENUBARINFO mbi; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hwnd; mbi.nToolBarId = IDM_MENU; mbi.hInstRes = hInst; mbi.nBmpId = 0; mbi.cBmpImages = 0; if (!SHCreateMenuBar(&mbi)) return NULL; return mbi.hwndMB; } // Login Dialog Procedure LRESULT CALLBACK LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { SHACTIVATEINFO sai; switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDOK, IDI_BUTT_OK, L"Login\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, L"Cancel\0"); break; } case WM_SETTINGCHANGE: { if (SPI_SETSIPINFO == wParam) { memset(&sai, 0, sizeof(SHACTIVATEINFO)); SHHandleWMSettingChange(hDlg, (bForceSPIResize ? -1 : wParam), (bForceSPIResize ? 0 : lParam), &sai); break; } } case WM_ACTIVATE: { if (SPI_SETSIPINFO == wParam) { memset(&sai, 0, sizeof(SHACTIVATEINFO)); SHHandleWMActivate(hDlg, wParam, lParam, &sai, 0); break; } } case WM_INITDIALOG: { SetFocus(GetDlgItem(hDlg, IDC_USERNAME)); break; } case WM_COMMAND: { if (LOWORD(wParam) == IDOK) { // temp for holding username/password TCHAR szReadUsername[64]; TCHAR szReadPassword[64]; GetWindowText(GetDlgItem(hDlg, IDC_USERNAME), szReadUsername, 64); GetWindowText(GetDlgItem(hDlg, IDC_PASSWORD), szReadPassword, 64); g_User->UserLogin(szReadUsername, szReadPassword); if( g_User->IsActive() ) { EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_USER_ROLE,0), 0); return TRUE; } else { MessageBox(hDlg, L"Invalid Login", L"Login", MB_OK); return TRUE; } } if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); } return TRUE; } default: { return FALSE; } } return FALSE; } // Role dialog procedure LRESULT CALLBACK RoleDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { //HDC hdc; //PAINTSTRUCT ps; switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_ROLE_BUYER, IDI_ROLE_BUYER, L"Buyer\0"); DRAWIC(hDlg, wParam, lParam, IDC_ROLE_SELLER, IDI_ROLE_SELLER, L"Seller\0"); return TRUE; } case WM_COMMAND: { // user selected to be a buyer if(LOWORD(wParam) == IDC_ROLE_BUYER) { if(buyer != NULL) { delete buyer; buyer = NULL; } buyer = new RSBuyer(*user); g_User = buyer; if( ((RSBuyer*)g_User)->IsActive() ) { PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_MENU_BUYER,0), 0); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } else { MessageBox(hDlg, L"No profile exists, please create one now.", L"msg", MB_OK); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_MENU_BUYER,0), 0); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } } // user selected to be a seller if(LOWORD(wParam) == IDC_ROLE_SELLER) { if(seller != NULL) { delete seller; seller = NULL; } seller = new RSSeller(*user); g_User = seller; if( ((RSSeller*)g_User)->IsActive() ) { PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_MENU_SELLER,0), 0); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } else { MessageBox(hDlg, L"No profile exists, please create one now.", L"msg", MB_OK); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_MENU_SELLER,0), 0); EndDialog(hDlg, LOWORD(wParam)); return TRUE; } } return TRUE; } /* case WM_PAINT: { hdc = BeginPaint(hDlg, &ps); COLORREF cr; cr = GetBkColor(hdc); SetBkColor(hdc, cr); EndPaint(hDlg, &ps); } */ default: return FALSE; } return TRUE; } // Buyer Menu Dialog Procedure LRESULT CALLBACK BuyerMenuDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_ROLE_BUYER, IDI_ROLE_BUYER, L"Buyer\0"); DRAWIC(hDlg, wParam, lParam, IDC_ROLE_SELLER, IDI_ROLE_SELLER, L"Seller\0"); return TRUE; } case WM_INITDIALOG: { if( !(((RSBuyer*)g_User)->IsActive()) ) { PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_EDITPROFILE,0), 0); } return TRUE; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_EDITPROFILE) { DialogBox(hInst, (LPCTSTR)IDD_BUYER_PROFILE, hDlg, (DLGPROC)BuyerProfileDlgProc); } if(LOWORD(wParam) == IDC_LOGOUT) { ((RSBuyer*)g_User)->Logout(hDlg); // if user chose to logout...then close session if( !((RSBuyer*)g_User)->IsActive() ) { EndDialog(hDlg, LOWORD(wParam)); } return TRUE; } if(LOWORD(wParam) == IDC_POSTREQUEST) { PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_1,0), 0); } if(LOWORD(wParam) == IDC_OPENREQUEST) { PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDM_VIEWREQUESTS,0), 0); } if(LOWORD(wParam) == IDM_VIEWREQUESTS) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_VIEWREQUESTS, hDlg, (DLGPROC)ViewRequests_Proc); } } if(LOWORD(wParam) == IDM_SHOWSTEP_1) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_REQUESTSTEP1, hDlg, (DLGPROC)Step1_Proc); } } if(LOWORD(wParam) == IDM_SHOWSTEP_2) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_REQUESTSTEP2, hDlg, (DLGPROC)Step2_Proc); } } if(LOWORD(wParam) == IDM_SHOWSTEP_3) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_REQUESTSTEP3, hDlg, (DLGPROC)Step3_Proc); } } if(LOWORD(wParam) == IDM_SHOWSTEP_4) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_REQUESTSTEP4, hDlg, (DLGPROC)Step4_Proc); } } if(LOWORD(wParam) == IDM_SHOWSTEP_5) { if( ((RSBuyer*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_REQUESTCOMPLETE, hDlg, (DLGPROC)Step5_Proc); } } return TRUE; } default: { return FALSE; } } } LRESULT CALLBACK Step1_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_NEXT, IDI_BUTT_NEXT, NULL); DRAWIC(hDlg, wParam, lParam, IDC_PREVIOUS, IDI_BUTT_PREV, NULL); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_MAKE), CB_ADDSTRING, 0L, (LPARAM)L"Ford\0"); SendMessage(GetDlgItem(hDlg, IDC_MAKE), CB_ADDSTRING, 0L, (LPARAM)L"Honda\0"); SendMessage(GetDlgItem(hDlg, IDC_MAKE), CB_ADDSTRING, 0L, (LPARAM)L"BMW\0"); SendMessage(GetDlgItem(hDlg, IDC_MAKE), CB_ADDSTRING, 0L, (LPARAM)L"Mitsubishi\0"); return TRUE; break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_NEXT) { // buffer data TCHAR make[64]; TCHAR model[64]; TCHAR year[64]; // read data from text GetWindowText(GetDlgItem(hDlg, IDC_MAKE), make, 64); GetWindowText(GetDlgItem(hDlg, IDC_MODEL), model, 64); GetWindowText(GetDlgItem(hDlg, IDC_YEAR), year, 64); request.SetStep_1(make, model, year); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_2,0), 0); return TRUE; } if(LOWORD(wParam) == IDC_PREVIOUS) { // erase the current // request.EraseStep_1(); // common to all EndDialog(hDlg, LOWORD(wParam)); return TRUE; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return FALSE; } } default: return FALSE; } return FALSE; } LRESULT CALLBACK Step2_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_NEXT, IDI_BUTT_NEXT, NULL); DRAWIC(hDlg, wParam, lParam, IDC_PREVIOUS, IDI_BUTT_PREV, NULL); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_CONDITION), CB_ADDSTRING, 0L, (LPARAM)L"New\0"); SendMessage(GetDlgItem(hDlg, IDC_CONDITION), CB_ADDSTRING, 0L, (LPARAM)L"Used\0"); SendMessage(GetDlgItem(hDlg, IDC_TRANSMISSION), CB_ADDSTRING, 0L, (LPARAM)L"Automatic\0"); SendMessage(GetDlgItem(hDlg, IDC_TRANSMISSION), CB_ADDSTRING, 0L, (LPARAM)L"Manual\0"); return TRUE; break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_NEXT) { // buffer data //TCHAR buffer[64]; TCHAR color[64]; int condition = 0; int transmission = 0; // read data from text //GetWindowText(GetDlgItem(hDlg, IDC_CONDITION), buffer, 64); //condition = _wtoi(buffer); condition = SendMessage(GetDlgItem(hDlg, IDC_CONDITION), CB_GETCURSEL, 0L, 0L); GetWindowText(GetDlgItem(hDlg, IDC_COLOR), color, 64); //GetWindowText(GetDlgItem(hDlg, IDC_TRANSMISSION), buffer, 64); //transmission = _wtoi(buffer); transmission = SendMessage(GetDlgItem(hDlg, IDC_TRANSMISSION), CB_GETCURSEL, 0L, 0L); // int, tchar*, int request.SetStep_2(condition, color, transmission); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_3,0), 0); return TRUE; } if(LOWORD(wParam) == IDC_PREVIOUS) { // erase the current // request.EraseStep_1(); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_1,0), 0); return TRUE; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return FALSE; } } default: return FALSE; } return FALSE; } LRESULT CALLBACK Step3_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_NEXT, IDI_BUTT_NEXT, NULL); DRAWIC(hDlg, wParam, lParam, IDC_PREVIOUS, IDI_BUTT_PREV, NULL); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_TYPE), CB_ADDSTRING, 0L, (LPARAM)L"2 Door\0"); SendMessage(GetDlgItem(hDlg, IDC_TYPE), CB_ADDSTRING, 0L, (LPARAM)L"4 Door\0"); return TRUE; break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_NEXT) { // buffer data //TCHAR buffer[64]; TCHAR location[64]; int type; // read data from text //GetWindowText(GetDlgItem(hDlg, IDC_TYPE), buffer, 64); //type = _wtoi(buffer); type = SendMessage(GetDlgItem(hDlg, IDC_TYPE), CB_GETCURSEL, 0L, 0L); GetWindowText(GetDlgItem(hDlg, IDC_LOCATION), location, 64); request.SetStep_3(type, location); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_4,0), 0); return TRUE; } if(LOWORD(wParam) == IDC_PREVIOUS) { // erase the current // request.EraseStep_1(); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_2,0), 0); return TRUE; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return FALSE; } } default: return FALSE; } return FALSE; } LRESULT CALLBACK Step4_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_NEXT, IDI_BUTT_NEXT, NULL); DRAWIC(hDlg, wParam, lParam, IDC_PREVIOUS, IDI_BUTT_PREV, NULL); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); // buffer data TCHAR buf[64]; int dur = 0; dur = SendMessage(GetDlgItem(hDlg, IDC_DURATION), TBM_GETPOS, 0L, 0L); INIT_STRING(buf); _itow(dur, buf, 10); wcscat(buf, L" Days"); SetWindowText(GetDlgItem(hDlg, IDC_REQUESTDURATION), buf); return TRUE; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_DURATION), TBM_SETRANGE, WPARAM(TRUE), (LPARAM)MAKELONG(7, 90)); return TRUE; break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_NEXT) { // buffer data TCHAR buffer[64]; TCHAR pricerange[64]; int targetprice = 0; int duration = 0; // read data from text GetWindowText(GetDlgItem(hDlg, IDC_PRICERANGE), pricerange, 64); GetWindowText(GetDlgItem(hDlg, IDC_TARGETPRICE), buffer, 64); targetprice = _wtoi(buffer); //GetWindowText(GetDlgItem(hDlg, IDC_DURATION), buffer, 64); //duration = _wtoi(buffer); duration = SendMessage(GetDlgItem(hDlg, IDC_DURATION), TBM_GETPOS, 0L, 0L); //INIT_STRING(buffer); //itow(duration, buffer); //wcscat(buffer, L" Days"); //SetWindowText(IDC_REQUESTDURATION, buffer); request.SetStep_4(pricerange, targetprice, duration); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_5,0), 0); return TRUE; } if(LOWORD(wParam) == IDC_PREVIOUS) { // erase the current // request.EraseStep_1(); // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_3,0), 0); return TRUE; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return FALSE; } } default: return FALSE; } return FALSE; } LRESULT CALLBACK Step5_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_FINISH, IDI_BUTT_OK, NULL); DRAWIC(hDlg, wParam, lParam, IDC_PREVIOUS, IDI_BUTT_PREV, NULL); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_FINISH) { // buffer data TCHAR comments[128]; // read data from text GetWindowText(GetDlgItem(hDlg, IDC_COMMENTS), comments, 128); request.SetStep_5(comments); // show an OK message // NYI // post the message to the file if( ((RSBuyer*)g_User)->IsActive() ) { request.PostNewRequest(g_User); } // common to all EndDialog(hDlg, LOWORD(wParam)); return TRUE; } if(LOWORD(wParam) == IDC_PREVIOUS) { // common to all EndDialog(hDlg, LOWORD(wParam)); PostMessage(GetParent(hDlg), WM_COMMAND, MAKEWPARAM(IDM_SHOWSTEP_4,0), 0); return TRUE; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return FALSE; } } default: return FALSE; } return FALSE; } // Buyer Profile Procedure LRESULT CALLBACK BuyerProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_APPLY, IDI_BUTT_OK, NULL); DRAWIC(hDlg, wParam, lParam, IDC_CANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { SetWindowText(GetDlgItem(hDlg, IDC_FIRSTNAME), ((RSBuyer*)g_User)->GetFirstName()); SetWindowText(GetDlgItem(hDlg, IDC_LASTNAME), ((RSBuyer*)g_User)->GetLastName()); SetWindowText(GetDlgItem(hDlg, IDC_ADDRESS), ((RSBuyer*)g_User)->GetAddress()); SetWindowText(GetDlgItem(hDlg, IDC_PHONENUMBER), ((RSBuyer*)g_User)->GetPhoneNumber()); } case WM_COMMAND: { if(LOWORD(wParam) == IDC_APPLY) { TCHAR szFN[64]; TCHAR szLN[64]; TCHAR szAddr[64]; TCHAR szPhone[64]; GetWindowText(GetDlgItem(hDlg, IDC_FIRSTNAME), szFN, 64); GetWindowText(GetDlgItem(hDlg, IDC_LASTNAME), szLN, 64); GetWindowText(GetDlgItem(hDlg, IDC_ADDRESS), szAddr, 64); GetWindowText(GetDlgItem(hDlg, IDC_PHONENUMBER), szPhone, 64); ((RSBuyer*)g_User)->SetProfileData(szFN, szLN, szAddr, szPhone); ((RSBuyer*)g_User)->SaveProfileData(); if( !((RSBuyer*)g_User)->IsActive() ) { MessageBox(hDlg, L"All fields must be completed.", L"Information", MB_OK); } EndDialog(hDlg, LOWORD(wParam)); return TRUE; } if(LOWORD(wParam) == IDC_CANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } default: { return FALSE; } } return FALSE; } LRESULT CALLBACK ViewRequests_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static RSRequest tempr[30]; FILE *stream; TCHAR buffer[64]; int c = 0; int cx = 0; // data to read in at a time TCHAR make[64]; // Ford TCHAR model[64]; // Explorer TCHAR year[64]; // 1999 TCHAR color[64]; // Blue TCHAR location[64]; // Texas TCHAR pricerange[64]; // Texas TCHAR comments[128]; // 'blah blah blah int condition; // 0 = dont care, 1 = old, 2 = new int transmission; // 0 = dont care, 1 = automatic, 2 = manual int type; // 0 = dont care, 1 = 2 door, 2 = 4 door int targetprice; // 6000 int requestduration; // 35 days (1 month 5 days) int orderid; INIT_STRING(make); INIT_STRING(model); INIT_STRING(year); INIT_STRING(color); INIT_STRING(location); INIT_STRING(pricerange); INIT_STRING(comments); INIT_VALUE(condition); INIT_VALUE(transmission); INIT_VALUE(type); INIT_VALUE(targetprice); INIT_VALUE(requestduration); INIT_VALUE(orderid); switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_SELECTPOST, IDI_BUTT_VIEW, L"View\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { // open request file stream = _wfopen(L"request.txt", L"r"); // automatic fail login, no file opened if( stream != NULL ) { while( !feof(stream) ) { c++; // start post data READ_STRING(buffer, stream); // write userid READ_STRING(buffer, stream); // write orderid fwscanf(stream, L"%i", &orderid); READ_STRING(buffer, stream); // STEP 1 READ_STRING(make, stream); READ_STRING(model, stream); READ_STRING(year, stream); // set data tempr[c].SetStep_1(make, model, year); // STEP 2 fwscanf(stream, L"%i", &condition); READ_STRING(buffer, stream); READ_STRING(color, stream); fwscanf(stream, L"%i", &transmission); READ_STRING(buffer, stream); // set data tempr[c].SetStep_2(condition, color, transmission); // STEP 3 fwscanf(stream, L"%i", &type); READ_STRING(buffer, stream); READ_STRING(location, stream); // set data tempr[c].SetStep_3(type, location); // STEP 4 READ_STRING(pricerange, stream); fwscanf(stream, L"%i", &targetprice); READ_STRING(buffer, stream); fwscanf(stream, L"%i", &requestduration); READ_STRING(buffer, stream); // set data tempr[c].SetStep_4(pricerange, targetprice, requestduration); // STEP 5 READ_STRING128(comments, stream); tempr[c].SetStep_5(comments); // start post data READ_STRING(buffer, stream); //READ_STRING(buffer, stream); } for(cx = 1; cx < c; cx++) { INIT_STRING(buffer); //swprintf(buffer, L"A %s %s %s %s {%i}", tempr[cx].m_szYear, tempr[cx].m_szColor, tempr[cx].m_szModel, tempr[cx].m_szMake, tempr[cx].m_iTargetPrice); swprintf(buffer, L"%s %s (%i bids)", tempr[cx].m_szMake, tempr[cx].m_szModel, (rand() % 8 + 1)); SendMessage(GetDlgItem(hDlg, IDC_REQUESTLIST), LB_ADDSTRING, 0L, (LPARAM)buffer); } fclose(stream); } break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_SELECTPOST) { DialogBox(hInst, (LPCTSTR)IDD_VIEWOFFERS, hDlg, (DLGPROC)ViewOffers_Proc); EndDialog(hDlg, LOWORD(wParam)); } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); } break; } default: return FALSE; } return TRUE; } LRESULT CALLBACK ViewOffers_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_ACCEPTOFFER, IDI_BUTT_OK, L"Accept\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); break; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_OFFERLIST), LB_ADDSTRING, 0L, (LPARAM)L"Bob's Motor's : $8000\0"); SendMessage(GetDlgItem(hDlg, IDC_OFFERLIST), LB_ADDSTRING, 0L, (LPARAM)L"Mitsubishi Distrib. : $7000\0"); break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_ACCEPTOFFER) { MessageBox(hDlg, L"Please standby for contact information to be sent.", L"Accept Bid", MB_OK); EndDialog(hDlg, LOWORD(wParam)); } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); } break; } default: return FALSE; } return TRUE; } // Seller Menu Dialog Procedure LRESULT CALLBACK SellerMenuDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_VIEWREQUEST, IDI_BUTT_VIEW, L"View\r Request\0"); DRAWIC(hDlg, wParam, lParam, IDC_VIEWBIDS, IDI_BUTT_VIEW, L"View\n Bids\0"); DRAWIC(hDlg, wParam, lParam, IDC_LOGOUT, IDI_BUTT_LOGOUT, L"Logout\0"); DRAWIC(hDlg, wParam, lParam, IDC_EDITPROFILE, IDI_BUTT_EDIT, L"Edit\n Profile\0"); return TRUE; } case WM_INITDIALOG: { if( !(((RSSeller*)g_User)->IsActive()) ) { PostMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_EDITPROFILE,0), 0); } return TRUE; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_EDITPROFILE) { DialogBox(hInst, (LPCTSTR)IDD_SELLER_PROFILE, hDlg, (DLGPROC)SellerProfileDlgProc); return TRUE; } if(LOWORD(wParam) == IDC_LOGOUT) { ((RSSeller*)g_User)->Logout(hDlg); // if user chose to logout...then close session if( !((RSSeller*)g_User)->IsActive() ) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } } if(LOWORD(wParam) == IDC_VIEWBIDS) { if( ((RSSeller*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_VIEWBIDS, hDlg, (DLGPROC)ViewBids_Proc); return TRUE; } } if(LOWORD(wParam) == IDC_VIEWREQUEST) { if( ((RSSeller*)g_User)->IsActive() ) { DialogBox(hInst, (LPCTSTR)IDD_CHECKREQUESTS, hDlg, (DLGPROC)CheckRequests_Proc); return TRUE; } } return TRUE; } default: { return FALSE; } } } // Seller Profile Procedure LRESULT CALLBACK SellerProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_APPLY, IDI_BUTT_OK, NULL); DRAWIC(hDlg, wParam, lParam, IDC_CANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg, IDC_SELLERTYPE), CB_ADDSTRING, 0L, (LPARAM)L"Manufacturer\0"); SendMessage(GetDlgItem(hDlg, IDC_SELLERTYPE), CB_ADDSTRING, 0L, (LPARAM)L"Dealer\0"); SendMessage(GetDlgItem(hDlg, IDC_SELLERTYPE), CB_ADDSTRING, 0L, (LPARAM)L"Owner\0"); SetWindowText(GetDlgItem(hDlg, IDC_SELLERTYPE), ((RSSeller*)g_User)->GetTypeOfSeller()); SetWindowText(GetDlgItem(hDlg, IDC_COMPNAME), ((RSSeller*)g_User)->GetCompanyName()); SetWindowText(GetDlgItem(hDlg, IDC_CONTACT), ((RSSeller*)g_User)->GetContact()); SetWindowText(GetDlgItem(hDlg, IDC_PHONENUMBER), ((RSSeller*)g_User)->GetPhoneNumber()); } case WM_COMMAND: { if(LOWORD(wParam) == IDC_APPLY) { TCHAR szST[64]; TCHAR szCN[64]; TCHAR szCT[64]; TCHAR szPhone[64]; GetWindowText(GetDlgItem(hDlg, IDC_SELLERTYPE), szST, 64); GetWindowText(GetDlgItem(hDlg, IDC_COMPNAME), szCN, 64); GetWindowText(GetDlgItem(hDlg, IDC_CONTACT), szCT, 64); GetWindowText(GetDlgItem(hDlg, IDC_PHONENUMBER), szPhone, 64); ((RSSeller*)g_User)->SetProfileData(szST, szCN, szCT, szPhone); ((RSSeller*)g_User)->SaveProfileData(); if( !((RSSeller*)g_User)->IsActive() ) { MessageBox(hDlg, L"All fields must be completed.", L"Information", MB_OK); } EndDialog(hDlg, LOWORD(wParam)); return TRUE; } if(LOWORD(wParam) == IDC_CANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } default: { return FALSE; } } return FALSE; } BOOL GetRequest(int iorderid, RSRequest &tempr) { //RSRequest tempr; FILE *stream; TCHAR buffer[64]; int c = 0; int cx = 0; // data to read in at a time TCHAR make[64]; // Ford TCHAR model[64]; // Explorer TCHAR year[64]; // 1999 TCHAR color[64]; // Blue TCHAR location[64]; // Texas TCHAR pricerange[64]; // Texas TCHAR comments[128]; // 'blah blah blah int condition; // 0 = dont care, 1 = old, 2 = new int transmission; // 0 = dont care, 1 = automatic, 2 = manual int type; // 0 = dont care, 1 = 2 door, 2 = 4 door int targetprice; // 6000 int requestduration; // 35 days (1 month 5 days) int orderid; INIT_STRING(make); INIT_STRING(model); INIT_STRING(year); INIT_STRING(color); INIT_STRING(location); INIT_STRING(pricerange); INIT_STRING(comments); INIT_VALUE(condition); INIT_VALUE(transmission); INIT_VALUE(type); INIT_VALUE(targetprice); INIT_VALUE(requestduration); INIT_VALUE(orderid); // open request file stream = _wfopen(L"request.txt", L"r"); // automatic fail login, no file opened if( stream != NULL ) { while( !feof(stream) ) { c++; // start post data READ_STRING(buffer, stream); // write userid READ_STRING(buffer, stream); // write orderid fwscanf(stream, L"%i", &orderid); tempr.m_iOrderID = orderid; READ_STRING(buffer, stream); // STEP 1 READ_STRING(make, stream); READ_STRING(model, stream); READ_STRING(year, stream); // set data tempr.SetStep_1(make, model, year); // STEP 2 fwscanf(stream, L"%i", &condition); READ_STRING(buffer, stream); READ_STRING(color, stream); fwscanf(stream, L"%i", &transmission); READ_STRING(buffer, stream); // set data tempr.SetStep_2(condition, color, transmission); // STEP 3 fwscanf(stream, L"%i", &type); READ_STRING(buffer, stream); READ_STRING(location, stream); // set data tempr.SetStep_3(type, location); // STEP 4 READ_STRING(pricerange, stream); fwscanf(stream, L"%i", &targetprice); READ_STRING(buffer, stream); fwscanf(stream, L"%i", &requestduration); READ_STRING(buffer, stream); // set data tempr.SetStep_4(pricerange, targetprice, requestduration); // STEP 5 READ_STRING128(comments, stream); tempr.SetStep_5(comments); // start post data READ_STRING(buffer, stream); //READ_STRING(buffer, stream); if(tempr.m_iOrderID == iorderid) return TRUE; } } return FALSE; } LRESULT CALLBACK CheckRequests_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static RSRequest tempr[30]; FILE *stream; TCHAR buffer[64]; int c = 0; int cx = 0; BOOL bAddRequest = FALSE; // data to read in at a time TCHAR make[64]; // Ford TCHAR model[64]; // Explorer TCHAR year[64]; // 1999 TCHAR color[64]; // Blue TCHAR location[64]; // Texas TCHAR pricerange[64]; // Texas TCHAR comments[128]; // 'blah blah blah int condition; // 0 = dont care, 1 = old, 2 = new int transmission; // 0 = dont care, 1 = automatic, 2 = manual int type; // 0 = dont care, 1 = 2 door, 2 = 4 door int targetprice; // 6000 int requestduration; // 35 days (1 month 5 days) int orderid; INIT_STRING(make); INIT_STRING(model); INIT_STRING(year); INIT_STRING(color); INIT_STRING(location); INIT_STRING(pricerange); INIT_STRING(comments); INIT_VALUE(condition); INIT_VALUE(transmission); INIT_VALUE(type); INIT_VALUE(targetprice); INIT_VALUE(requestduration); INIT_VALUE(orderid); switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_SELECTPOST, IDI_BUTT_VIEW, L"View\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { // open account file stream = _wfopen(L"orderid.txt", L"a+"); // automatic fail login, no file opened if( stream != NULL ) { while( !feof( stream ) ) { fwscanf(stream, L"%i", &c); if( feof(stream) ) break; if( GetRequest(c, tempr[cx]) == TRUE ) { bAddRequest = FALSE; if( wcscmp( ((RSSeller*)g_User)->GetTypeOfSeller(), L"Manufacturer\0") == 0) { // 0 = new, 1 = used if(tempr[cx].m_iCondition == 0) { bAddRequest = TRUE; } } if( wcscmp( ((RSSeller*)g_User)->GetTypeOfSeller(), L"Dealer\0") == 0) { bAddRequest = TRUE; } if( wcscmp( ((RSSeller*)g_User)->GetTypeOfSeller(), L"Owner\0") == 0) { // 0 = new, 1 = used if(tempr[cx].m_iCondition == 1) { bAddRequest = TRUE; } } if(bAddRequest) { swprintf(buffer, L"%s %s", tempr[cx].m_szMake, tempr[cx].m_szModel); SendMessage(GetDlgItem(hDlg, IDC_REQUESTLIST), LB_ADDSTRING, 0L, (LPARAM)buffer); } cx++; } } fclose(stream); } break; } case WM_COMMAND: { if(LOWORD(wParam) == IDC_SELECTPOST) { g_iSelectedRequest = SendMessage(GetDlgItem(hDlg, IDC_REQUESTLIST), CB_GETCURSEL, 0L, 0L); if(g_iSelectedRequest == -1) { MessageBox(hDlg, L"You need to select a request first.", L"Error", MB_OK); break; } g_iSelectedRequest = tempr[g_iSelectedRequest].m_iOrderID; if(g_iSelectedRequest > 0) DialogBox(hInst, (LPCTSTR)IDD_BIDONREQUEST, hDlg, (DLGPROC)BidDlg_Proc); break; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); break; } } default: return FALSE; } return TRUE; } LRESULT CALLBACK BidDlg_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static RSRequest tempr; TCHAR buffer[256]; switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_BID, IDI_BUTT_POST, L"Bid\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_INITDIALOG: { if(GetRequest(g_iSelectedRequest, tempr) == TRUE) { SetBkColor(GetDC(GetDlgItem(hDlg, IDC_BIDINFO)), RGB(255,255,255)); wcscpy(buffer,L"\0"); wcscat(buffer, L"Make: "); wcscat(buffer, tempr.m_szMake); wcscat(buffer, L"\r\nModel: "); wcscat(buffer, tempr.m_szModel); wcscat(buffer, L"\r\nYear: "); wcscat(buffer, tempr.m_szYear); wcscat(buffer, L"\r\nColor: "); wcscat(buffer, tempr.m_szColor); wcscat(buffer, L"\r\nTarget Price: $"); wcscat(buffer, tempr.m_szPriceRange); wcscat(buffer, L"\r\n\r\n\r\netc..."); SetWindowText(GetDlgItem(hDlg, IDC_BIDINFO), buffer); INIT_STRING(buffer); _itow(tempr.m_iTargetPrice, buffer, 10); SetWindowText(GetDlgItem(hDlg, IDC_LOWBID), buffer); break; } } case WM_COMMAND: { if(LOWORD(wParam) == IDC_BID) { break; } if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); break; } } default: return FALSE; } return TRUE; } LRESULT CALLBACK ViewBids_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DRAWITEM: { DRAWIC(hDlg, wParam, lParam, IDC_SELECTPOST, IDI_BUTT_VIEW, L"View\0"); DRAWIC(hDlg, wParam, lParam, IDCANCEL, IDI_BUTT_CLOSE, NULL); return TRUE; } case WM_COMMAND: { if(LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); break; } return TRUE; } default: return FALSE; } return TRUE; } // Mesage handler for the About box. /* LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { SHINITDLGINFO shidi; switch (message) { case WM_INITDIALOG: // Create a Done button and size it. shidi.dwMask = SHIDIM_FLAGS; shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN; shidi.hDlg = hDlg; SHInitDialog(&shidi); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } return FALSE; } */