Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

stonee74

@stonee74
About
Posts
16
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Socket Problems on particular machine
    S stonee74

    any ideas? thanks... stonee

    .NET (Core and Framework) csharp help visual-studio data-structures

  • xml comment tags
    S stonee74

    Hi there, I am havin an enormous amount of c++ comments /** blabla **/ to be translated into xml tags /// /// blabla /// is there a way to automate this in vs .net 2003 thaks, stonee

    C# csharp c++ visual-studio xml

  • Socket Problems on particular machine
    S stonee74

    Hello There, I am looking for a solution of this problem now for weeks. I am using VS .NET 2003 on Windows2000 SP3. I am programming in C#. Creating an instance of a Socket //Socket Instance m_socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); results in the following message: An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full I have researched on the internet but found no useful information yet. I do not want to connect to a host higher than 5000, and I have 3NIC's installed on my machine. Any help is greatly appreciated. regards, stonee

    .NET (Core and Framework) csharp help visual-studio data-structures

  • Working with events
    S stonee74

    thanks, I'm sure this will work. I have in my original class a method definition. I still cannot understand the errormessage.. private void ESControl_OnConnectionProblem() { } thanks for all inputs. regards, stonee

    C# help question

  • Working with events
    S stonee74

    Hi there, I would like to notify my app if a socketconnection is broken. I tried to use a self created event, with wich i want to notify an upper class in such a case. The problem is i receive a unhandled exception of type 'System.MissingMethodException'... Why? What Am i doing wrong and what means this error? Thanks a lot, stonee internal delegate void ConnectionHandler(SocketException se); ............ public class Control { internal event ConnectionHandler OnConnectionProblem; ................ public Control() { OnConnectionProblem+=new ConnectionHandler(ESControl_OnConnectionProblem); .................... catch(SocketException se) { / MessageBox.Show (se.Message ); try { OnConnectionProblem(se); } catch(MissingMethodException mme) { MessageBox.Show(mme.Message+"::"+mme.InnerException); }

    C# help question

  • accessing GUI
    S stonee74

    Ok, thanks for that. But just for my understanding; I have a method in class a, providing a certain information. internal void OnAnswer(object myobject) { myobject.message } and my main class public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.ListBox listBox1; } what's the best approach to add myobject.message to my listbox? and what's the easiest one? thanks again, stonee

    C# question

  • accessing GUI
    S stonee74

    Hi there, I want to split up my app into a GUI part and the some "working" parts behind. Which means to access certain parts of the GUI (e.g. Listbox) and fill it with data generated in nother methods of other classes. For me as a newbie i could maybe imagine some ways to do it, but what's the professional approach on that one? Are there any tutorials around related to that? thanks a lot in advance, stonee

    C# question

  • 32byte Char[] Unicode array conversion
    S stonee74

    sure, thanks for that! :zzz: stonee

    C# data-structures help question

  • 32byte Char[] Unicode array conversion
    S stonee74

    Hi there, What's the best approach to convert a 32byte Char[] Unicode array to a simple string? char Name[0] char Name[1] char Name[2] ... char Name[31] thanks for your help, stonee

    C# data-structures help question

  • byte[] to int32 conversion
    S stonee74

    found a solution with the System.BitConverter.ToInt32(mybyteArray,4); thanks anyway, stonee

    C# data-structures question

  • byte[] to int32 conversion
    S stonee74

    i am talking about a byte array consisting of 4 bytes! thanks, stonee

    C# data-structures question

  • byte[] to int32 conversion
    S stonee74

    hi there, Just a quickie: Are there classes around to directly convert a 4byte big byte array to an Int32, or do I need to go the manual way? Thanks a lot, stonee

    C# data-structures question

  • existing code from c++
    S stonee74

    Hi There, I hope somebody can give me some good advices: I need to use an existing Programming Interface which is available whether as a 'COM object dll' or' 2 C++ header files' under .NET. I used the COM object, this works quite nice in VB.NET and as well in C#, using the System.Runtime.InteropServices.TypeLibConverter class. In fact everything will be done automatically and i can use my Interface like in the unmanaged world, great! The main problem is, I develop an application on a PocketPC, under the .NET Compact Framwork. Since this System.Runtime.InteropServices.TypeLibConverter class does not exist under the .NET CF, i need to use the C++ interface, but this gives me headache. So far I found out the following: 1)use (unmanaged) C++ Code in the managed world of .NET 2)use the built-in .NET runtime interop facilities to talk directly to the existing code. 3)wrap the code using the managed extensions to C++. 4)rewrite the code in a .NET language. I wanted to go in direction 4) originally, but I'm no longer sure what makes really sense on this one... My interface is consisting of 3 header files. 2 of them are simply describing enumerations and structs. The third one consists of helper classes in C++ which are easing the use of this interface a lot. I assume that when I would go the wrapping way, that I would only need to wrap the classes I directly touch from my App in c#? If yes then I woud need to wrap only 2 classes? What way to go would be the best, wrapping interop, rewrite? But how would I do that best? Could somebody give me an idea how to do that? Thanks a lot, stonee Attached the sample classes: //sender.h Class1 to wrap: // Macro to compact duplicate code #define DATA_PACKET &Data.DataPacket, sizeof(Data.DataPacket) class Command { public: CESAPICommand() {TRACE(_T("CESAPICommand()\n"));} virtual bool SendPacket(void* PacketStart, long PacketSize) { TRACE(_T("Virtual SendPacket() called!\n")); return false; }; // Send commands bool inline Init() {CInit Data; return SendPacket(DATA_PACKET);} bool inline SetBox(double dX1, double dY1, double dZ1, double dX2, double dY2, double dZ2) {CSetBox Data(dX1, dY1, dZ1, dX2, dY2, dZ2); return SendPacket(DATA_PACKET);} }; Class2 to wrap: ///Receiver.h class Receive { public: Receive() {TRACE(_T("Receive()\n"));} protected: bool ReceiveData(void* packetStart, long packetSize) { if (packet

    C# csharp com c++ debugging

  • to byte[] conversion?
    S stonee74

    Sorry, I guess I act as stupid but I still havent' understood 100% how to go......... 1) Can I pass void* PacketStart, long PacketSize or Do I need to go the managed way? 2) Are those two method declarations equivalent? 3) If i pass void*, what would be the substitute for MyStruct? 4) *((object) pBuffer) = PacketStart; ( results in Cannot convert type 'byte*' to 'object') 5) Could you give an example how to go, to receive the respective byte[] in this specific case? your help is greatly appreciated!! regards, newbie stonee :confused: public unsafe override bool SendPacket(void* PacketStart, long PacketSize) //public unsafe override bool SendPacket(ref object PacketStart, long PacketSize) { System.Console.WriteLine("Virtual SendPacket() called!"); try { byte[] buffer = new byte[PacketSize]; fixed (Byte* pBuffer = buffer) { *((MyStruct) pBuffer) = PacketStart; } m_socket.Send(buffer, buffer.Length,SocketFlags.None); return true; } catch(SocketException se) { System.Console.WriteLine(se.Message); return false; } }

    C# help csharp tutorial question c++

  • to byte[] conversion?
    S stonee74

    thanks a lot for this idea, should look like below about? The problem is the compiler states: The type or namespace name 'Command' could not be found (are you missing a using directive or an assembly reference?) Sorry, can you bring me in the right direction please? And what means fixed? thanks again, stonee public unsafe override bool Send(void* Command, long lSize) { System.Console.WriteLine("Send() called!"); try { byte[] buffer = new byte[lSize]; fixed (Byte* pBuffer = buffer) { *((Command*) pBuffer) = Command; } m_socket.Send(buffer, buffer.Length,SocketFlags.None); return true; } catch(SocketException se) { System.Console.WriteLine(se.Message); return false; }

    C# help csharp tutorial question c++

  • to byte[] conversion?
    S stonee74

    Hello there, I'm getting crazy. Maybe somebody of you guys have some good ideas how to solve this. Imagine, There is an existing API in C++. The main idea of this interface is to exchange byte arrays with a server. In the example below you see the principle. I create e.g. a object myCommand from the 'Command' struct which again consists of enumns and structs. The idea is to to send these binary data of the enumns and structs down to the server. In c++ i create this object and send it like that: Socket.send(&myCommand, sizeof(blabla)); As you see i just need to give a pointer to my data. I decided to translate this interface to C#, since writing a wrapper would be about the same work(?!). Anyway, the biggest problem i have is: How can i create a byte[] from myCommand object, containg all the numerical enum and struct data to be able to send it to the server??? Sockets in C# are only accepting byte[] as parameter, but how to convert 'myCommand Object' to byte? There are dozens of examples how to decode strings to byte arrays but I did not found any material abot converting my stuff! One thing i thought about is to use serializing, but since the future app should run on a PocketPC on the Compact Framwork, this is not possible since the .NET CF is not supporting serializing...... Any help, ideas tips and tricks would be greatly appreciated! regards, stonee //example, principle of API enum DataType { Command = 0, Error = 1, Result = 2, }; enum Command { Exit = 0, GetValueA = 1, GetValueB = 2, GetValueC = 3, GetValueD = 4, }; struct Header { public long lPacketSize; public DataType type; } struct Command { public Header packetHeader; public Command command; } Command myCommand = new Command(); Socket.send(&myCommand, sizeof(blabla));

    C# help csharp tutorial question c++
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups