[VC6.0] Mon appli GDI+ plante en faisant 2 bips puis quitte
Bonjour à tous,
J'ai développé une application sous Windows XP qui crée et affiche des pages HTML à partir de fichiers texte formattés contenant des données statistiques.
Lors de tests sur une autre machine sous Windowns NT "allégé", j'ai un plantage bizarre : quand on affiche certaines fenêtres pour la deuxième fois, l'ordinateur émet deux bips consécutifs et l'application est quittée, sans message d'erreur.
J'ai bien sûr vérifié de ne pas avoir laissé trainer de Beep(). Est-ce que quelqu'un a déjà eu ce genre de comportement ?
Le plantage semble avoir lieu dans cette fonction (je dis bien semble car je ne peux pas lancer l'appli sous NT en debug) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| // saves the graph to a PNG image
void CGraph::saveToPNG(CString path, int width /* = 0 */, int height /* = 0 */)
{
SLayout imgLayout;
imgLayout._is_valid = false;
if (width != 0)
{
// width/height specified
imgLayout._global = RectF(0, 0, (float)width, (float)height);
}
else
{
// no width specified, use the screen layout size
imgLayout._global = m_screen_layout._global;
SizeF size;
imgLayout._global.GetSize(&size);
width = (int)size.Width;
height = (int)size.Height;
}
// creates a bitmap the right size
Bitmap image(width, height);
// creates a Graphics object based on the image
Graphics g(&image);
// smooth drawing with antialias
g.SetSmoothingMode(SmoothingModeAntiAlias);
// fills the background
SolidBrush* b = new SolidBrush(m_cfg._brush_color);
g.FillRectangle(b, getRect(imgLayout._global));
delete b;
// outline uses the fill color when exporting, so no border is visible
Pen* p = new Pen(m_cfg._brush_color);
g.DrawRectangle(p, getRect(imgLayout._global));
delete p;
// draws everything
drawAll(g, imgLayout);
// saves the image.
CLSID pngClsid;
Utils::GetEncoderClsid(L"image/png", &pngClsid);
BSTR finalPath = path.AllocSysString();
image.Save(finalPath, &pngClsid, NULL);
} |
Re: [VC6.0] Mon application plante en faisant 2 bips puis qu
Citation:
Envoyé par nmarf
Lors de tests sur une autre machine sous Windowns NT "allégé", j'ai un plantage bizarre : quand on affiche certaines fenêtres pour la deuxième fois, l'ordinateur émet deux bips consécutifs et l'application est quittée, sans message d'erreur.
La classe Graphics c'est avec quoi ?
C'est avec GDI+ ?
Si l'appli plante en beepant c'est qu'il ya un effet de bord , des données mal initialisées ....
GDI + c'est avec du code machine à exceptions gérées ( "managed code") seule solution tracer comme suggère Nico-Pyright :wink:
Re: [VC6.0] Mon application plante en faisant 2 bips puis qu
Citation:
Envoyé par mat.M
La classe Graphics c'est avec quoi ?
C'est avec GDI+ ?
C'est une classe que j'ai récupérée de quelqu'un d'autre et il semblerait en effet qu'elle utilise GDI+ car dans l'en-tête du fichier CGraph.cpp j'ai :
Code:
1 2
| using namespace Gdiplus;
using namespace Utils; |
Citation:
Envoyé par mat.M
Si l'appli plante en beepant c'est qu'il ya un effet de bord , des données mal initialisées ....
GDI + c'est avec du code machine à exceptions gérées ( "managed code") seule solution tracer comme suggère Nico-Pyright :wink:
Bon, et bien je vais tracer...
Aurelien.Regat-barrel > Je ne comprends pas ton message. Que veut dire "en natif" ? (Je n'y connais pas grand chose en GDI+, à part ce que j'ai pu trouver à droite à gauche).