|
First of all, you don't need the EntryPoint property if the entry point is the same as the declared method name.
Second, where is the NullReferenceException getting thrown? It wouldn't be thrown from string descr = getDescr(123); . Perhaps the descr is null and you're trying to call a method on it, but you should always check conditions and not assume anything, such as if an actual reference was returned (value types can never be null unless they're boxed).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
reply 1) there are various funcion into a DLL, so I need an Entry Point
reply 2) into a DLL, descr is NEVER null, I created a function that print out a log file that contain the descr value.
I don't understood because "NullReferenceException" one time get thrown and the next time no!
bye
|
|
|
|
|
Trust me - I know interop in .NET. You don't need to specify the entry point if the method name is the same because the method name is used as the entry point.
I wasn't talking about in your C/C++ DLL - it wouldn't throw a NullReferenceException anyway - that's thrown by the runtime. I was talking about the variable that takes the return value of getDescr called descr . If it's null and you try calling a method on it you will get a NullReferenceException . Assuming that your code "just works" is never a good practice.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi there,
I'm making this application, that need to use some methods from a lib-file. I think that the lib-file i created i VC60, but I'm not sure.
How du I use this file in C#? I can't add it as a ressource. I can't use DLLImport.
The lib-file and a header fil (.h) is the only files I have avalible. What to do???
I found out that I can use the files i VC60 to make an application. I the answer to my question that I have to make some kind of a wrapper class?
|
|
|
|
|
hi,
As far as I know, using the lib and .h file make a DLL(Win32) or a COM component using VS 6.0 and then use it in .NET
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
You mean like a wrapper class.
|
|
|
|
|
So you have some lib file which is created on VC. What you can do is,
use tlbimp.exe (type library importer ).
you will get Visual Studio .NET Command Prompt in your progarmm menu through VisIDE option.
choose - MS Dotnet - Visual Studio .NET Tools -Visual Studio .NET Command Prompt
There you type
tlbimp.exe YourLibfile.lib /out : MyResultentDll.dll /verbose
( if you have YourLibfile.lib in your c drive and you want the resultent .dll on c drive you can simply copy the above syntax and change the file names that you required.
Otherwise give the path and file name of lib file and give the path and name of resultent file.)
/verbose is used to get full output info.
Here you will get a .dll file and use can easily refer this in your project.
Sreejith S S Nair
|
|
|
|
|
I have tried what you are descriping and I get an error that says: "The innput file filaname.lib is not a valid type library"
|
|
|
|
|
That's because a .lib file is used only during binding. If you want to P/Invoke functions, in the API documentation for those functions when it says a function is exported from, say, user32.lib, you actually use user32.dll. The .libs are documented because those are what you actually need to link against when linking your native (i.e., C/C++) application or library.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Do you have any idea what a .lib file is? It's used only for linking during the link step of compiling a native (i.e., C/C++) application or library. They cannot be used in such a way.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That is strange. If I include the lib-file i C++. It works!
I cannot find any dll file that should contain the source. If I only colud find that my problem would be resolved.
Do you have any ideas, who to find it???
|
|
|
|
|
Like I said, C/C++ use .lib files to link when you're compiling and linking your source. This resolves exports, their relative addresses, and maps them into your code. When executed, your app or library actually binds against the DLL. The .libs are only used during linking and only work in C/C++.
.NET is managed environment, managed by the Common Language Runtime. There is no such linking (at least, not in that way). They are two completely different environments.
I suggest you read-up on .NET at http://msdn.microsoft.com/netframework[^] and get an overview of what actually happens.
If you want more specific information on P/Invoke, see Consuming Unmanaged DLL Functions[^] in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your answers and your time.
|
|
|
|
|
You actually P/Invoke using the .dll. A .lib is used only when linking your C/C++ compiled code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want get printable area. I get them by call GetDeviceCaps. But I get the defalut printable and when I change paper size by System.Windows.Forms.PrintDialog, the printable don't modify. It still be the defalut printable area.How can I get the correct printable.
Thank you very much
|
|
|
|
|
The printable area of a document is entirely based on your implementation. If you only want a certain region to be printed, then only print that region in your event handler for the PrintDocument.PrintPage event.
If you're talking about margins, see the PageSettings.Margins property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you.
But I want to get the Printable area before the PrintDocument.PrintPage event.
|
|
|
|
|
Again, this is entirely up to your implementation. There is nothing that sets a printable area in the printing classes in the .NET FCL. You should keep a variable that defines the printable area and set it through whatever means you like.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I want to dynamically allocate datagrids depending on the input. So I declared a datagrid array .But it is not working . Can I do this way?
I tried keeping a single datagrid .It is working. Later I changed it into array keeping a loop.Now it is not working.
Karteek
|
|
|
|
|
let me conform this. you want to dynamically create grid based on some values. am i right ?.
if not explain your problem little bit more
Sreejith S S Nair
|
|
|
|
|
Hi,
I will take the number as input from the user and display as many datagrids as the number is.They don't have any values for present.( Later he can select the values to be present in each datagrid.)
Karteek.
|
|
|
|
|
Instead of using different DataGrid s based on the input, use the DataGrid.TableStyles property to define different table styles with explicit DataGridColumnStyle s. That's what it's there for. See the documentation for the DataGrid.TableStyles property for more information and an example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The question isn't how do I split it into binary chunks which are unplayable but rather, "How do I split it into multiple playable .avi files?"
What I'm actually trying to accomplish is to cut a section out of an avi and have a shortened version which is playable.
I also need this process to be fast. The avi's are in RLE format and their audio is PCM (if that helps).
I also do not need 3rd party applications to do this it must be done within my app (even if I have to kluge a commandline to do it for me).
Also, importantly, I need to be able to tell it from what point to what point to cut out...though that seems obvious to me.
Thanks in advance for your help, you all are excellent!
--Tony Archer
"I can build it good, fast and cheap. Pick any two."
|
|
|
|
|
|