Unknown C++ Compile error

Discussion in 'Software' started by Testerrr, Dec 15, 2013.

  1. Testerrr

    Testerrr Private E-2

    I just started out with C++ and I am writing the a program for pictures.
    [BCC32 Error] Unit1.cpp(156): E2379 Statement missing ;

    {
    (OpenDialog1->Execute())
    {
    if(((ExtractFileExt(OpenDialog1->FileName)))==".exe")
    {
    HICON I;
    Index = 0;
    String Label = "";


    Limit = (long) ExtractIcon(HInstance,
    OpenDialog1->FileName.c_str(),


    Label += " Icons: ";
    Label += String(Index+1);
    Label += "\\";
    Label += String(Limit);
    Label1->Caption = Label;

    if (Limit > 1)
    Action3->Enabled = true;
    else
    Action3->Enabled = false;

    I = ExtractIcon(HInstance,
    OpenDialog1->FileName.c_str(),
    Index);
    if ((int)I > 1)
    {
    Image1->Picture->Icon->Handle = I;
    Action2->Enabled = true;
    SpeedButton3->Enabled=true;
    SpeedButton4->Enabled=true;
    SpeedButton5->Enabled=true;
    SpeedButton6->Enabled=true;
    SpeedButton7->Enabled=true;
    SpeedButton8->Enabled=true;
    SpeedButton10->Enabled=true;
    SpeedButton11->Enabled=true;
    saveAss1->Enabled=true;
    Cut2->Enabled = true;
    Copy2->Enabled = true;
    Past2->Enabled = true;
    }
    else
    {
    Image1->Picture->Assign(Image2->Picture);
    Action2->Enabled = false;
    SpeedButton6->Enabled=false;
    SpeedButton10->Enabled=false;
    SpeedButton5->Enabled=false;
    saveAss1->Enabled=false;
    }

    }
    else if(((ExtractFileExt(OpenDialog1->FileName)))==".png")
    {
    TCHAR filename[MAX_PATH];
    lstrcpyn(filename, OpenDialog1->FileName.c_str(), MAX_PATH);

    // declare and clear the PNGD_P2DINFO structure
    PNGD_P2DINFO png2dib;
    memset(&png2dib, 0, sizeof(PNGD_P2DINFO));

    // initialize the structure size and filename
    png2dib.structsize = sizeof(PNGD_P2DINFO);
    png2dib.pngfn = filename;

    // convert from PNG to DIB
    if (read_png_to_dib(&png2dib) == PNGD_E_SUCCESS)
    {
    Graphics::TBitmap* Bitmap = Image2->Picture->Bitmap;
    Bitmap->Width = png2dib.lpdib->biWidth;
    Bitmap->Height = png2dib.lpdib->biHeight;

    HBITMAP hBmp = Bitmap->ReleaseHandle();
    HDC hDC = Canvas->Handle;
    try
    {
    //
    // TODO: add palette support...
    //

    // convert from DIB to TBitmap
    SetDIBits(
    hDC, hBmp, 0,
    png2dib.lpdib->biHeight, png2dib.bits,
    reinterpret_cast<LPBITMAPINFO>(png2dib.lpdib),
    DIB_RGB_COLORS
    );
    }
    catch (...)
    {
    Bitmap->Handle = hBmp;
    GlobalFree(png2dib.lpdib);
    }
    Bitmap->Handle = hBmp;
    GlobalFree(png2dib.lpdib);
    }
    }
    else
    {
    AnsiString pixelsize;
    Micro->Image1->Picture->LoadFromFile(OpenDialog1->FileName);
    CurrentFile=OpenDialog1->FileName;
    Micro->HorzScrollBar->Range = Image1->Picture->Width;
    Micro->VertScrollBar->Range = Image1->Picture->Height;
    Micro->Height = (Image1->Picture->Height + 99);
    Micro->Width = (Image1->Picture->Width + 12);
    pixelsize=pixelsize+"Size: "+Image1->Width+"x"+Image1->Height + " Pixels";
    Micro->StatusBar1->Panels->Items[2]->Text = pixelsize; //Image1->Width;

    Action2->Enabled = true;
    Action2->Enabled = true;
    SpeedButton3->Enabled=true;
    SpeedButton4->Enabled=true;
    SpeedButton5->Enabled=true;
    SpeedButton6->Enabled=true;
    SpeedButton7->Enabled=true;
    SpeedButton8->Enabled=true;
    SpeedButton10->Enabled=true;
    SpeedButton11->Enabled=true;
    saveAss1->Enabled=true;
    Cut2->Enabled = true;
    Copy2->Enabled = true;
    Past2->Enabled = true;

    }
    HANDLE file;
    int size;
    AnsiString str;
    file = CreateFile(OpenDialog1->FileName.c_str(), GENERIC_READ,FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
    if(file == INVALID_HANDLE_VALUE)
    ShowMessage("Non fatal error - File cannot be opened because this file is in use.");
    else {
    size = GetFileSize(file, NULL);
    size=size/1024;
    str=IntToStr(size);
    Micro->StatusBar1->Panels->Items[3]->Text = "Filesize: " + str + "Kb";
    }


    Micro->StatusBar1->Panels->Items[1]->Text=(OpenDialog1->FileName);
    Micro->Show();
    Image1->AutoSize = true;
    }

    }
     
  2. Adrynalyne

    Adrynalyne Guest

    At line 156, you are missing a semicolon, is what it is saying quite literally.


    Just quick glance (there might be others), it is here:

    Code:
    Limit = (long) ExtractIcon(HInstance,
    OpenDialog1->FileName.c_str(),
    Change the comma to a semicolon.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds