Board index » cppbuilder » different behavior with exe under XP and W2000

different behavior with exe under XP and W2000


2004-12-28 10:50:45 PM
cppbuilder55
Hello, I have the next problem: I've a project, and when I create the .exe
under Windows XP, this exe gives me errors when I open the exe file under
Windows 2000 for example, but works very well when I open it under XP (the
OS under witch I created the exe).
When I take the same project, and when I create the exe file under the
Windows 2000, this exe file work well on Windows 2000, but can give errors
on other OS.I've to precise that I use C++ Builder 4 and dll's that have
been created in the year of 2000.this can explain the unusual behavior of my
exe files? Thank you for your help!
Cedric
 
 

Re:different behavior with exe under XP and W2000

"cedric" < XXXX@XXXXX.COM >wrote in message
Quote
I've a project, and when I create the .exe under Windows XP, this
exe gives me errors when I open the exe file under Windows 2000
for example, but works very well when I open it under XP (the OS
under witch I created the exe).
What errors exactly? Please be more specific.
Quote
When I take the same project, and when I create the exe file under
the Windows 2000, this exe file work well on Windows 2000, but
can give errors on other OS.
Again, what are the actual errors?
Gambit
 

Re:different behavior with exe under XP and W2000

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"cedric" < XXXX@XXXXX.COM >wrote in message
news:41d17287$ XXXX@XXXXX.COM ...

>I've a project, and when I create the .exe under Windows XP, this
>exe gives me errors when I open the exe file under Windows 2000
>for example, but works very well when I open it under XP (the OS
>under witch I created the exe).

What errors exactly? Please be more specific.
The errors occur when I open the exe file. The errors occur (I think) in the
OnResize event of a panel in which I want to display an image in a TImage
object...I display a new rescaled image each time the size of the panel
change....the errors msg is something like "Eaccess Violation ..."...so for
me, the OnResize event want to display the image, while the TImage object is
maybe not yet created...
But that doesn't explaine the fact that I need to compile the soft under XP
to use it under XP and to compile the soft under W2000 to use it under this
W2000...
Thank you very much for your help:-)!
Cedric
Quote

>When I take the same project, and when I create the exe file under
>the Windows 2000, this exe file work well on Windows 2000, but
>can give errors on other OS.

Again, what are the actual errors?


Gambit


 

{smallsort}

Re:different behavior with exe under XP and W2000

"cedric" < XXXX@XXXXX.COM >wrote in message
Quote
The errors occur (I think) in the OnResize event of a panel in which
I want to display an image in a TImage object...
What does your actual code look like? Please produce a minimal code sample
that reproduces the problem.
Quote
I display a new rescaled image each time the size of the panel change....
Are you resizing the image manually? If so, then have you tried letting the
TImage resize itself automatically instead? TImage does have AutoSize and
Stretch properties.
Quote
the errors msg is something like "Eaccess Violation ..."...so for me,
the OnResize event want to display the image, while the TImage
object is maybe not yet created...
Sounds like maybe a bug in your own code then. IT is hard to say for sure
since you have not shown your code yet.
Quote
But that doesn't explaine the fact that I need to compile the soft
under XP to use it under XP and to compile the soft under W2000
to use it under this W2000...
You do not need to do that.
Gambit
 

Re:different behavior with exe under XP and W2000

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"cedric" < XXXX@XXXXX.COM >wrote in message
news:41d1b5b0$ XXXX@XXXXX.COM ...

>The errors occur (I think) in the OnResize event of a panel in which
>I want to display an image in a TImage object...

What does your actual code look like? Please produce a minimal code
sample
that reproduces the problem.
Here are a the OnPanelResize event and the OnFormShow event of my project :
//--------------------------------------------------------------------------
-
void __fastcall TForm1::FormShow(TObject *Sender)
{
OnFormDone=true;
int TheWidth=PreviewPanel->Width;
intPanel->Width=TheWidth/2;
phaPanel->Width=TheWidth/2;
pPreviewInt->Assign(PreviewImageInt);
pPreviewPha->Assign(PreviewImagePha);
}
//--------------------------------------------------------------------------
-
void __fastcall TForm1::PreviewPanelResize(TObject *Sender)
{
if (OnFormDone)
{
int TheWidth=PreviewPanel->Width;
intPanel->Width=TheWidth/2;
phaPanel->Width=TheWidth/2;
pPreviewInt->Assign(PreviewImageInt);
pPreviewPha->Assign(PreviewImagePha);
}
}
//--------------------------------------------------------------------------
-
the global Boolean variable 'OnFormDone' is set to false in the constructor
of my project (in order to avoid displaying Image before creating the panel
or TImage object).
As you see, I display two images: one image for one TImage object insert in
one panel (align properties of TImage is set to 'alClient').
The Assign fct is fct of a class I use (TPreview). This fct link the class
TPreview to the TImage object (and display a black image in the TImage
object, if no image is already displayed in the TImage object).
When the error I explained to you occurs, I can press a 'ok' button on the
error msg box, and the form is shown: only one image (so black image,
because no previous images have been displayed) is displayed, and the other
remain white (so the Assign on the other image is KO)
Quote

>I display a new rescaled image each time the size of the panel
change....

Are you resizing the image manually? If so, then have you tried letting
the
TImage resize itself automatically instead? TImage does have AutoSize and
Stretch properties.
TImage is on a Panel that I can resize with a Splitter object. I'll tried
the AutoSize to avoid the using of the class TPreview (Assign) each time the
OnPanelResize is call...
Quote

>the errors msg is something like "Eaccess Violation ..."...so for me,
>the OnResize event want to display the image, while the TImage
>object is maybe not yet created...

Sounds like maybe a bug in your own code then. IT is hard to say for sure
since you have not shown your code yet.

>But that doesn't explaine the fact that I need to compile the soft
>under XP to use it under XP and to compile the soft under W2000
>to use it under this W2000...

You do not need to do that.
I hope:-)...nb: the exe file created with W2000 is better (more portable)
than the one created by XP. I mean that Some pc with XP has a good behavior
with the exe file created with W2000, but no (!!) W2000 OS can have a good
behavior with the exe file from XP...
Cedric...thanks
Quote


Gambit


 

Re:different behavior with exe under XP and W2000

"cedric" < XXXX@XXXXX.COM >wrote in message
Quote
Here are a the OnPanelResize event and the OnFormShow event of my project
:
You do know that the OnShow event can be triggered before the forn's
constructor is finished, don't you? That might be part of your problem,
since the OnFormDone flag may be getting set to true too soon.
Quote
the global Boolean variable 'OnFormDone' is set to false in the
constructor of my project (in order to avoid displaying Image
before creating the panel or TImage object).
Do not use the OnShow event for managing that flag. Either use the OnPaint
event, or post a custom message back to the form for later processing (since
messages are not processed until the everything is initialized and the app
actually begins running).
Quote
I hope:-)...nb: the exe file created with W2000 is better (more portable)
than the one created by XP. I mean that Some pc with XP has a good
behavior with the exe file created with W2000, but no (!!) W2000 OS
can have a good behavior with the exe file from XP...
An executable is an executable regardless of the OS version. The only thing
that matters with respect to OS version is the API functions called by the
application. If an application statically links to a function that is only
available on a newer OS, then the executable will not run at all on an older
OS. Reversely, if the application statically links to only functions that
are available on older OSes, the application will run on newer OSes (but
with potentially limited functionality). If an application wants to run on
older OSes while still using the enahanced functions of newer OSes, the
enhanced functions must be dynamically loaded at runtime rather than
statically linked at compile-time.
Gambit