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
L

lisan_al_ghaib

@lisan_al_ghaib
About
Posts
71
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How Syncronize..in C#???
    L lisan_al_ghaib

    Hi, The idea is to read specific media player registers. to get current played song informations: In .net you can use the RegistryKey class to have acces to registers: Note: Reg path from WMP: Software\Microsoft\MediaPlayer\CurrentMetadata RegistryKey regData = Registry.CurrentUser.OpenSubKey("Software\Microsoft\MediaPlayer\CurrentMetadata", false); if (regData != null) //you have to do this check, to prevent from a null reference exception { string currSongTitle = regData.GetValue("Title", "No Title") as string; //... // Check google to see other WMP Keys... } Hope this help

    C# csharp question

  • EEPROM Smart Card
    L lisan_al_ghaib

    ewww ! a very very very very very bad question ! Type of EEProm, How this eprom est connected to your PC... We need details please !

    C# tutorial

  • Print the information on a Windows Form
    L lisan_al_ghaib

    :laugh:

    C# csharp tutorial

  • Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    L lisan_al_ghaib

    Did you check in frm (the form you want to show) Load event or in its Constructor?

    C# help performance

  • [Message Deleted]
    L lisan_al_ghaib

    yes ! stupid melody that you hear when you weak up in the morning. BinnaryWriter :laugh: ..nice class we shoud ask Microsoft to bring us a 'Binnary' Namespace

    C#

  • Structure converstion to Bytearray
    L lisan_al_ghaib

    +1 dude !

    C# question csharp

  • Structure converstion to Bytearray
    L lisan_al_ghaib

    Hello ! Don't be so Rude :) we all were beginners some time !

    C# question csharp

  • Structure converstion to Bytearray
    L lisan_al_ghaib

    let suppose your have this Class :

    class SomeClass
    {
    double l;
    double [] m = new double [10]; //double array
    string s;

    byte [] ToByteArray ()
    {
    List<byte> b = new List<byte> ();
    b.AddRange (BitConverter.GetBytes (l));
    for (int i = 0; i < m.Length ; i++)
    b.AddRange (BitConverter.GetBytes (m [i]));
    char [] tabc = s.ToCharArray();
    for ( int i = 0 ; i < m.Lenght ; i++)
    b.AddRange (BitConverter.GetBytes (tabc [i]);

      return  b.ToArray();
    

    }
    }
    //usage :
    SomeClass c = new SomeClass ();
    byte [] b = c.ToByteArray();

    C# question csharp

  • Structure converstion to Bytearray
    L lisan_al_ghaib

    okey then the best way to do this is to define a sort of a 'communication protocol' between two devices : First byte : message lenght (or data length) data bytes : your data byte that holds checksum [data length][.....data.....][checksum] then in your C# program you have to create a class that build the message you have to send : calculate length convert your structure on a data array (*) calculate the checksum -> So here we are in the core of your question: the best way is to loop over EACH element of your strucuture convert it into byte array and the add it to data array use BitConverter class : BitConverter.GetBytes (T) -> T is an elementary type (float, double, char, int, etc...)

    C# question csharp

  • Structure converstion to Bytearray
    L lisan_al_ghaib

    You are running serial port communication between 2 managed program?

    C# question csharp

  • [Message Deleted]
    L lisan_al_ghaib

    class PleaseWork
    {
    public void getPermission ()
    {
    MyComputer.GetBinnaryPermission (directory); // oh crap it doesn't work ! Let's ask question on codeproject forum !!! , MSDN ? what's MSDN ? huh. NO !!!!

    }
    }

    C#

  • Temp Folder
    L lisan_al_ghaib

    google is loosing its mojo :-\

    C# question

  • Common file
    L lisan_al_ghaib

    Hello, You have to think Classes not file. The best solution is to create a Class libraby project (DLL) that contains your classes Then if you want to use it, you reference it in your current project. That's it !

    C# tutorial

  • What is := in VB.net
    L lisan_al_ghaib

    [Message Deleted]

    Visual Basic question csharp tutorial

  • how can i change machain date
    L lisan_al_ghaib

    There is a little fix : correct solution

    public class Win32
    {
    private Win32()
    {
    }

        \[StructLayout(LayoutKind.Sequential)\]
        public struct SystemTime
        {
            \[MarshalAs(UnmanagedType.U2)\]
            public short Year;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Month;
            \[MarshalAs(UnmanagedType.U2)\]
            public short DayOfWeek;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Day;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Hour;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Minute;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Second;
            \[MarshalAs(UnmanagedType.U2)\]
            public short Milliseconds;
        }
    
        \[DllImport("kernel32.dll")\]
        public static extern void GetLocalTime(
        out SystemTime systemTime);
    
        \[DllImport("kernel32.dll")\]
        public static extern void GetSystemTime(
        out SystemTime systemTime);
    
        \[DllImport("kernel32.dll")\]
        public static extern bool SetSystemTime(
        ref SystemTime systemTime);
    
        \[DllImport("kernel32.dll")\]
        public static extern bool SetLocalTime(
        ref SystemTime systemTime);
    }
    

    ....
    in you method do this :
    Win32.SystemTime sysTime;

            sysTime.Day = 13;
           // do all needed modification on date and time...
           //....
    
            Win32.SetSystemTime(ref sysTime);
    

    Make sure that you got admin rights.

    C# help question

  • Creating Instance of button at run time.
    L lisan_al_ghaib

    Buy a book int left = 0; int space = 1; //pix for ( int i = 0 ; i < nbButtons ; i++) { Button b = new Button(); b.name = i.ToString(); b.Text = i.ToString(); b.Left = left; c.Controls.Add (b); //C is a user control left += b.Left + b.Width + space; }

    C# csharp graphics data-structures help

  • 8-O fixing C# class in unsafe code block???
    L lisan_al_ghaib

    You have to use IntPtr instead of void use Marshall.CoTaskMemAlloc method to allocate Marshall.CoTaskMemFree method to free after using your struct

    C# csharp c++ help question

  • Class inheritance question
    L lisan_al_ghaib

    Bar bar 1 = new Bar(); Bar bar2 = bar1;

    C# question oop tutorial

  • how can i change machain date
    L lisan_al_ghaib

    Hello you can do this using some Win32 API functions (warning : unmanaged code) please see this : http://bytes.com/forum/thread242372.html[^]

    C# help question

  • Class inheritance question
    L lisan_al_ghaib

    huh sorry i dont understand

    C# question oop tutorial
  • Login

  • Don't have an account? Register

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