|
Glad to hear that.
Best wishes,
Navaneeth
|
|
|
|
|
hi ,
I'm New In C++ FORM crl Programing
I Want to Register Data to registry
I check Sample Code in MSDN
like this :
RegistryKey ^ regkey = Registry::LocalMachine->CreateSubKey("SOFTWARE\MYSOFTWARE\DATA");
And I got no error and 2 warning
11>------ Build started: Project: MULTINET_EXPLORER, Configuration: Debug Win32 ------
1>Compiling...
1>MULTINET_EXPLORER.cpp
1>d:\multinet explorer\multinet_explorer\Form1.h(222) : warning C4129: 'M' : unrecognized character escape sequence
1>d:\multinet explorer\multinet_explorer\Form1.h(222) : warning C4129: 'M' : unrecognized character escape sequence
1>Linking...
1>Embedding manifest...
1>Build log was saved at "file://d:\MULTiNET EXPLORER\MULTINET_EXPLORER\Debug\BuildLog.htm"
1>MULTINET_EXPLORER - 0 error(s), 2 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
but when the program runing it always gon error message
like this
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll
Additional information: The parameter is incorrect.
how can I solve this Problem ???
can anyone help me ???
|
|
|
|
|
Hi,
in C-like languages string literals treat backslash as a special character; the character following it determines the exact meaning (e.g. \t represents a TAB). To get a simple backslash, you should double it: "SOFTWARE\\MYSOFTWARE\\DATA"
I would suggest you buy and study a book on C++/CLI to get the fundamentals right.
|
|
|
|
|
Hello
Dear friends
I am stuck with this problem of combobox.It is proyect of Visual c++,i have two comboboxes ,my task is to select one item from one combobox ,and the item corresponding to this in the other combobox will select automatically.
Merry christmas and Happy new year
waiting for your kind help
|
|
|
|
|
Assuming you are using C++/CLI. Handle the first combo box's SelectedIndexChanged[^] event and populate the second one accordingly.
Best wishes,
Navaneeth
|
|
|
|
|
i have done a bit of reading in client/server programming in c#. i am familiar enough with this process to ask the following question:
how do i transmit structure objects through tcp/ip instead of just strings?
my app is a networked game with chat capabilities. so instead of just transmitting text, i would like to imploy a data structure or class structure that will have two fields: i. packet type ii. the data for the packet type
and i would transmit this when needed during the execution of the application, and decode the data object at the receiving end and place it where it belongs.
im not looking for code, just some ideas and search statements i can feed to google so i will; have a better understanding.
ive read about serialisation/de serialisation, is that he way to go?
thanks.
|
|
|
|
|
See serialization and deserialization of objects.
I use BinaryFormatter for this job.
|
|
|
|
|
i just read the following:
The Binary Formatter
The Binary formatter provides binary encoding for compact serialization either for storage or for socket-based network streams. The BinaryFormatter class is generally not appropriate when data is meant to be passed through a firewall.
--------------------
is Xml Serialization good for going through firewalls?
|
|
|
|
|
ikurtz wrote: The BinaryFormatter class is generally not appropriate when data is meant to be passed through a firewall.
I don't see that in the documentation for the BinaryFormatter class[^]
If you're using sockets, you already have an issue with firewalls.
If you can connect the sockets, then the data you put over the wire
isn't an issue - socket data is always binary. The binary formatter
is for converting your objects to/from binary (binary serialization).
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thats exactly what i thought (after some thought!). because the data is embedded it should not make a difference.
well one comes across all kinds of statements made on the web. one has to be able to use ones judgement also.
|
|
|
|
|
As others said, you can use binary serialization to send data over the wire. But take a look at projects like Protocol Buffers[^] also. There is a .NET port available and it makes data transmission easy and it does serialization and deserialization for you.
Best wishes,
Navaneeth
|
|
|
|
|
I've written a managed class that handles the serial communication to a laser using ascii text. My problem is if my GUI makes too many calls to the functions in the laser communication class I get the wrong responses back from the laser. They are valid responses but it appears as if the response from the first call is being replaced by the response from the second call. I've attempted to control the usage of the serial port by using 'Mutex.WaitOne' but that doesn't seem to have an affect. All the calls to the laser are being generated by Windows' messages within the GUI. Does anyone know of a way to control the flow of calls to the laser class? I'm using Visual Studio 2008 and Managed C++.
Thanks,
George
George
|
|
|
|
|
Why don't you try sending one command and waiting for the response before sending the next command?
|
|
|
|
|
If I run my class as part of a Console application I have no problems with it communicating correctly and getting the correct responses. My problem is when I try to run it as part of a Windows GUI application. It seems as though the compiler is making my application a multi-threaded application and it is putting the writing and reading of portions of the class into different threads.
George
|
|
|
|
|
Hi,
you can use synchronous calls such as SerialPort.Read() and SP.Write() any way you like; the thread executing the call will process the data, obviously. However some event handlers, such as DataReceived, will fire on another thread (what else could they do?). You may want to read this article[^].
And that is exactly the same for Console and WinForms applications.
|
|
|
|
|
Hello everyone.
I'm doing some research about the extension methods[^]!
I was very critical as I heard about that feature and after some research my doubt, if there is a need for it, is even higher. (But that was discussed so often now, I will not waste your time and leave it open ...)
Now my question (proplem)!
I did a test, with a solution including:
1) C# project "Provider", which contains a class Foo and a parameterless method DoFoo (all public)
2) C# project "Extensions"(which references "Provider"), containing the extension method
public static void DoFoo(this Foo fo, int inValue) { ...}
3 a) C# project "UserCs" (which reference "Provider and "User")
3 b) managed C++ project "UserCpp" (which reference "Provider and "User")
Also another test, with a solution including:
1) managed C++ project "Provider", ...
2) C# project "Extensions"(which references "Provider"), ...
3 a) C# project "UserCs" (which reference "Provider and "User")
3 b) managed C++ project "UserCpp" (which reference "Provider and "User")
What happens in both tests now is, that in "3a" I have access to the extensions Method but not in "3b".
I know that managed c++ does not provide the syntactic features (ofter heard as "syntactic sugar"), but is aware of the attribute "ExtensionAttribute", which in fact is the base technology of the extention methods.
So for me, it seems that the managed c++ compiler can not deal with the build in C# feature, where the extension method is "turned" into a static method which is placed in a static class, all "surrounded" by the "ExtensionAttribute".
I know that I'm lacking at the basic knowledge in manage c++, so I'm really looking forwared reading some expert statement pointing out the parts I have missed so far!
All the best,
Martin
modified on Wednesday, January 13, 2010 6:57 AM
|
|
|
|
|
Not sure I got your question correctly. Are you saying that from C++/CLI you are unable to use the extension method like the way you used it in C#? If yes, C++/CLI won't support extension method and you can't use it like in C#. You need to specify the class name and call the method. Just to explain, I have the following C# classes on a project.
namespace ClassLibrary1
{
public class Foo
{
public void NormalMethod()
{
}
}
}
namespace ClassLibrary1
{
public static class FooExtensions
{
public static void ExtensionMethod(this Foo foo)
{
}
}
} Here is how I used it in C++/CLI.
using namespace System;
using namespace ClassLibrary1;
int main(array<System::String ^> ^args)
{
Foo^ f = gcnew Foo;
f->NormalMethod(); FooExtensions::ExtensionMethod(f); return 0;
} C++ doesn't require extension methods. It supports free functions and that is much superior than extension methods. IMO, Extension method is introduced to give something similar to C++'s free functions.
Best wishes,
Navaneeth
|
|
|
|
|
Hello and thank you for taking time!
N a v a n e e t h wrote: Are you saying that from C++/CLI you are unable to use the extension method like the way you used it in C#?
That's correct!
N a v a n e e t h wrote: C++/CLI won't support extension method and you can't use it like in C#
I'd like to trust you, but is there a documentation which confirmes your statement?
I'm a little confused because of the supportage of the "ExtensionAttribute", which is nicely descriped in tis cp article[^]!
Maybe have a short look and tell me what you think about it.
Thanks again!
All the best,
Martin
|
|
|
|
|
Martin# wrote: I'd like to trust you, but is there a documentation which confirmes your statement?
You can trust me .
BTW, I am not aware of any document that says it is not supported in C++/CLI. But if you take a look at C++/CLI's standard, you will not find anything related to extension method. And a search on the web also tells the same.
Martin# wrote: I'm a little confused because of the supportage of the "ExtensionAttribute
There is no confusion here. ExtensionAttribute is a class which is part of .NET framework. C++/CLI can use any classes in the framework and it understands attribute classes. What it doesn't understand is to look for this specific attribute and show the method as an extension. This is simply because it is not implemented in the compiler.
C# compiler can look for this attribute and show the method as extension. So as the article says, if you apply extension attribute to the class and method from C++/CLI and used in a C# project, C# compiler reads the extension attribute and display it as extension method.
Martin# wrote: which is nicely descriped in tis cp article[^]!
It was a good read. Thanks for the link.
Best wishes,
Navaneeth
|
|
|
|
|
N a v a n e e t h wrote: You can trust me
N a v a n e e t h wrote: But if you take a look at C++/CLI's standard, you will not find anything related to extension method. And a search on the web also tells the same.
So true!
N a v a n e e t h wrote: What it doesn't understand is to look for this specific attribute and show the method as an extension. This is simply because it is not implemented in the compiler.
You know what.
I just wanted to ask you rereading the article, but as I was looking over it once again I found out that I completely missunderstood a sentence in the section "Making an Extension Method in C++/CLI".
About "ExtensionAttribute":
"Applying the attributes to the proper place in the C++/CLI project, I was able to get the extension method to show up"
Yes, but only with the C# compiler, and not with the C++/CLI compiler.
N a v a n e e t h wrote: It was a good read. Thanks for the link.
It seems, that I learned more new stuff from providing that article, than you reading it!
With your help, I think I got it now! Thank you!
My conclusion about the .Net implementation of extension methods:
All the best,
Martin
|
|
|
|
|
I was a little confused by your original question, but if are are trying find out if it is possible to <b>implement</b> extension methods in C++/CLI (that can be consumed from VB and C# as extension methods), the answer is yes.
You just declare a C++/CLI class that is both abstract and sealed, and you apply the [Extension] attribute to both the class and the extension methods you add to it, which must be public and static. The extension methods themselves do not use the 'this' keyword like they do in C#, but they're seen as extension methods by the VB and C# compilers. The example below implements a "Matches()" method for System.String:
<pre>
#pragma once
using namespace System;
using namespace System::Runtime::CompilerServices;
using namespace System::Text::RegularExpressions;
namespace System
{
[System::Runtime::CompilerServices::Extension]
public ref class StringExtensionMethods abstract sealed
{
public:
[System::Runtime::CompilerServices::Extension]
static bool Matches( System::String^ string, System::String^ pattern )
{
return Regex::IsMatch( string, pattern );
}
};
}
</pre>
|
|
|
|
|
tonyt wrote: I was a little confused by your original question
Me too!
Thanks for the summary, but I finally understood all that!
You get my 5 for careing that much.
All the best,
Martin
|
|
|
|
|
I have a “NativeToManaged.dll”, which is full of native code (no managed code, it generated LIB file for exported native class).
I used it in a test application, which is managed (C++\CLI). I could use the exported class form “NativeToManaged.dll” and works fine in RunTime.
Now I added some managed code (C++\CLI) in “NativeToManaged.dll” and made the project settings to “Common Language Runtime Support (/clr)”. I didn’t modify anything in test application. It compiled fine. But while in RT it throws an exception
“An unhandled exception of type 'System.IO.FileLoadException' occurred in testInt.exe”
“Additional information: Could not load file or assembly NativeToManaged, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Could not find or load a type. (Exception from HRESULT: 0x80131522)”
Help me to fix this problem
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
We're having a problem on a few client machines where our managed C++ MFC app will not start. Its a managed c++ app linked to some C# dlls. It won't even hit the constructor or OnInitApp.
Its almost identical to this: http://www.eggheadcafe.com/community/aspnet/36/10076902/mixed-c-managed-c-c.aspx[^] but of course there was no solution posted.
I have one of the offending machines and it starts in safe mode, but not when starting windows normally. I have also shutdown nearly every service, including anti-virus apps. It seems like something is blocking it but everything that possibly would be blocking it has been turned off.
Tried running the CLR Profiler with the app but the clr doesn't start.
Any clue's as to what is causing this would be appreciated.
Thanks
"Make everything as simple as possible, but not simpler." - Albert Einstein Jason Henderson
|
|
|
|
|
Jason Henderson wrote: Tried running the CLR Profiler with the app but the clr doesn't start.
Can you run any other .NET application on this machine? If not, I guess the problem will be with the setup of .NET framework.
Best wishes,
Navaneeth
|
|
|
|