I think you have to set the RtsEnable flag. port.RtsEnable = true;
try it out
kristmun
Posts
-
serial port + data receiving event -
String to Byte Array ConversionI guess you could use the Encoding class (System.Text). Encoding encoding = Encoding.UTF8; byte[] b = encoding.GetBytes(s); But you have to use the right encoding. Hope this helps.
-
Unmanaged in manageI think that the cleanest way to access unmanaged functionality in .NET(c# or C++/CLI) is to write a wrapper in C++/CLI. There you will have an extra .dll, but you have bounded all unmanaged code within that .dll.
-
Loading an assembly at runtimeWorked, thanks!
-
Loading an assembly at runtimeHi, I´m trying to load an assembly at runtime with:
ObjectHandle plugin = System.Activator.CreateInstanceFrom(@"C:\PathToDll\MyDll.dll", "PluginClass");
But this returns a strange error: Exception has been thrown by the target of an invocation. "The targetNamespace parameter 'MyDll' should be the same value as the targetNamespace 'urn:MyDll' of the schema." ok, where does a schema come into the picture? All help would be appreciated. -
Value classes and structsHi guys, I was just wondering if it is possible to assign a value class direct to a unmanaged structure without assigning individual variables and vice versa? /krissi
-
Hi!!!I think you should begin with finding out how message boards work. First thing is to find the right message board, in this case you are in the wrong one. This message board is only for C++/cli. Second thing is that you never ever ask someone to do your homework. With this said I think you should google a c tutorial or buy a book. Good luck.
-
FTP programming using Winsock. Possible?Just remember Andrew that you need at least two channels, one to issue the commands and one to transfer the data. Good luck! /krissi
-
Conversion Issue [modified]This one works for me Stings /krissi
-
Copying data from unmanaged to managedHi guys, thanks for the advice. It works now using the Copy method
array<unsigned char>^ value = {'a','b','c'}; char* ptr = new char[value->Length]; Marshal::Copy(value,0,(IntPtr)ptr,value->Length);
and the other way aroundint length = 3; char str[] = {'d','e','f'}; char* pStr = &str[0]; array<unsigned char>^ strArr = gcnew array<unsigned char>(length); Marshal::Copy((IntPtr)pStr,strArr,0,length);
I didn't quite get the value class way :sigh: -
Copying data from unmanaged to managedHi, I am trying to copy data from a structure
typedef struct OctetString { unsigned int length; unsigned char *value; } OctetString;
I have only managed to copy the value using a for-loop and an ArrayListOctetString* data; ArrayList^ bits = gcnew ArrayList(); for(unsigned int i=0;i<data->length;i++) { bits->Add((char)*data->value); data->value++; }
My question is: Is there a better way to copy the data into the ArrayList, and is there a more suitable structure than a ArryList to handle binary data of different lengths? /krissi -
Accessing a List object in Mixed mode code.Works like a charm! Thanks Mike
-
Accessing a List object in Mixed mode code.Hi guys, here is my problem I have defined a list of managed objects in MyClass.h:
class MyClass.h { public: MyClass(); gcroot<List<MessageListener^>^> messageListeners; }
and using the list in the .cpp fileMyClass::MyClass() { messageListeners = gcnew List<MessageListener^>(); } void MyClass::addMessageListener(u_short id,u_short version) { MessageListener^ msgl = gcnew MessageListener(id,version); messageListeners->Add(msgl); }
...as you can see I'm trying to use a list of managed objects in an unmanaged class. My problem is than I can't access the objects in the listvoid MyClass::findMessageListener(u_short id,u_short version) { for(int i = 0;iCount;i++) { MessageListener^ msg = messageListeners[i]; if(msg->id == id && msg->version == version) { return msg; } } return nullptr; }
I would like to have some comments on how this can be done. Thx