Cowburns Imaging library issues

  • Thread starter Thread starter Peter Hartlén
  • Start date Start date
P

Peter Hartlén

Hi!

I have some trouble getting Neil Cowburns Imaging library to work, and was
hoping there are some people here that is using it. I KNOW IT'S OLD but I'm
trying to shake some life into a Qtek 9090 PPC2003SE application by adding
camera support.

I'm using a Qtek 9090 (PPC2003SE), which goes under the HTC portfolio.

The issue I have is in the Capture method when the SendMessage function is
called. The returned data from

IntPtr hwndCamWiz = GetCameraWizardWnd(_path);
This works fine, the camera application is started and a photo is taken.

In the SendMessage method of the CallBackWindow we have these rows:
CopyData cd = (CopyData)Marshal.PtrToStructure(m.LParam, typeof(CopyData));
CaptureData rd = (CaptureData)Marshal.PtrToStructure(cd.lpData,
typeof(CaptureData));

The problem is that rd.ReturnCode is 4, which I am not sure what it stands
for (Perhaps InvalidArgument if it follows SHCameraCapture). The correct
return code is 0.

The only place I can see something that doesn't seem to be alright is how
the savefolder variable is stored. I set it to @"\Temp" but when retrieveing
it from it's Property it's not valid. I make sure @"\Temp" is a valid
directory!

Example:
saveFolder = @"\Temp\";
_camConfig.SaveFolder = saveFolder;
MessageBox.Show( _camConfig.SaveFolder ); <-- This returns some mumbo
jumbo...

So perhaps the WM_COPYDATA message fails because of an incorrect save path?

Any suggestion?

/ Peter
 
Well assuming that code is coming from some API call somewhere, 4 == 'The
system cannot open the file.' so that does indicate a likely file/path
issue.
 
Hi Chris, thanks for your reply!

The SaveFolder property has the following syntax:
public string SaveFolder
{
get
{
byte[] buffer = MarshalEx.ReadByteArray(_ptr, 0, 520); <--- Returns a bad
buffer array, why 520??
return Encoding.Unicode.GetString(buffer, 0, buffer.Length).Trim('\0');
}
set
{
byte[] buffer = Encoding.Unicode.GetBytes(value);
MarshalEx.WriteByteArray(_ptr, 28, buffer); <--- Where does offset 28
come from?
}
}

Setting SaveFolder = @"\Temp"; produces a byte array of length 10:
92,0,84,0,101,0,109,0,112,0
_ptr = 418960 (valid pointer)

When looking at SaveFolder after the WriteByteArray method it has the
following value: "?0\0\0\0\0@\0\0\0\0\0\\Temp"
The Trim(\0) doesn't seem to work as there are other special chars...

The installed SDF version is 1.4.50804.0

Is it not possible to specify another length of the buffer when reading from
ReadByteArray as the Trim seems abit unstable...

Thanks,

Peter
 
I'm not very familiar with Neil's original code, but out of curiosity, are
you using CF1 or CF2? You'd have to look at the code, but I know object
addresses differ in CF1 and CF2 in some cases, and workarounds for these
poitners in CF1 ended up breaking in CF2.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Peter Hartlén said:
Hi Chris, thanks for your reply!

The SaveFolder property has the following syntax:
public string SaveFolder
{
get
{
byte[] buffer = MarshalEx.ReadByteArray(_ptr, 0, 520); <--- Returns a bad
buffer array, why 520??
return Encoding.Unicode.GetString(buffer, 0, buffer.Length).Trim('\0');
}
set
{
byte[] buffer = Encoding.Unicode.GetBytes(value);
MarshalEx.WriteByteArray(_ptr, 28, buffer); <--- Where does offset 28
come from?
}
}

Setting SaveFolder = @"\Temp"; produces a byte array of length 10:
92,0,84,0,101,0,109,0,112,0
_ptr = 418960 (valid pointer)

When looking at SaveFolder after the WriteByteArray method it has the
following value: "?0\0\0\0\0@\0\0\0\0\0\\Temp"
The Trim(\0) doesn't seem to work as there are other special chars...

The installed SDF version is 1.4.50804.0

Is it not possible to specify another length of the buffer when reading
from ReadByteArray as the Trim seems abit unstable...

Thanks,

Peter



Well assuming that code is coming from some API call somewhere, 4 == 'The
system cannot open the file.' so that does indicate a likely file/path
issue.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
 
I'm using CF1 in this case so that shouldn't be the reason, thanks anyway!

/ Peter


I'm not very familiar with Neil's original code, but out of curiosity, are
you using CF1 or CF2? You'd have to look at the code, but I know object
addresses differ in CF1 and CF2 in some cases, and workarounds for these
poitners in CF1 ended up breaking in CF2.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Peter Hartlén said:
Hi Chris, thanks for your reply!

The SaveFolder property has the following syntax:
public string SaveFolder
{
get
{
byte[] buffer = MarshalEx.ReadByteArray(_ptr, 0, 520); <--- Returns a
bad buffer array, why 520??
return Encoding.Unicode.GetString(buffer, 0, buffer.Length).Trim('\0');
}
set
{
byte[] buffer = Encoding.Unicode.GetBytes(value);
MarshalEx.WriteByteArray(_ptr, 28, buffer); <--- Where does offset 28
come from?
}
}

Setting SaveFolder = @"\Temp"; produces a byte array of length 10:
92,0,84,0,101,0,109,0,112,0
_ptr = 418960 (valid pointer)

When looking at SaveFolder after the WriteByteArray method it has the
following value: "?0\0\0\0\0@\0\0\0\0\0\\Temp"
The Trim(\0) doesn't seem to work as there are other special chars...

The installed SDF version is 1.4.50804.0

Is it not possible to specify another length of the buffer when reading
from ReadByteArray as the Trim seems abit unstable...

Thanks,

Peter



Well assuming that code is coming from some API call somewhere, 4 ==
'The system cannot open the file.' so that does indicate a likely
file/path issue.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Hi!

I have some trouble getting Neil Cowburns Imaging library to work, and
was hoping there are some people here that is using it. I KNOW IT'S OLD
but I'm trying to shake some life into a Qtek 9090 PPC2003SE
application by adding camera support.

I'm using a Qtek 9090 (PPC2003SE), which goes under the HTC portfolio.

The issue I have is in the Capture method when the SendMessage function
is called. The returned data from

IntPtr hwndCamWiz = GetCameraWizardWnd(_path);
This works fine, the camera application is started and a photo is
taken.

In the SendMessage method of the CallBackWindow we have these rows:
CopyData cd = (CopyData)Marshal.PtrToStructure(m.LParam,
typeof(CopyData));
CaptureData rd = (CaptureData)Marshal.PtrToStructure(cd.lpData,
typeof(CaptureData));

The problem is that rd.ReturnCode is 4, which I am not sure what it
stands for (Perhaps InvalidArgument if it follows SHCameraCapture). The
correct return code is 0.

The only place I can see something that doesn't seem to be alright is
how the savefolder variable is stored. I set it to @"\Temp" but when
retrieveing it from it's Property it's not valid. I make sure @"\Temp"
is a valid directory!

Example:
saveFolder = @"\Temp\";
_camConfig.SaveFolder = saveFolder;
MessageBox.Show( _camConfig.SaveFolder ); <-- This returns some mumbo
jumbo...

So perhaps the WM_COPYDATA message fails because of an incorrect save
path?

Any suggestion?

/ Peter
 
Back
Top