Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecsharp
themeConfluence
titleAddSignature
linenumberstrue
//STRUCT
public struct SearchResult
{
	public doubleint LeftXmlFieldIndex;
	public int FieldType;
	public int PageNumber;
	public double TopLeft;
	public double RightTop;
	public double BottomRight;
	public double PageNumberBottom;
}
            
//resLen must not be zero
             
uint resLen = maxSearchResultLen;
int size =  Marshal.SizeOf(res[0]);
IntPtr ptr = Marshal.AllocHGlobal((int)resLen*size);
IntPtr tmpPtr = ptr;
uint pstruct = (uint)ptr;
            
bool result = false;
pageList.Items.Clear();
 
try
{
	result = SignAPIv4.SearchKeyString(textBox6.Text, "", ref pstruct, ref resLen);
                
	for (int i=0; i< resLen; i++)
	{
		res[i] = (SearchResult)Marshal.PtrToStructure((IntPtr)pstruct, typeof(SearchResult));
		tmpPtr = (IntPtr)((int)tmpPtr + Marshal.SizeOf(typeof(SearchResult)));
		pstruct = (uint)tmpPtr;
 		pageList.Items.Add(i+1);
	}
                
	x1 = res[0].Left();
	y1 = res[0].Top();
	x2 = res[0].Right();
	y2 = res[0].Bottom();
	page = res[0].PageNumber.ToString();
}

...