16bit -->32bit conversion problem

I hope someone can help me with the following problem. I am
in the process of converting a 16bit application (originally
developed in BP7.0, OWL based) to 32 bit application. I
am using Virtual Pascal 32 bit compiler to do that. So far
I have managed to get it to recompile, but when I run it,
an "Application error 4" comes up. I looked it up in BP7.0
manual it is a code for em_invalidChild, and it does
appear during the process of creating child windows of
the main application window. (in OWL windows unit).
I never had this problem in the 16bit version.
If anybody has any idea what is causing this error, and/or
how to I go about fixing it, please let me know
Thank you,