|
|
|
I don't quite understand what dispose method exacly does. From manual I read that it "frees up ny ressources being used". But what happens to the object after calling dispose method ? Is it destroyer ? Also - is there any link between an object's destructor and dispose method ?
Regards, Desmond
|
|
|
|
|
|
IDisposable.Dispose (you must implement IDisposable for this to be used correctly) is best used to free native resources (since many classes in .NET use native HANDLE s). You can also use it to dispose child objects and set references to null .
This is not a destructor, though. In fact, many times when the Dispose method cleans-up the resources, it will tell the GC to not call the destructor since there's nothing left to do (be sure you clean-up all resources before doing so, though):
public void Dispose()
{
GC.SuppressFinalize(this);
} For a more thorough example, see the documentation for the GC.SuppressFinalize method in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
there is a Garbage Colection 101 article on CodeProject here[^]
-------------------------------
Joan
MomComputerGeek.com
|
|
|
|
|
Hi,
I have two panels side by side.
In runtime, I am adding dyanmic controls to both of panels.
(control label A is insert to Panel1 and Panel2.)
Suppose I insert 50 Labels to both panels. If I move the scroll bar of Panel1, I also want to move the scroll bar of Panel 2 at the same time. How can I do that?
Please show me the way how to do that. I try to use SendMessage Method, but I do not success.
Regards,
|
|
|
|
|
|
Hi Matthew Hazlett
Thank you for your article. After study your articles, I port that code to C#. now I done the scrolling case between two pannels. But I face the other problems. when I put the autoscroll properties "true", I got the autoscroll panel. But I don't want to see auto scroll panel in Panel A. How do I do that? I mean I want to get the same as "Excel". Line Number panel has no "auto scroll".
Thank you for your input.
Regards,
|
|
|
|
|
I am trying to find a way to read the text out of a PDF file as a search facility. This is a requirement that a client has asked me to quote on. My application is written in C#.
I am having a lot of difficulty trying to find any examples or even .NET components that I could purchase to do this task.
This application will be running on a server with very limited permissions. I have no ability to install standard COM components.
Hope someone can help.
Enjoy
Craig
|
|
|
|
|
PDF'S wern't really made for people to be able to rip text contents. However I did see somthing for .NET and PDF'S that I "think" can read them. I am not sure I never tested this out but just remember the link.
http://sourceforge.net/projects/pdflibrary/[^]
The project is now defunct but maybe you can use some of the code.
Hope this helps
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
Thanks for your help.
I looked into that product, which was stopped at a very green age. There is also itextsharp.sourceforge.net[^] which seems to be extensive in its generation ability but specifically points out the same as you have, that PDF's aren't made to rip text.
So the solution I have found that works for me is that Adobe has a filter for Microsofts indexing server that allows for searching through PDF files. See http://www.adobe.com/support/salesdocs/1043a.htm[^] for more information. I can use Chris Mauders article on using indexing server as a search facility to code the rest.
Enjoy
Craig
|
|
|
|
|
Actually, PDFs weren't made to stop "ripping of text", but to solve a common problem - to provide a standard format for delivering rich content on the web (among other media).
You can get the text because the text is available in PDFs unless the page is one giant image (which is rare).
There's many ways to get text. One easy way is to install Adobe PDF IFilter 5.0[^]. An IFilter is an interfaces that COM servers implement to facilitate searching of text. Office installs their own implementation, and Windows 2000 and higher have default IFilter implementations for searching text files, HTML documents, and several other common formats.
While this would be easiest to use in C++, you can P/Invoke the necessary APIs and redeclare the interfaces so that you can use them in C#.
There is an example that gets the IFilter for a doc (the system provides the right implementation, so you could easily replace the .doc filename with a .pdf filename) here: http://sqljunkies.com/weblog/acencini/posts/716.aspx[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
I have a library FPLIB.DLL with have the following function:
DLLEXPORT DWORD WINAPI FPMGetImage(BYTE* buffer);
How I declare my access in C#? What is byte* ?
[DllImport("fplib.dll", EntryPoint="FPMGetImage",
SetLastError=true,
CharSet=CharSet.Ansi,
ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern int FPMGetImage( buffer);
Thanks for all help!
Alexsander "Axia" Antunes
|
|
|
|
|
byte* is a pointer to a byte structure.
And need to be compiled in an unsafe block.
You can try using ref in the decleration to get around the pointer.
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
Have you an example of API Windows with use BYTE*?
Because I use API Viewer 2003 and I can compare the sintax.
Alexsander "Axia" Antunes
|
|
|
|
|
I asked somthing like this the other day, heres what Heath Stewert told me:
>Instead of passing byte* as the parameter, declare your parameter using either ref or out
>for value types (like a Byte). This is the most common method.
>
>For instance, if the C functions is declared like so:void SomeFunc(byte* b);
>...declare your method like so:[DllImport("...")]private static extern void SomeFunc(ref byte b);
>Microsoft MVP, Visual C#
>My Articles
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
OK!
<br />
[DllImport("fplib.dll", EntryPoint="FPMGetImage", <br />
SetLastError=true, <br />
CharSet=CharSet.Ansi, <br />
ExactSpelling=true,<br />
CallingConvention=CallingConvention.StdCall)]<br />
public static extern int FPMGetImage([In, Out] byte[] buffer);<br />
This code run perfectly! THANKS FOR ALL!!
Matthew Hazlett wrote:
I asked somthing like this the other day, heres what Heath Stewert told me:
>Instead of passing byte* as the parameter, declare your parameter using either ref or out
>for value types (like a Byte). This is the most common method.
>
>For instance, if the C functions is declared like so:void SomeFunc(byte* b);
>...declare your method like so:[DllImport("...")]private static extern void SomeFunc(ref byte b);
>Microsoft MVP, Visual C#
>My Articles
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
Alexsander "Axia" Antunes
|
|
|
|
|
I have a generic "value" object as a property within a class which can then be later filled from either columns from a DataReader (retrieving) or from a text box, scrollbar or other input control (restoring).
Later on the data is compared with another property which is defined on class construction, a System.Type. So this is basically acting as a datatype constraint: I intend for it to produce an error if the type of "value" does not match the constraint.
Now here's the problem, I can't find a way to create a dynamic type-cast, or a comparison with "is"/"as". Any ideas?
|
|
|
|
|
for dynamic casting use Convert.ToType(oject, dynamicobject.Type.BaseType)
where dynamicobject.Type.BaseType (or a similar expression ) would give you the base type of the object that you have. - i hope this is what you are looking at.
|
|
|
|
|
|
HAHAHA_NEXT wrote:
Use the typeof operator
Not much use with casting...
top secret
|
|
|
|
|
Sorry my error. Did not see, the fact that hee needed to type case the object after verifiing that it was of teh good type.
|
|
|
|
|
Is there a difference between MyMethod1() and MyMethod2() ? First method doesn't use this , second method does use it. Same thing in constructor:
public class MyClass
{
int i1, i2;
MyClass()
{
i1 = 10;
this.i2 = 20;
}
int MyMethod1()
{
int iRet = i1 + i2;
return iRet;
}
int MyMethod2()
{
int iRet = this.i1 + this.i2;
return iRet;
}
}
Regards, mYkel
|
|
|
|