Laden...
Avatar #avatar-2334.gif
Hufy90 myCSharp.de - Member
Azubi - Fachinformatiker/Anwendungsentwicklung Zeulenroda-Triebes (Deutschland) Dabei seit 08.09.2006 182 Beiträge

Forenbeiträge von Hufy90 Ingesamt 182 Beiträge

12.09.2006 - 14:20 Uhr

Ich kann kein Benutzer oder Signaturbild einfügen, es kommt immer

12.09.2006 - 14:10 Uhr

Der Einstiegspunkt CeMemoryStatus wurde nicht in der DLL rapi.dll gefunden.
Was ist falsch?

12.09.2006 - 13:33 Uhr

Ich muss euch trotzdem nochmal den Code schicken, denn ich komm nicht klar! schaut mal bitte durch uns sagt mir wie ich mein problem lösen kann, dass man von einem folderbrowser- oder openfiledialog auf ein Mobiles Gerät zugreifen kann.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
    public partial class upload : Form
    {


        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
        public struct RAPIINIT
        {
            int cbSize;
            int heRapiInit;
            int hrRapiInit;
        }
        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
        public struct SECURITY_ATTRIBUTES
        {
            public int nLength;
            public int lpSecurityDescriptor;
            public int bInheritHandle;
        }


        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeCloseHandle(int hObject);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeCreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeRapiInitEx([System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Struct)] ref RAPIINIT pRapiInit);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeRapiInit();
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeRapiUninit();
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeReadFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeWriteFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int GetLastError();
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        static extern int CeSetEndOfFile(int hFile);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeGetFileSize(int hFile, int lpFileSizeHigh);
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeGetLastError();
        [System.Runtime.InteropServices.DllImport("rapi.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
        public static extern int CeCopyFile(StringBuilder lpExistingFileName, StringBuilder lpNewFileName, StringBuilder bFailIfExists);



        public upload()
        {
            InitializeComponent();
        }


        private void button3_Click(object sender, EventArgs e)
        {
            Close();
        }


        private void button4_Click(object sender, EventArgs e)
        {
            
            CeRapiInit();

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            { textBox1.Text = openFileDialog1.FileName; }
           
        }
        

        private void button2_Click(object sender, EventArgs e)
        {

            CeRapiInit();

            if (folderBrowserDialogUpload.ShowDialog() == DialogResult.OK)

            pictureBox1.Show();  
  
            { 
            string[] arr;
            arr = textBox1.Text.Split('\\');
            //arr.Length;
            int int1 = arr.Length; 

            System.IO.File.Copy(textBox1.Text, folderBrowserDialogUpload.SelectedPath + "\\" + arr[int1 - 1]);
            }            

        }



        private void upload_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void folderBrowserDialogUpload_HelpRequest(object sender, EventArgs e)
        {

        }

    }
}

12.09.2006 - 12:31 Uhr

Alles klar, trotzdem danke!

12.09.2006 - 10:56 Uhr

Ich verstehe das aber net! Das is mein Problem, sonst wurde ich es ja selber machen!

12.09.2006 - 10:52 Uhr

Oder es gibt ihm halt jem.!

12.09.2006 - 10:49 Uhr

Von was willst du ne Info?
Datei, Direktory,...?
dann suchst du dir das raus und schreibst das so wiees darin steht!

12.09.2006 - 10:44 Uhr

Kann ich dir meinen Code geben und du schreibst das dann? :::


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;



namespace WindowsApplication2
{
    


    public partial class Form3 : Form
    {

        public const short FILE_ATTRIBUTE_NORMAL = 0x80;
        public const short INVALID_HANDLE_VALUE = -1;
        public const uint GENERIC_READ = 0x80000000;
        public const uint GENERIC_WRITE = 0x40000000;
        public const short CREATE_NEW = 1;
        public const short CREATE_ALWAYS = 2;
        public const short OPEN_EXISTING = 3;
        public const short ERROR_FILE_EXISTS = 80;
        public const short ERROR_INVALID_PARAMETER = 87;
        public const short ERROR_DISK_FULL = 112;

        [StructLayout(LayoutKind.Sequential)]
        public struct OSVERSIONINFO
        {
            public int dwOSVersionInfoSize;
            public int dwMajorVersion;
            public int dwMinorVersion;
            public int dwBuildNumber;
            public int dwPlatformId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string szCSDVersion;
        }



        [StructLayout(LayoutKind.Sequential, Pack = 4)]
        public struct SYSTEM_POWER_STATUS_EX
        {
            internal byte ACLineStatus;
            internal byte BatteryFlag;
            internal byte BatteryLifePercent;
            internal byte Reserved1;
            internal uint BatteryLifeTime;
            internal uint BatteryFullLifeTime;
            internal byte Reserved2;
            internal byte BackupBatteryFlag;
            internal byte BackupBatteryLifePercent;
            internal byte Reserved3;
            internal uint BackupBatteryLifeTime;
            internal uint BackupBatteryFullLifeTime;

            
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct _MEMORYSTATUS
        {
            internal byte dwLength;
            internal byte dwMemoryLoad;
            internal byte dwTotalPhys;
            internal byte dwAvailPhys;
            internal byte dwTotalPageFile;
            internal byte dwAvailPageFile;
            internal byte dwTotalVirtual;
            internal byte dwAvailVirtual; 
        }


        [StructLayout(LayoutKind.Sequential)]
        public struct RAPIINIT
        {
            int cbSize;
            int heRapiInit;
            int hrRapiInit;
        }
        [StructLayout(LayoutKind.Sequential)]
        public struct SECURITY_ATTRIBUTES
        {
            public int nLength;
            public int lpSecurityDescriptor;
            public int bInheritHandle;
        }

       
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCloseHandle(int hObject);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInitEx([MarshalAs(UnmanagedType.Struct)] ref RAPIINIT pRapiInit);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiUninit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeReadFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeWriteFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int GetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern int CeSetEndOfFile(int hFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetFileSize(int hFile, int lpFileSizeHigh);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetVersionEx([MarshalAs(UnmanagedType.Struct)] ref OSVERSIONINFO lpVersionInformation);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern bool CeGetSystemPowerStatusEx(ref SYSTEM_POWER_STATUS_EX ps, bool update); 
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetSystemPowerStatusEx([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_POWER_STATUS_EX lpSystemPowerStatusInformation);
        static extern bool CeMemoryStatus(ref _MEMORYSTATUS mst, bool update);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeMemoryStatus([MarshalAs(UnmanagedType.Struct)] ref _MEMORYSTATUS lpMemoryStatus);
        [DllImport("coredll.dll", SetLastError=true)]
        private static extern bool SHGetSpecialFolderPath(int hwndOwner, string lpszPath, ceFolders nFolder, bool fCreate);

        public Form3()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            
            OSVERSIONINFO ceVersion = new OSVERSIONINFO();
            ceVersion.dwOSVersionInfoSize = 276;

            
            CeRapiInit();
            
            
            if (CeGetVersionEx(ref ceVersion))
            {

                label2.Text = ceVersion.dwMajorVersion.ToString()+"."+ceVersion.dwMinorVersion.ToString()+"."+ceVersion.dwBuildNumber.ToString();
                label6.Text = ceVersion.dwPlatformId.ToString();
                if (ceVersion.dwPlatformId == 0)
                {
                    label6.Text = "Windows (32 Bit)s";
                }
                else if (ceVersion.dwPlatformId == 1)
                {
                    label6.Text = "Windows (32 Bit)Windows";
                    
                }

                else if (ceVersion.dwPlatformId == 2)
                {
                    label6.Text = "Windows (32 Bit) NT";
                    
                }

                else if (ceVersion.dwPlatformId == 3)
                {
                    label6.Text = "Windows (32 Bit) CE";
                    
                }
            }

            SYSTEM_POWER_STATUS_EX ceSystemPowerStatus = new SYSTEM_POWER_STATUS_EX();

            ceSystemPowerStatus.BatteryFlag = 1;
            ceSystemPowerStatus.ACLineStatus = 1;
            

            CeRapiInit();

      

            if (CeGetSystemPowerStatusEx(ref ceSystemPowerStatus, true))
            {
                                 
                if (ceSystemPowerStatus.BatteryFlag == 1)
                {
                    pictureBox1.Show();
                    label19.Show();                 
                }
                else if (ceSystemPowerStatus.BatteryFlag == 2)
                {
                    pictureBox2.Show();
                    label20.Show();                   
                }
                else if (ceSystemPowerStatus.BatteryFlag == 4)
                {
                    pictureBox3.Show();
                    label21.Show();                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 8)
                {
                    pictureBox4.Show();
                    label22.Show();                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 128)
                {
                    label3.Text = "keine Battery";                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 255)
                {
                    label3.Text = "unbekannter Status";                    
                }



                if (ceSystemPowerStatus.ACLineStatus == 0)
                {
                    label4.Text = "Offline";                    
                }
                else if (ceSystemPowerStatus.ACLineStatus == 1)
                {
                    label4.Text = "Online";                    
                }
                else if (ceSystemPowerStatus.ACLineStatus == 255)
                {
                    label4.Text = "unbekannter Status";                    
                }

                label26.Text = ceSystemPowerStatus.BatteryLifePercent.ToString() + "%";
                


            }


            _MEMORYSTATUS CeGlobalMemoryStatus = new _MEMORYSTATUS();

            CeGlobalMemoryStatus.dwLength = 5;


            CeRapiInit();

            if (CeMemoryStatus(ref CeGlobalMemoryStatus, true))
            
            {
                label12.Text = CeGlobalMemoryStatus.dwLength.ToString();
            }



        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void gbVersion_Enter(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            
        }

        private void Form3_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
   }

    public partial class ramiimport
    {

    }
    
 }

12.09.2006 - 10:32 Uhr

Da musst du mal in der MSDN nachlesen!
MSDN

12.09.2006 - 10:23 Uhr

Und wie mache ich das?

12.09.2006 - 10:18 Uhr

Sag mir mal wo oder geb mir nen Link! (!!BITTE!!

12.09.2006 - 09:47 Uhr

Das is ja mein Problem, das is kein Buchstabe, da Steht nur "Mobiles Gerät".

12.09.2006 - 09:00 Uhr

So sieht die Fehlermeldung aus!

Was ist zu tun?

12.09.2006 - 08:36 Uhr

D.h.? Ich kann vom Arbeitsplatz drauf zugreifen aber nich von dem Openfiledialog oder dem folderbrowserdialog.

12.09.2006 - 08:19 Uhr

Undzwar folgendes, ich möchte in meinem Programm Dateien auf ein Angeschlussenes Gerät hoch bzw. herunterladen und wollte fragen wie ich das machen soll.

Folgendes:
Im Textfeld gebe ich den Speicherort und Dateiname an, von der Datei die hochgeladen werden soll oder ich klicke auf durchsuchen (1) (button4) und wähle die Datei.
Danach klicke ich auf Upload (3) (button2) , und wähle den Speicherort der Datei aus. wenn ich dann Upload mit ok beende, sollen die Dateien kopiert werden. mit ok (2)beende ich das fenster upload wieder.

Meine Frage: was Schreibe ich in den Code damit das gerät erkannt wird und ich die Daten auf ein Mobiles Gerät (PDA) speichern kann? Das geht doch irgendwie mit der Remote API!?

Vielen Dank schonmal im voraus!


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
    public partial class upload : Form
    {
        public upload()
        {
            InitializeComponent();
        }


        private void button3_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            { textBox1.Text = openFileDialog1.FileName; }
        }


        /*public void CopyFileOnDevice(
   string SourceFile,
   string DestinationFile
);*/



        private void button2_Click(object sender, EventArgs e)
        {

            

            if (folderBrowserDialogUpload.ShowDialog() == DialogResult.OK)

            pictureBox1.Show();  
  
            { 
            string[] arr;
            arr = textBox1.Text.Split('\\');
            //arr.Length;
            int int1 = arr.Length; 

            System.IO.File.Copy(textBox1.Text, folderBrowserDialogUpload.SelectedPath + "\\" + arr[int1 - 1]);
            }            

        }


        private void upload_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

    }
}

11.09.2006 - 09:30 Uhr

Könntest du mir evtl. noch sagen was was ist? Was ist denn hier die Variable? und wie muss ich sie umschreiben?

11.09.2006 - 09:27 Uhr

Alles klar! und Danke für die Hilfe!

11.09.2006 - 09:08 Uhr

Hat sich erledigt!

11.09.2006 - 08:53 Uhr
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;



namespace WindowsApplication2
{
    
    public partial class Form3 : Form
    {

        public const short FILE_ATTRIBUTE_NORMAL = 0x80;
        public const short INVALID_HANDLE_VALUE = -1;
        public const uint GENERIC_READ = 0x80000000;
        public const uint GENERIC_WRITE = 0x40000000;
        public const short CREATE_NEW = 1;
        public const short CREATE_ALWAYS = 2;
        public const short OPEN_EXISTING = 3;
        public const short ERROR_FILE_EXISTS = 80;
        public const short ERROR_INVALID_PARAMETER = 87;
        public const short ERROR_DISK_FULL = 112;

        [StructLayout(LayoutKind.Sequential)]
        public struct OSVERSIONINFO
        {
            public int dwOSVersionInfoSize;
            public int dwMajorVersion;
            public int dwMinorVersion;
            public int dwBuildNumber;
            public int dwPlatformId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string szCSDVersion;
        }



        [StructLayout(LayoutKind.Sequential, Pack = 4)]
        public struct SYSTEM_POWER_STATUS_EX
        {
            internal byte ACLineStatus;
            internal byte BatteryFlag;
            internal byte BatteryLifePercent;
            internal byte Reserved1;
            internal uint BatteryLifeTime;
            internal uint BatteryFullLifeTime;
            internal byte Reserved2;
            internal byte BackupBatteryFlag;
            internal byte BackupBatteryLifePercent;
            internal byte Reserved3;
            internal uint BackupBatteryLifeTime;
            internal uint BackupBatteryFullLifeTime;

            
        }

        /*[StructLayout(LayoutKind.Sequential, Pack = 4)]
        public struct _MEMORYSTATUS
        {
            internal byte dwLength;
            internal byte dwMemoryLoad;
            internal byte dwTotalPhys;
            internal byte dwAvailPhys;
            internal byte dwTotalPageFile;
            internal byte dwAvailPageFile;
            internal byte dwTotalVirtual;
            internal byte dwAvailVirtual; 
        }*/


        [StructLayout(LayoutKind.Sequential)]
        public struct RAPIINIT
        {
            int cbSize;
            int heRapiInit;
            int hrRapiInit;
        }
        [StructLayout(LayoutKind.Sequential)]
        public struct SECURITY_ATTRIBUTES
        {
            public int nLength;
            public int lpSecurityDescriptor;
            public int bInheritHandle;
        }
       
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCloseHandle(int hObject);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInitEx([MarshalAs(UnmanagedType.Struct)] ref RAPIINIT pRapiInit);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiUninit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeReadFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeWriteFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int GetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern int CeSetEndOfFile(int hFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetFileSize(int hFile, int lpFileSizeHigh);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetVersionEx([MarshalAs(UnmanagedType.Struct)] ref OSVERSIONINFO lpVersionInformation);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern bool CeGetSystemPowerStatusEx(ref SYSTEM_POWER_STATUS_EX ps, bool update); 
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetSystemPowerStatusEx([MarshalAs(UnmanagedType.Struct)] ref SYSTEM_POWER_STATUS_EX lpSystemPowerStatusInformation);
        /*static extern bool CeGlobalMemoryStatus(ref _MEMORYSTATUS ps, bool update);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGlobalMemoryStatus([MarshalAs(UnmanagedType.Struct)] ref _MEMORYSTATUS LPMEMORYSTATUS);
        */

        public Form3()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            
            OSVERSIONINFO ceVersion = new OSVERSIONINFO();
            ceVersion.dwOSVersionInfoSize = 276;

            
            CeRapiInit();
            
            
            if (CeGetVersionEx(ref ceVersion))
            {

                label2.Text = ceVersion.dwMajorVersion.ToString()+"."+ceVersion.dwMinorVersion.ToString()+"."+ceVersion.dwBuildNumber.ToString();
                label6.Text = ceVersion.dwPlatformId.ToString();
                if (ceVersion.dwPlatformId == 0)
                {
                    label6.Text = "Windows (32 Bit)s";
                }
                else if (ceVersion.dwPlatformId == 1)
                {
                    label6.Text = "Windows (32 Bit)Windows";
                    
                }

                else if (ceVersion.dwPlatformId == 2)
                {
                    label6.Text = "Windows (32 Bit) NT";
                    
                }

                else if (ceVersion.dwPlatformId == 3)
                {
                    label6.Text = "Windows (32 Bit) CE";
                    
                }
            }

            SYSTEM_POWER_STATUS_EX ceSystemPowerStatus = new SYSTEM_POWER_STATUS_EX();

            ceSystemPowerStatus.BatteryFlag = 1;
            ceSystemPowerStatus.ACLineStatus = 1;
            

            CeRapiInit();

      

            if (CeGetSystemPowerStatusEx(ref ceSystemPowerStatus, true))
            {
                                 
                if (ceSystemPowerStatus.BatteryFlag == 1)
                {
                    pictureBox1.Show();
                    label19.Show();                 
                }
                else if (ceSystemPowerStatus.BatteryFlag == 2)
                {
                    pictureBox2.Show();
                    label20.Show();                   
                }
                else if (ceSystemPowerStatus.BatteryFlag == 4)
                {
                    pictureBox3.Show();
                    label21.Show();                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 8)
                {
                    pictureBox4.Show();
                    label22.Show();                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 128)
                {
                    label3.Text = "keine Battery";                    
                }
                else if (ceSystemPowerStatus.BatteryFlag == 255)
                {
                    label3.Text = "unbekannter Status";                    
                }



                if (ceSystemPowerStatus.ACLineStatus == 0)
                {
                    label4.Text = "Offline";                    
                }
                else if (ceSystemPowerStatus.ACLineStatus == 1)
                {
                    label4.Text = "Online";                    
                }
                else if (ceSystemPowerStatus.ACLineStatus == 255)
                {
                    label4.Text = "unbekannter Status";                    
                }

                label26.Text = ceSystemPowerStatus.BatteryLifePercent.ToString() + "%";
                


            }


            /*_MEMORYSTATUS CeGlobalMemoryStatus = new _MEMORYSTATUS();

            CeGlobalMemoryStatus.dwLength = 1;


            CeRapiInit();

            if (CeGlobalMemoryStatus(ref CeGlobalMemoryStatus, true))
            {
                label12.Text = ceGlobalMemoryStatus.dwLenght.ToString();
            }*/

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void gbVersion_Enter(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            
        }

        private void Form3_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
 
   }

    public partial class ramiimport
    {

    }
    
 }

:::

11.09.2006 - 08:41 Uhr

Globel Memory Status fehler!

08.09.2006 - 12:49 Uhr

Alles klar, jetzt geht alles!

08.09.2006 - 11:38 Uhr

Zeigt zwar keine fehler, aber zeigt auch nix an (Bild)!

Button1 ist der ausführende button!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;



namespace WindowsApplication2
{
    
    public partial class Form3 : Form
    {

        public const short FILE_ATTRIBUTE_NORMAL = 0x80;
        public const short INVALID_HANDLE_VALUE = -1;
        public const uint GENERIC_READ = 0x80000000;
        public const uint GENERIC_WRITE = 0x40000000;
        public const short CREATE_NEW = 1;
        public const short CREATE_ALWAYS = 2;
        public const short OPEN_EXISTING = 3;
        public const short ERROR_FILE_EXISTS = 80;
        public const short ERROR_INVALID_PARAMETER = 87;
        public const short ERROR_DISK_FULL = 112;
        [StructLayout(LayoutKind.Sequential)]
        public struct OSVERSIONINFO
        {
            public int dwOSVersionInfoSize;
            public int dwMajorVersion;
            public int dwMinorVersion;
            public int dwBuildNumber;
            public int dwPlatformId;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string szCSDVersion;
        }



        public struct _SYSTEM_POWER_STATUS_EX 
        {
            public int ACLineStatus;
            public int BatteryFlag;
            public int BatteryLifePercent;
            public int Reserved1;
            public int BatteryLifeTime;
            public int BatteryFullLifeTime;
            public int Reserved2;
            public int BackupBatteryFlag;
            public int BackupBatteryLifePercent;
            public int Reserved3;
            public int BackupBatteryLifeTime;
            public int BackupBatteryFullLifeTime;
            
        } 


        [StructLayout(LayoutKind.Sequential)]
        public struct RAPIINIT
        {
            int cbSize;
            int heRapiInit;
            int hrRapiInit;
        }
        [StructLayout(LayoutKind.Sequential)]
        public struct SECURITY_ATTRIBUTES
        {
            public int nLength;
            public int lpSecurityDescriptor;
            public int bInheritHandle;
        }
       
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCloseHandle(int hObject);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeCreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInitEx([MarshalAs(UnmanagedType.Struct)] ref RAPIINIT pRapiInit);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiInit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeRapiUninit();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeReadFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToRead, out int lpNumberOfbytesRead, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeWriteFile(int hFile, StringBuilder lpBuffer, int nNumberOfbytesToWrite, out int lpNumberOfbytesWritten, int lpOverlapped);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int GetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern int CeSetEndOfFile(int hFile);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetFileSize(int hFile, int lpFileSizeHigh);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern int CeGetLastError();
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetVersionEx([MarshalAs(UnmanagedType.Struct)] ref OSVERSIONINFO lpVersionInformation);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        public static extern Boolean CeGetSystemPowerStatusEx([MarshalAs(UnmanagedType.Struct)] ref _SYSTEM_POWER_STATUS_EX lpSystemPowerStatusInformation);
        [DllImport("rapi.dll", CharSet = CharSet.Unicode)]
        static extern bool CeGetSystemPowerStatusEx(ref _SYSTEM_POWER_STATUS_EX ps, bool update); 


        public Form3()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            OSVERSIONINFO ceVersion = new OSVERSIONINFO();
            ceVersion.dwOSVersionInfoSize = 276;

            
            CeRapiInit();
            
            
            if (CeGetVersionEx(ref ceVersion))
            {

                label2.Text = ceVersion.dwMajorVersion.ToString()+"."+ceVersion.dwMinorVersion.ToString() + "."  +ceVersion.dwBuildNumber.ToString();
                label6.Text = ceVersion.dwPlatformId.ToString();
                if (ceVersion.dwPlatformId == 0)
                {
                    label6.Text = "Windows (32 Bit)s";
                }
                else if (ceVersion.dwPlatformId == 1)
                {
                    label6.Text = "Windows (32 Bit)Windows";
                }

                else if (ceVersion.dwPlatformId == 2)
                {
                    label6.Text = "Windows (32 Bit) NT";
                }

                else if (ceVersion.dwPlatformId == 3)
                {
                    label6.Text = "Windows (32 Bit) CE";
                }
            }

            _SYSTEM_POWER_STATUS_EX ceSystemPowerStatus = new _SYSTEM_POWER_STATUS_EX();

            ceSystemPowerStatus.BatteryFlag = -1;
            ceSystemPowerStatus.ACLineStatus = 6553857;
            

            CeRapiInit();

      

            if (CeGetSystemPowerStatusEx(ref ceSystemPowerStatus, true))
            {
                                 
                if (ceSystemPowerStatus.BatteryFlag == 1)
                {
                    pictureBox1.Show();
                }
                else if (ceSystemPowerStatus.BatteryFlag == 2)
                {
                    pictureBox2.Show();
                }

                else if (ceSystemPowerStatus.BatteryFlag == 4)
                {
                    pictureBox3.Show();
                }

                else if (ceSystemPowerStatus.BatteryFlag == 8)
                {
                    pictureBox4.Show();
                }

                else if (ceSystemPowerStatus.BatteryFlag == 128)
                {
                    label3.Text = "keine Battery";
                }

                else if (ceSystemPowerStatus.BatteryFlag == 255)
                {
                    label3.Text = "unbekannter Status";
                }



                if (ceSystemPowerStatus.ACLineStatus == 0)
                {
                    label4.Text = "Offline";
                }

                else if (ceSystemPowerStatus.ACLineStatus == 1)
                {
                    label4.Text = "Online";
                }

                else if (ceSystemPowerStatus.ACLineStatus == 255)
                {
                    label4.Text = "unbekannter Status";
                }
            }
            


        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void gbVersion_Enter(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            
        }

        private void Form3_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }
 
   }

    public partial class ramiimport
    {

    }
    
 }

Zeigt zwar keine fehler, aber zeigt auch nix an (Bild)!

08.09.2006 - 11:21 Uhr

alles klar, schönen dank!
Und fals du ma fragen hast, S. Hufsky!
Ich kann dir fast alles beantworten (LACOS Computerservice GmbH Abteilung Anwendungsentwicklung).
Also dann, hau rein!

08.09.2006 - 11:03 Uhr

Geht trotzdem net!
Ich schick dir den code ma per zip und du kannst ihn dann ma umschreiben.
Würdest du das machen?

08.09.2006 - 10:35 Uhr

Ich will ja echt ken streß verbreiten!
Aber wie gesagt. kann mir das ma bitte jemand sagen?

08.09.2006 - 10:34 Uhr

...Aber das Projekt muss heut noch fertig werden!

08.09.2006 - 10:27 Uhr

Sag mir ma wie ich das wo hin schreiben muss!

08.09.2006 - 10:17 Uhr

Wo soll das in diesem Source Code hin?

08.09.2006 - 10:03 Uhr

und wo muss das hin?

08.09.2006 - 09:59 Uhr

System.Diagnostics.Process.Start("msimn.exe");

08.09.2006 - 09:54 Uhr

Ich brauche Hilfe!!!

Bitte schnell Antworten!