Results 1 to 3 of 3

Thread: can someone compile this in VC++?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    Here is the source file I'm trying to compile from my last message I posted. For some reason, it keeps giving me an end of file error in VC++6.0. What's wrong with the file?

    Code:
    // win.cpp: Implementation of the structure win;
          //          After compiling, link with application-file
    
          #include "win.h"
    
          win::win(HINSTANCE hInstance0, int iCmdShow0, 
                   PSTR szAppName0, PSTR szWindowCaption0)
          { iCmdShow = iCmdShow0;
    
            //store the arguments for CreateWindow in the structure win:
            szAppName = szAppName0;
            szWindowCaption = szWindowCaption0;
            dwStyle = WS_OVERLAPPEDWINDOW;
            x = y = 0;
            nWidth = GetSystemMetrics(SM_CXSCREEN);
            nHeight = GetSystemMetrics(SM_CYSCREEN);
            hWndParent = NULL;
            hMenu = NULL;
            hInstance = hInstance0;
            lpParam = NULL;
    
            //Fill wndclass just for now:
            wndclass.cbSize = sizeof(wndclass);
            wndclass.style = CS_HREDRAW | CS_VREDRAW;
            wndclass.lpfnWndProc = WndProc;
            wndclass.cbClsExtra = 0;
            wndclass.cbWndExtra = 0;
            wndclass.hInstance = hInstance;
            wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
            wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
            wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
            wndclass.lpszMenuName = NULL;
            wndclass.lpszClassName = szAppName;
            wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
            wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
            hDlg=0;
            szAccel = NULL;
          }
    
          int win::result()
          { RegisterClassEx(&wndclass);
            hWnd = CreateWindow(szAppName, szWindowCaption, dwStyle,
                   x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
            ShowWindow(hWnd, iCmdShow);
            UpdateWindow(hWnd);
            MSG msg;
            HACCEL hAccel = (szAccel ? LoadAccelerators(hInstance, szAccel) : 0);
            while (GetMessage(&msg, NULL, 0, 0))
            { if (hDlg == 0 || !IsDialogMessage(hDlg, &msg))
              { if (hAccel == 0 || !TranslateAccelerator(hWnd, hAccel, &msg))
                { TranslateMessage(&msg);
                  DispatchMessage(&msg);
                }
              }
            }
            return msg.wParam;
          }
    Any help would be greatly appreciated..

    DAn

  2. #2
    Lively Member
    Join Date
    Nov 2000
    Location
    Québec City
    Posts
    73
    If you want us to try to compile it, you should also post the file win.h...

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Woops! Sorry 'bout that...

    Code:
    //win.h
          #define STRICT
          #include <windows.h>
    
          LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, 
                                   WPARAM wParam, LPARAM lParam);
    
          struct win
          {       win (HINSTANCE hInstance0, int iCmdShow0, 
                       PSTR szAppName0, PSTR szWindowCaption0);
                  int result ();
    
                  int iCmdShow;         //For passing through ShowWindow
                  WNDCLASSEX wndclass;
                  HWND hWnd,            //Handle for mainwindow
                       hDlg;            //Handle for modeless dialogbox
                  PSTR szAccel;         //Name accelerator table
    
                  //Arguments for CreateWindow:
                  PSTR szAppName;       //registered classname
                  PSTR szWindowCaption; //address of windowname
                  DWORD dwStyle;        //windowstyle
                  int x;                //horizontal position of window
                  int y;                //vertical position of window
                  int nWidth;           //width
                  int nHeight;          //height
                  HWND hWndParent;      //parent-window
                  HMENU hMenu;          //menuhandle
                  HINSTANCE hInstance;  //application-instance
                  LPVOID lpParam;       //window-creation-data
          };

Posting Permissions

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



Click Here to Expand Forum to Full Width