Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failed or Cannot Open File errors from scan
#2
Maybe this info can help to debug "cannot open file" error.

1. At first scan finds the file like str.searchpath does. Expands spec folder etc.
2. Then loads bitmap using API LoadImage.
3. If the file does not exist or LoadImage fails, throws error "cannot open file". Nothing else throws this error in scan.

I don't know reasons why LoadImage can fail even if file exists.
May fail if the file is locked by some program.
Or if not enough memory.
Or maybe too many open handles (bitmaps or other GDI objects). For example, if I call LoadImage 10000 times and don't close the handle, LoadImage then fails and QM stops working normally.

When LoadImage in scan fails, str.dllerror should give more info.
LoadImage in MSDN: http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Also google for LoadImage error.

Can use this code to debug:
Code:
Copy      Help
str imgfile="$common documents$\My QM Share\QM BMPs\Sample.bmp"

str sf
if(!sf.searchpath(imgfile)) end "file not found"

__GdiHandle hbitmap=LoadImageW(0 @sf IMAGE_BITMAP 0 0 LR_LOADFROMFILE)
if(!hbitmap) end _s.dllerror("LoadImageW error:")

or
Code:
Copy      Help
int ok=scan("$common documents$\My QM Share\QM BMPs\Sample.bmp" 0 DRSBox_MonB 4)
err
,out _s.dllerror("dllerror:")
,out _error.description
,ret


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)