Bueno ya lo solucioné aunque yo la comprobacion con 0 no la hago ya que la imagen no puede tener 0 ni de ancho ni de alto. Muchas gracias.
Asi quedó la mia:
Código SQL
[-]int ContarDivisionesImagen( AnsiString ruta, int maxWidth, int maxHeight)
{
//Solicito memoria para el bitmap que contendrá el concatenado de imagenes
Graphics::TBitmap *bmp = new (nothrow) Graphics::TBitmap();
int divisionesHeight=0, divisionesWidth=0, divisiones=0;
if(bmp != NULL)
{
bmp->LoadFromFile(ruta);
int TotalWidth = bmp->Width;
int TotalHeight = bmp->Height;
while( TotalWidth > 0)
{
TotalWidth -= maxWidth;
divisionesWidth++;
}
while( TotalHeight > 0)
{
TotalHeight -= maxHeight;
divisionesHeight++;
}
divisiones = divisionesHeight * divisionesWidth;
delete bmp;
}else{
divisiones = -1;
}
return divisiones;
}