|
Check out this page[^] I came across yesterday.
|
|
|
|
|
Good article though. I follow those conventions except for the "underscore on the end of class-level variables" thing. For class-level variables, I do m_varname
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Is there a utility that will take a win32 executable and generate a P/Invoke wrapper class for all the function that it exports.
|
|
|
|
|
The basic answer is no.
Imagine a tool that would do just that. Unless all functions pass and return trivial parameter types like int and char*, tell me how this tool manages to wrap the structures, classes, or whatever might be mangled in the exported functions without knowing their declarations ?
My recommendation is to use MC++ mix mode instead. That is write a wrapper library which does internally all native calls, and don't need marshaling. A bit overkill though if you only need a few interop to be done.
[edit]I have an url[^] for you.[/edit]
|
|
|
|
|
Yeah, I understand that you can't do functions that return custom parameters.
I just wan't to do the basic ones, like you said - the ones that return string, int, intptr, bool, etc.. I know that there are tools that make a list of exports. It shouldn't be that hard to take a list of exports and make the p/invoke code.
|
|
|
|
|
AK wrote:
It shouldn't be that hard to take a list of exports and make the p/invoke code.
I disagree. Suppose one of C/C++ parameters is LPSTR. How does the converter know that's an input parameter (C# string), or output parameter (C# out string). Another example, many functions in the WIN32 API use two parameters to allow to pass a fix-size LPSTR string along with the max size of it. You know this got to be translated using C# stringbuilder. Again how does the converter knows it ?
I could go on for years, especially if you get me started on marshaling issues, which add noise to it.
The only thing I see is the equivalent of the WIN32 API viewer, that tiny tool provided by MS in their site and which allows to interactively browse the WIN32API.txt file. May be someone is bold enough to write a WIN32API.csharp.txt will all premarshaled stuff in it. Here is an entry point[^].
|
|
|
|
|
System.IO.Stream sound_stream = new MemoryStream(buffer);
DirectSound.Buffer k = new DirectSound.Buffer sound_stream,applicationDevice);
--------------
Well, the buffer is a byte[] that I record from DirectSoundCapture , Now I want to play this byte[] , I study MSDN know that I should create a Stream
and write buffer in . Then create a SecondaryBuffer to play this Stream , my code is above , but it shows a error such that :
An unhandled exception of type 'System.ArgumentException' occurred in microsoft.directx.directsound.dll
Additional information: Value does not fall within the expected range.
I can't solve this problem , can anyone help me ???
Of course , I can write buffer into file and then open it , but I don't want
to waste time to do this process , I want to play sound form the buffer directly .
If you have a solution or can't understand about my post , please mail to me
j741119@Ethome.net.tw
Thank you for reading this bad grammar article .
I am Craze JmmJ !!! A student from Taiwan who are instrest in Programming.
|
|
|
|
|
JmmJ wrote:
System.IO.Stream sound_stream = new MemoryStream(buffer);
DirectSound.Buffer k = new DirectSound.Buffer sound_stream,applicationDevice);
System.IO.Stream sound_stream = new MemoryStream(buffer);
DirectSound.Buffer k = new DirectSound.Buffer<big>(</big> sound_stream,applicationDevice);
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
I knew that post would catch you.
|
|
|
|
|
.S.Rod. wrote:
I knew that post would catch you.
Yeah, nothin escapes the Code Police
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
OHHHH......... What a terrible bug it is . @@
|
|
|
|
|
I would like to create a help/info documentation for programms like in the VS .NET help.
What is the way to get on to it?
Any links?
Thanks
Stefan
|
|
|
|
|
|
http://ndoc.sourceforge.net/
|
|
|
|
|
Hi,
I'm using MSHTML in my project, as wrapped in Microsoft.mshtml. Does the .NET garbage collection automatically take care of these resources? Can I explicitly dispose of them somehow? I'm a bit concerned that there might be some memory leaks if I create a large DOM tree and then don't dispose of it somehow.
Thanks,
Arun
|
|
|
|
|
1. If you are concerned about memory internals anyhow, may be managed code is not the most adequate language.
2. Marshal.ReleaseComObject(...)
|
|
|
|
|
1. If you are concerned about memory internals anyhow, may be managed code is not the most adequate language.
Yes, that's true, but it's the best language for my task right now.
2. Marshal.ReleaseComObject(...)
Well, I tried that, and I see no indication that the memory is being deallocated.
I also have this code before that -- myObject is IOleObject for the HTMLDocument object I'm using.
const int OLECLOSE_NOSAVE = 1;<br />
myObject.Close(OLECLOSE_NOSAVE);<br />
myObject.SetClientSite(null);<br />
Thanks so much for your time, you are a true Samaritan.
|
|
|
|
|
Arun Bhalla wrote:
Well, I tried that, and I see no indication that the memory is being deallocated.
The best I can do for you is point the url[^] to one of the horses behind the CLR.
Arun Bhalla wrote:
I also have this code before that -- myObject is IOleObject for the HTMLDocument object I'm using
Internet Explorer is known for having leaks. Welcome to the club!
|
|
|
|
|
The subject pretty much says it!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
What's the question? How? Can?
|
|
|
|
|
As a general rule,
If the .NET API for a given control does not seem to expose the method you are looking for, then make sure to give a look at the WIN32 API for the underlying control.
In the case of RichText controls, you'll find that there is no direct way of selecting a row either.
Which brings to the point you have to build this selection somehow.
The Find methods exposed by the RichText control both search then select text.
Since none of these methods take a line number as parameter, I am afraid you have to build a char range yourself then call
[C#]
public int RichTextBox.Find(
string str,
int start,
int end,
RichTextBoxFinds options
);
The char range can be obtained by doing preliminary Find (with no selection flag) searching the carriage returns or whatever info you might know.
|
|
|
|
|
Hi,
I need to a pointer to an article or web page or something that will help me get started in developing a certain app. Basically, I need to send an email that as user has written and the email message has to show up in the user’s Sent Items folder in MS Outlook. The program is to be deployed on computers with Win2K using Outlook 2000.
I would like to do this in C# but since its Outlook 2000 would I be better off sticking to C++? Any pointers to creating an Outlook 2000 object in C# would be greatly appreciated!
Thanks!
Kevin
|
|
|
|
|
Outlook object model[^].
As said in the pointed page, you have to import the MSOUTL.OLB type-library to bring the wrapped object model into the .NET world.
|
|
|
|
|
Try to search MSDN
http://msdn.microsoft.com
|
|
|
|
|
V. useful outlook resource.
http://www.slipstick.com/index.htm
|
|
|
|