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
H

haolan

@haolan
About
Posts
28
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to catch usb event
    H haolan

    I found this: http://msdn2.microsoft.com/en-us/library/microsoft.windowsmobile.status.systemstate.activesyncstatus.aspx[^] With this I have written the following code: void activeSyncState_Changed(object sender, ChangeEventArgs args) { ActiveSyncStatus status = (ActiveSyncStatus)args.NewValue; try { if (status == ActiveSyncStatus.Synchronizing) { MessageBox.Show("Hello world!"); } } catch (Exception ex) { // Handle Exception } } SystemState activeSyncState = new SystemState(SystemProperty.ActiveSyncStatus); activeSyncState.Changed += new ChangeEventHandler(activeSyncState_Changed); But when I plug in my cable nothing happens. But I guess I dont use the right api, because I need to fire my event when a connection is established and not when activesync is synchronizing. Is there any way to do that?

    Mobile tutorial question

  • How to catch usb event
    H haolan

    Can you tell me more specific where I can find these system states?

    Mobile tutorial question

  • How to catch usb event
    H haolan

    Hi there. Is there any way I can catch an event, when i plug a cable from my device to a computer? When there is an active connection between the two devices I want to show a dialog box in my mobile application. Haolan

    Mobile tutorial question

  • Lock program (not closeable)
    H haolan

    Hi there. Can anyone tell me how to lock my program, so it cant be closed og minimized in any way, not even with hardware buttons. My program requires two files, an update program and the application itself. Those two program should be the only two programs that should be able to run at my devices. It is a kind of a kiosk mode i need. I have tried a few kiosk programs, but they always contains a menu, so my app can be closed to the menu window, which it may not do. If i can lock the OK button (because this button closes my program somehow) in any way at my app, these kiosk program are fine for me.. I hope you understand what i need, i am not english, so i guess my language may be a little bad.. :) have a nice day.. Haolan

    Mobile hardware tutorial announcement

  • Detect and connect to wireless
    H haolan

    Hi.. Is there any way that I can detect an available wireless connection and connect to it with c# .NET CF? And are there any way I can tell my device to connect to an availble network, if the network code is typed in windows without the users notice? My problem is that I want my device to reconnect automatically when an available connection is detected. If my device has been shut down for a couple of hours or have been without connection, I have to manually reconnect to the internet, which is not possible with my program, because it cannot be closed for security reasons.. Greetings from Haolan

    Mobile csharp sysadmin security help question

  • Downloading a file
    H haolan

    Thanks a lot :) My problem is solved..

    Mobile csharp question help

  • Downloading a file
    H haolan

    The FileWebrequest does not seem to be in the Compact Framework either. Or should I add a reference or something?

    Mobile csharp question help

  • Downloading a file
    H haolan

    Hi How do I download a file in my c# program? I am trying to download an exe file from a webserver to a local directory at my PDA. I have tried to use the WebClient class from c# .NET but it seems that it doesn't exists in Compact Framework. Can anyone please help me to solve this?

    Mobile csharp question help

  • Step by step wizard
    H haolan

    Never mind, I found out :) Thanks for a fast and great answer :)

    C# data-structures tutorial question announcement

  • Step by step wizard
    H haolan

    I used panels as before, thats why i wanted to change it to forms.. I never thought of using usercontrols.. So i will try that.. I am not really expericed in using those. Can u tell my how to place them and navigate through steps?

    C# data-structures tutorial question announcement

  • Step by step wizard
    H haolan

    Hi there. I am trying to create a step by step wizard, for a Windows Mobile 6.0 PDA. I have used forms as the steps. In my mainform I have a method that finds the next step from an array. There are three types of steps, and each steps can appear more than once in one session. When the last step is finished, the first step will be shown again. In an earlier program, I used panels as my steps, but it was a little difficult to manage each step in the same form window. In my new version, I am trying to use forms instead, but every time i click next, I can see a short blink, of the programs running in the background. When i click the next step button in the current step, the following code is used: mainForm.ShowNextStep(); this.Close(); ShowNextStep finds the next step and use nextStep.ShowDialog(); Is there anything I can do, so i wont see those short blinks, without using panels?

    C# data-structures tutorial question announcement

  • Communicating with an USB Device
    H haolan

    Ok.. I found this example at MSDN: public static void Read() { while (_continue) { try { string message = _serialPort.ReadLine(); Console.WriteLine(message); } catch (TimeoutException) { } } } And then you say I have to create a method that tries to parse the code, to check if it is a valid message, and if not, then it should run the read() again until the code can be parsed right?

    C# tutorial question

  • Communicating with an USB Device
    H haolan

    Ok.. So translated into code you are saying that I should do something like this when i read: while(true) { DoRead(); if(TimeOutException) ReadAgain; else { if(bytesToRead > 10) ReadAgain; else break; } } I know this isn't a real code, just a little theory.. The 10 bytes to read is because I know that the valid data always will be 10 characters long. Is this correct understood? By the way.. I really appreciate your patience in this thread ;) Sorry if my english seems a little bad sometimes, I am not originally english and it has been a while since I last got lections in it. :)

    C# tutorial question

  • Communicating with an USB Device
    H haolan

    I do not know why there are so many ports.. It doesn't have any physical comports. But nevermind.. I got my program to work.. The only problem was that the baudrate was only 1200, so I had to wait a little time after I have wrote the GET method to the device before trying to read from it. I have tried in a windows application to add a timer, but that doesn't seem to work, but if I place a for (int i; i < 100000; i++) between the read and write, it probably works fine. I really cant figure out what the difference is. I gotta find out, because the program can be run at different CPU's. Maybe you have a solution? Another thing that I am worried about is the COM Port name. It is different for each computer I connect it to.. Is there any way to find out which COM port my device is connected to?

    C# tutorial question

  • From VB6 to C#
    H haolan

    I already had looked at MSDN.. I have tried make some code.. But no matter what i do it doesn't seem to work..

    C# csharp help tutorial

  • From VB6 to C#
    H haolan

    Hi everyone. I have got some VB6 code i need to translate to C#, but i really cant understand the VB code. The program is something that communicates with a serial dervice. I do not know how much of the code I need to get translated, so it is possible that I will post more code later. Until now i've got this code: Private Sub Command1_Click() Dim CheckSum As Byte, x, Tid MSComm1.Settings = "1200,N,8,1" Buffer = "GET" + vbCr CheckAndSum Buffer ' add Checksum and Length of string Buffer = Buffer + SumStr 'For x = 1 To Len(Buffer) ' Tid = Timer ' Do ' DoEvents ' Loop Until (Timer - Tid > 0.01) ' MSComm1.Output = Mid(Buffer, x, 1) 'Next x MSComm1.Output = Buffer End Sub This should write some code to the Serial Port. I have already got the code for creating the checksum. When my device receives the GET command with vbCr (Carridge return), the checksum and the string Length, it should return 10 characters an example could be c=02345"Carrigde return"Checksum1Checksum2 I do not think you need more code that i pasted to do this. But I am not sure.. It would really be a great help if you could help me with this..

    C# csharp help tutorial

  • Communicating with an USB Device
    H haolan

    The communication parameters should be ok. My laptop is a bit weird though.. It has a lot of COM ports (from 3 to 16).. When i connect my device it has two COM3 ports, I hope that it wont make any trouple with my communication.. But how do I use HyperTerminal for such a thing? When I open HyperTermial it seems that it only can communicate with Modems??

    C# tutorial question

  • Communicating with an USB Device
    H haolan

    Ahh ok.. I connected the device again, and found out that if I run: string[] ports = SerialPort.GetPortNames(); foreach (string p in ports) { Console.WriteLine(p); } It has created a new COM port named COM6. So i guess i should be able to communicate with my device through that port? I have created the following code for communication: SerialPort sp = new SerialPort("COM6", 1200, Parity.None, 8, StopBits.One); try { sp.Open(); sp.Write("GET"); sp.ReadTimeout = 10000; string ans = sp.ReadLine(); } catch (Exception e) { Console.WriteLine(e.Message); } finally { sp.Close(); } I get timeout when I am waiting for answer, but I guess it could be a mistake of how to communicate with the device.

    C# tutorial question

  • Communicating with an USB Device
    H haolan

    I told you I had a USB-Serial cable connected to it.. It is an adapter from Serial to USB.. The port on the device is Serial and on the computer it has to be USB.

    C# tutorial question

  • Communicating with an USB Device
    H haolan

    Hi again.. I found out that the Computer the device has to be connected to, does not contain any serial port.. So I have to use USB to this. Is it really that hard to communicate with an USB port?

    C# tutorial question
  • Login

  • Don't have an account? Register

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