|
Thnkxx again sir
|
|
|
|
|
Hi
Now I try to work with C#,but my trouble common and with COM programmin in standart C++. My application had to process an *.xml file through Excel COM. Cause of I use native Excel help for VBA : “VBAXL9.CHM” .But there is any troubles .When C# generate proxy for excel object it not consider about optional argument and cause of I should explicit pass this arguments every time in methods call. In many places into excel help referenced behavior of an methods with parameters by default (optional parameters which omit), but I don’t know what it are.
Where I can learn about definition of this defaults parameters????
|
|
|
|
|
Use Missing.Value , or something like this for optional parameters:
object missing = Missing.Value;
excel.Save("filename.xls", ref missing, ref missing, ...); (Note: this is sample code; it won't compile)
The help still applies. Since the RCW (Runtime Callable Wrapper) is generated over the typelib, the types and members are the same (may marshal a little differently; knowing comes from reading and experience).
Read Interoperating with Unmanaged Code[^] in the .NET Framework SDK - especially the parts about COM interop and COM marshaling - for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
And quit crossing posting in so many Forums. It's considered very rude...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi there all
Has anyone experienced the NetworkStream gotten from the TcpClient underload conditions sends out packets in reverse!?
I have done a low-level packet capture of my local port and it confirms what I see at the server. Packets that are queued , tend to get mixed up when the buffer is not full. Seems to send the packets while actually sorting them... any ideas?
top secret xacc-ide 0.0.1
|
|
|
|
|
Set TcpClient.NoDelay to true (default is false ). This disables coalescing of packets by sending them immediately instead of storing them until a significant amount of data can be sent. This results in a more chatty protocol, but should eliminate the problems you're having.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
TcpClient.NoDelay to true
Tried that, and every property I have access too, still the same...
top secret xacc-ide 0.0.1
|
|
|
|
|
Other things I have tried (but same results):
- Send ever packet via a threadpool
It only happens when the NetworkStream is buffering (when doing Write in "quick" (still by hand!) succession). Its not the server either, this has been verified by the captured packets, and the fact that an unmamaged client behaves correctly in the same scenario.
top secret xacc-ide 0.0.1
|
|
|
|
|
Out of curiosity (sorry, no clue what might be wrong without digging into lots of IL (and a lot is actually internal implementation in the CLR - I always hate that road block)), why would you try to solve this in a ThreadPool ? I would expect that to make it worse (nothing says your queued work items are executed in order).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My initial idea, although I dont think it works like I thought ( ) was to just get a little pause or something, tried some locks too.
Basically I place a Console.Write after the NetworkStream.Write , so I can see it IS being dispatched by me, in a sequencial order, which I have confirmed.
Here is a trimmed version of a packet "dispatch" leaving my port, as captured, by NGSniff and WinPCap, each line refers to a stream.Write action, where the id is generated sequencially, and the data is just entered on the keyboard. This refers to a single packet leaving my network port.
id="msg135" 7
id="msg134" 6
id="msg136" 8
id="msg137" 9
In this case, the order seems random, most other cases the order seems to be in reverse, that would look like:
id="msg137" 9
id="msg136" 8
id="msg135" 7
id="msg134" 6
This can surely not be the real behaviour of the NetworkStream, as for a workaround I would have to add an unessary packet layer that should already be provided on a lower OSI level.
Thanks for trying to help though
top secret xacc-ide 0.0.1
|
|
|
|
|
I'm developing components in separate .dlls. Unfortunately I have to manually delete the compiled .dlls so that they are refreshed in the main project each time I change them? Is there any other way (automatic)?
It is the same story with the resources but I know it is an issue with VS.NET. It is quite annoying each time I change a resource I have to remove it and then add it again.
|
|
|
|
|
Remove the assembly references. Right-click on the project that depends on those assemblies, select Add Reference. Click the Project tab and add the projects in your solution that your current project depends on. Now a build dependency is established so that any changes in a dependent project (or their dependents, etc.) will force a recompile and - if necessary - will copy the newly built assembly into the target path for the project that depends on it. This also makes sure that the versions are never incorrect, though you really shouldn't use automatic versioning in larger solutions because versions in .NET are important (they are part of what defines a Type - a difference only in version results in different Types).
If you read the Visual Studio product documentation - or even just explore the IDE - you can find a lot more useful tips.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, all my projects are in the same solution from the start but most of the time, when I change any of the .dlls the newer versions are not copied in the .exe folder. Most of the time this happens only if I delete the bin folder and execute Build twice.
I have thought about outputting the compiled .dll directly in the main projects bin folder but I haven't tried it yet. there should be a more logical solution.
|
|
|
|
|
Cristoff wrote:
there should be a more logical solution
There is: as I said, reference your projects in a solution using the Projects tab - not the .NET tab. Trust me - I managed a solution of well over 60 projects as the senior software architect and build master for a very large, N-tier .NET application using VS.NET.
This will set up build dependencies and will update your dependent assemblies for a project that references them (directly and indirectly) in the target path (bin\Debug, bin\Release, etc.). And also as I said before, this is documented in the Visual Studio product documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you,
I have followed your suggestion and I think I have found your proposed solution.
I have been so convinced that adding an assembly reference is all I have to do that I have never thought that Project dependancy is something different.
BTW I have almost given up programming at the end of the last year and I haven't touched a compiler since then but the necessity has made me do it again
Your so helpful to the community! Thank you!
|
|
|
|
|
i m writting a C++ Win32 DLL which is called by a C# application.
i want the DLL can trigger an event to the Calling C# app after some operations which might like the Win MSG mechanism: The DLL send a message to the C# app and the C# app handle the msg.
the C# use the EventHandle/EventArgs on this issue.
But can i trigger an event to C# app in a C++ Win32 DLL ?
please help me.
|
|
|
|
|
If you pass a handle (the Handle property for controls) to your unmanaged DLL (P/Invoke is easy enough, and I assume you know how to do it), you could always call SendMessage in your unmanaged code to send a message to a control. In your control class (assuming you've extended a class), override WndProc and handle the message. Don't forget to call base.WndProc to continue processing all messages that go through the window procedure for the Control .
Another way is to expose your .NET component as a COM control (following correct guidelines, which aren't too obvious when reading the .NET Framework SDK but any COM developers should know). Your unmanaged code could instantiate a new or reference an existing instances and call a method that raises an event defined on your .NET component.
While my article isn't exactly about this, per se, it does offer a lot of insight into this method. Read Embedding .NET Controls in Java[^], which discusses bridging .NET and Java with C++ (JNI and COM). You shoudl find a lot of helpful information in there about what you're trying to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi Guys,
I developed a An approval page using c#. Our users want that after pressing the Complete button the current page with all the information will become an attachment of my email so that I can send this page to anywhere I want.
My first solution was to give a link from the email, when the person clicks the link it will redirect him to the page with the information based on the key as parameter. THe problem is we have users or vendors that doesn't have access to our server. They just want to have a copy of the information by email.
If you have any other ideas please let me kknow, I would appreciate it very much.
/dabuskol
|
|
|
|
|
What exactly do you mean by "page"? I assume you mean a web page and that you're talking about an ASP.NET site. If that's true, not only do you not have any control really what's on a client tmachine (all your code is sever-side, but client-side scripting might be a little helpful assuming your script is granted enough privileges), but you're posting in the wrong forum. Post in the ASP.NET forum here on CodeProject.
If you aren't referring to a web application, please elaborate.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Don't tell me - I didn't ask the question. Reply to the original poster.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I cannot figure out how to ask the user for input if a form should be closed (or application exited), when alt+f4 or the X button is clicked?
Is there an event being fired when the user clicks the X button (the one on the caption bar)?
|
|
|
|
|