Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR Creating OLE Object

Status
Not open for further replies.

Scott24x7

Programmer
Joined
Jul 12, 2001
Messages
2,829
Location
JP
All,
A new, and strange OLE error has begun to plague an application I am developing... (and just when I thought I had resolved all of those pesky things!). If you can help, please let me know. Here is my scenario:

FoxPro 2.6a (for windows) all patches applied:
OS (Win98/Win2000/WinXP) I've tried it in all of these OS's, and the results are identical.

I have a screen that has a Picture on it, that corresponds with data in a database. When I "ADD" a new record, I create "WHITE" space in the general fields by copying a "Plain White" (WHITE.BMP) image into the fields. The image is a small .BMP, 10pixles by 10pixles, which is stretched to fit the window, making the whole thing white. This is done, because the ability to pick the associated image is not availbale during the actual adding of the record. You add an image after the record is created. This was working fine until about 2 days ago. I have made no change to that part of the routine. I recieve a prompt (via my own error handler), that gives me the chance to "Retry". If I retry, it appends the image every time. I have opened the .BMP in Photoshop, and it does not appear to be corrupt. I even copied another version from another application where I do the same thing, with the same result. (So I'm fairly certain the .BMP is fine.) The database that I'm copying into displays no sign of corruption. The baffeling thing is that it fails every time. It is a fully recreatable error. If I ignore the error (which I've done in the past with OLE errors, as they are often erroneous in Fox), I get a "Blank" image. As in, it's not white, it's blank, and you can see the background that appers behind where the image should be.

I know this description sounds nuts, but have I missed something obvious here?
Any help greatly appreciated.
-Scott
 
Scott,
The first question is what application is currently associated with .BMP files? Is it OLE capable/aware?

Originally, in Win 3.x, .BMPs were associated with MS Paintbrush (listed in the registry as PBRUSH) so the code looked something like:
APPEND GENERAL tmp.PHOTO FROM my.bmp;
CLASS PBRUSH
Then in Win95 (and forward), you used MS Paint (listed in the registry as PAINT.PICTURE) so the code looked something like:
APPEND GENERAL tmp.PHOTO FROM my.bmp ;
CLASS PAINT.PICTURE

When you then display them, FPW assumes that the same OLE server will be used, but if a different one is associated with this file type, you can get OLE errors. So depending on how your data was stored in the General field and what your current file association is for .BMPs is, you can have problems.

Note: This is one reason why it is generally recommended that you only store path and file names to the pictures rather than the pictures themselves.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top