I Developed my first Application.... here it is - Windows Mobile Development and Hacking General

Hi to u all
i have developed my first application for XDA
BMI Calculator
its working fine on my computer, its installing to my xda as well but BIG BUT
i am not able to input in textfields in other words i am not able to open my keyboard
can any one help me on this i am using VB .NET to make it.
i think i have to make a focus or something on textfields i do no how to do that plz help
Regards
GUGI

i'm learning c++, no idea about .net, but in c++ when you receive the focus message from the text box, you show the sip using the api commands. don't have any code in front of me right now, check msdn.
V

thanx Vijay
let me try then i let u guys know
Regards
Gugi

Hi to u all
I have no luck to find the solution for my prob, so anyone help me plz
Regards
Gugi

gugi_sat said:
Hi to u all
I have no luck to find the solution for my prob, so anyone help me plz
Regards
Gugi
Click to expand...
Click to collapse
1: Add a inputpanel to your form.
2: Set the inputpanel's Enabled property to False.
3: Add Inputpanel1.Enabled = true in the textbox's GotFocus Event.
4: Add InputPanel1.Enabled = false in then textox's LostFocus Event.

hi there
i will give it try
Thnx
Regrads
Gugi

hi GeirFrimann
i tried the code u told me
but i am getting the System.exception when i click on the txtfield in deployment
then i put the code like this
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Application.Exit()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbout.Click
Dim company As String
Dim about As String
Dim version As String
company = "Gugi's Software"
about = "BMI Calculator"
version = "v1.0 beta"
MessageBox.Show(company & vbNewLine & about & vbNewLine & version, "About...")
End Sub
Private Sub btnCal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCal.Click
Dim height As Double
Dim weight As Double
Dim bmi As Double
height = txtHeight.Text
weight = txtWeight.Text
Try
bmi = weight / ((height / 100) * (height / 100))
Catch c As Exception
If (bmi < 18.4) Then
MessageBox.Show(bmi.ToString & vbNewLine & "Your are UNDERWEIGHT", "Your BMI...")
ElseIf (bmi > 18.5 And bmi < 24.9) Then
MessageBox.Show(bmi.ToString & vbNewLine & "Your are NORMAL", "Your BMI...")
ElseIf (bmi < 25 And bmi > 29.9) Then
MessageBox.Show(bmi.ToString & vbNewLine & "Your are OVERWEIGHT", "Your BMI...")
ElseIf (bmi > 30) Then
MessageBox.Show(bmi.ToString & vbNewLine & "Your are OBESE", "Your BMI...")
End If
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Please Enter your height in Centimeters", "Height?")
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MessageBox.Show("Please Enter your Weight in Kilogrames", "Weight?")
End Sub
Private Sub txtHeight_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHeight.GotFocus
Try
InputPanel1.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub txtHeight_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHeight.LostFocus
Try
InputPanel1.Enabled = False
Catch ex As Exception
End Try
End Sub
Private Sub txtWeight_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtWeight.GotFocus
Try
InputPanel2.Enabled = True
Catch ex As Exception
End Try
End Sub
Private Sub txtWeight_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtWeight.LostFocus
Try
InputPanel2.Enabled = False
Catch ex As Exception
End Try
End Sub
End Class
plz help
Regards
Gugi[/code]

gugi_sat said:
hi GeirFrimann
i tried the code u told me
but i am getting the System.exception when i click on the txtfield in deployment
then i put the code like this
Click to expand...
Click to collapse
Any details on exception message?
Probably something wrong with variable name InputPanel1 or InputPanel2. There must be one input panel declared per form. So, declare variable "sip" using "private Microsoft.WindowsCE.Forms.InputPanel" notation and use it to hide/show Input Panel.
Cheers

Hi IMate->WM2k5
Thanx for reply its working its the bug in my try catch satatement in the calculation method
any way with both of your help i am able to make this posible
thanx for that here is the new woring cab file please try this and let me know how it goes
another thing i need to ask is there any tutotial or book for vb .net developement for pocket pc plz let me know
Regards
Gugi

Hi to you all
Here is the latest version with almost all the fixed errors
well if you find something plz let me know
Regrads
Gugi

hi to you all
plz give me some feed back so that i can improve this and develope something else
Regards
Gugi

Related

little coding help needed

hey folks,
here's what I wanna do:
I need a program that runs in the background and checks if my mda2 is in the cradle or not. if it's plugged in the cradle I want it to change in my connection settings from work to internet. I need this for the following reason: my cellphone provider only offers grps over a proxy and that proxy wount work in the cralde when I share my PC connection via active sync. so right now I always need to switch between work and internet connection by myself.
I only know visual basic so I guess I need to take a look at eVB.
Is such a tool even possible in eVB? if so, where would I start? can someone point me in the right direction? maybe give me some links for research.
thanks for your help in advance
cyas
ait, did some research.
looks like just turning the proxy off should do the trick.
I tried doing this via the registry.
for now I just wanted to read out a key. this is what I got so far:
Code:
Option Explicit
Public Declare Function RegOpenKeyEx Lib "Coredll" Alias "RegOpenKeyExW" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Public Declare Function RegQueryValueEx Lib "Coredll" Alias "RegQueryValueExW" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Public Declare Function RegCloseKey Lib "Coredll" (ByVal hKey As Long) As Long
Const ERROR_SUCCESS = &O0
Const HKEY_LOCAL_MACHINE = &H80000001
Private Sub Command1_Click()
Dim lngSize As Long, hlngSubKey As Long
Dim lngType As Long, lngResult As Long
Dim RegData As Integer
lngSize = 256
RegData = String(lngSize, 0)
lngResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "\SOFTWARE\Microsoft\ConnMgr\Providers\{EF097F4C-DC4B-4c98-8FF6-AEF805DC0E8E}\HTTP-{18AD9FBD-F716-ACB6-FD8A-1965DB95B814}", 0, 0, hlngSubKey)
lngResult = RegQueryValueEx(hlngSubKey, "Proxy", 0, lngType, RegData, lngSize)
MsgBox RegData, vbOKOnly, "o2 proxy"
lngResult = RegCloseKey(hlngSubKey)
End Sub
Private Sub Form_OKClick()
App.End
End Sub
unfortunately when I press the button I only get a blank window. it wount show the proxy.
can someone tell me what I'm doing wrong?
oh and I still dont know how I could detect wether there is an active sync connection open or not. any ideas on that?
uhm, no one here who knows some eVB?
_4saken_ said:
Dim RegData As Integer
Click to expand...
Click to collapse
RegData should be declared as
Code:
Dim RegData As String
thanks for the answer but changing it to string didnt help. I still get an empty msg box.
any other ideas what I'm doing wrong?

Problem creating Registry Keys - VB.NET CF 1.x

Hi, if i create a registry key i get an NonSupportet Exception.
Can someone Help?
Here the important part of my code:
Code:
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_ALL_ACCESS = &H3F
Public Const REG_OPTION_NON_VOLATILE = 0
Private Declare Function RegCreateKeyEx Lib "coredll.dll" Alias "RegCreateKeyExW" ( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
ByRef phkResult As Long, _
ByRef lpdwDisposition As Long) As Long
Public Shared Function CreateNewKey(ByVal lSection As Long, _
ByVal sNewKeyName As String) As Long
Dim hNewKey As Long
Dim lRetVal As Long
RegCloseKey(lSection)
--HERE--> lRetVal = RegCreateKeyEx(lSection, sNewKeyName, 0, _
vbNullString, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, _
0, hNewKey, lRetVal)
CreateNewKey = hNewKey
RegCloseKey(hNewKey)
End Function
...
i call for example:
CreateNewKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Today\Items\""Wireless""" )
Please help.
Thanks.
BongoUser said:
Hi, if i create a registry key i get an NonSupportet Exception.
Can someone Help?
Here the important part of my code:
Code:
Public Const HKEY_CURRENT_USER = &H80000001
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_ALL_ACCESS = &H3F
Public Const REG_OPTION_NON_VOLATILE = 0
Private Declare Function RegCreateKeyEx Lib "coredll.dll" Alias "RegCreateKeyExW" ( _
ByVal hkey As Long, _
ByVal lpSubKey As String, _
ByVal Reserved As Long, _
ByVal lpClass As String, _
ByVal dwOptions As Long, _
ByVal samDesired As Long, _
ByVal lpSecurityAttributes As Long, _
ByRef phkResult As Long, _
ByRef lpdwDisposition As Long) As Long
Public Shared Function CreateNewKey(ByVal lSection As Long, _
ByVal sNewKeyName As String) As Long
Dim hNewKey As Long
Dim lRetVal As Long
RegCloseKey(lSection)
--HERE--> lRetVal = RegCreateKeyEx(lSection, sNewKeyName, 0, _
vbNullString, REG_OPTION_NON_VOLATILE, _
KEY_ALL_ACCESS, _
0, hNewKey, lRetVal)
CreateNewKey = hNewKey
RegCloseKey(hNewKey)
End Function
...
i call for example:
CreateNewKey(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Today\Items\""Wireless""" )
Please help.
Thanks.
Click to expand...
Click to collapse
Hi,
1) I wouldn't use lRetVal for the last parameter and the return function value. The last parameter returns the disposition value and the function return value returns 0 for success or an error that you can find in WINERROR.H and so in MSDN documentation.
If it is not the problem then:
2) In place of trying to create a key in HKLM, try first in HKCU, maybe the problem doesn't reside in the code but in the fact that you are trying to create a key in HKLM where you need "authorization" to do it. Your application needs to have privileges like being signed.
Hope it helps,
Cheers,
.Fred
ps.: use a real program language like C/C++. VB is crap!!!
dotfred said:
Hi,
1) I wouldn't use lRetVal for the last parameter and the return function value. The last parameter returns the disposition value and the function return value returns 0 for success or an error that you can find in WINERROR.H and so in MSDN documentation.
If it is not the problem then:
2) In place of trying to create a key in HKLM, try first in HKCU, maybe the problem doesn't reside in the code but in the fact that you are trying to create a key in HKLM where you need "authorization" to do it. Your application needs to have privileges like being signed.
Hope it helps,
Cheers,
.Fred
ps.: use a real program language like C/C++. VB is crap!!!
Click to expand...
Click to collapse
Hi,
it works nowm thanks.
I have found a working sample in www.

[REQ] Game Server Monitoring like HLSW

Hi
Does anyone know a tool, which allows monitoring and rcon commands to be send to a game server via pocket pc?
I'm running an Enemy territory server and would like to see the status from time to time without switching on my real computer.
Rgds
Micha
If you able to program its a easy thing:
i have written such a tool for my computer in vb for Jedi Academy ET should be the same (old times )
just Sending the commands over UDP
Code:
Option Explicit
Public Function RconSend(ByVal Command As String, ByVal Mode As String)
On Error GoTo err1
If Mode = "rcon" Then
With wskRcon
.Close
.Bind txtOwnPort, txtOwnIP
.RemotePort = txtPort
.RemoteHost = txtIP
.SendData "ÿÿÿÿ" & "rcon" & " " & txtPass.Text & " " & Command
End With
Else
With wskRcon
.Close
.Bind txtOwnPort, txtOwnIP
.RemotePort = txtPort
.RemoteHost = txtIP
.SendData "ÿÿÿÿ" & Mode
End With
End If
If 1 = 0 Then
err1:
txtRconConsole.Text = txtRconConsole.Text & vbNewLine & Err.Description
End If
Mode = ""
End Function
Private Sub cmdBrute_Click()
Dim Wordlist(10) As String
Wordlist(0) = "pokemon"
Wordlist(1) = "scy"
Wordlist(2) = "jawa"
Dim i As Long
With wskRcon
.Close
.Bind txtOwnPort, txtOwnIP
.RemotePort = txtPort
.RemoteHost = txtIP
i = 0
Do Until i = 3
.SendData "ÿÿÿÿ" & "rcon" & " " & Wordlist(i) & " " & "echo " & Wordlist(i)
txtRconConsole.Text = txtRconConsole.Text & vbNewLine & "'" & Wordlist(i) & "'"
i = i + 1
WaitM 500
DoEvents
Loop
End With
End Sub
Private Sub cmdCheck_Click()
RconSend "status", "rcon"
End Sub
Private Sub cmdClear_Click()
txtRconConsole.Text = ""
End Sub
Private Sub cmdJoin_Click()
If frmServerJoiner.IsFilePath("jamp.exe") Then
Shell "jamp.exe connect " & txtIP.Text & ":" & txtPort.Text
Else: MsgBox (LSVar(64))
End If
End Sub
Private Sub cmdStatusCheck_Click()
RconSend "", "getstatus"
End Sub
Private Sub Form_Load()
txtIP.Text = frmMain.txt_ReadLine("JaMTConfig\JaMultiToolCFG.dat", "9")
txtPort.Text = frmMain.txt_ReadLine("JaMTConfig\JaMultiToolCFG.dat", "10")
txtOwnIP.Text = frmMain.txt_ReadLine("JaMTConfig\JaMultiToolCFG.dat", "11")
txtOwnPort.Text = frmMain.txt_ReadLine("JaMTConfig\JaMultiToolCFG.dat", "12")
End Sub
Private Sub txtIP_KeyUp(KeyCode As Integer, Shift As Integer)
frmMain.txt_WriteLine "JaMTConfig\JaMultiToolCFG.dat", "9", txtIP.Text
End Sub
Private Sub txtPort_KeyUp(KeyCode As Integer, Shift As Integer)
frmMain.txt_WriteLine "JaMTConfig\JaMultiToolCFG.dat", "10", txtPort.Text
End Sub
Private Sub txtOwnIP_KeyUp(KeyCode As Integer, Shift As Integer)
frmMain.txt_WriteLine "JaMTConfig\JaMultiToolCFG.dat", "11", txtOwnIP.Text
End Sub
Private Sub txtOwnPort_KeyUp(KeyCode As Integer, Shift As Integer)
frmMain.txt_WriteLine "JaMTConfig\JaMultiToolCFG.dat", "12", txtOwnPort.Text
End Sub
Private Sub txtSendCMD_KeyPress(KeyAscii As Integer)
Dim buffer As String
Select Case KeyAscii
Case vbKeyReturn
RconSend txtSendCMD.Text, "rcon"
txtSendCMD.Text = ""
End Select
End Sub
Private Sub wskRcon_Close()
wskRcon.Close
End Sub
Private Sub wskRcon_DataArrival(ByVal bytesTotal As Long)
On Error GoTo err2
Dim buffer As String
wskRcon.GetData buffer
buffer = Right(buffer, Len(buffer) - 4)
buffer = Replace(buffer, Chr(CLng("&H" & "0A")), "") ' stupid unknow ascii
buffer = Replace(buffer, "print", "")
buffer = Replace(buffer, "\", vbNewLine)
With txtRconConsole
.SelStart = Len(.Text)
.SelText = buffer & vbNewLine
End With
If 0 = 1 Then
err2:
txtRconConsole.Text = txtRconConsole.Text & vbNewLine & Err.Description
End If
End Sub
Private Sub wskRcon_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
txtRconConsole.Text = txtRconConsole.Text & vbNewLine & Description
End Sub
"ÿÿÿÿ" is standing for a special type of character compression, just forgot the name but in my tool iam ignoring it
Here I started such an idea of a tool in vb.net , but i have no time to complete it
****. i have no clue about vb.
but thanks already. maybe someone can finish it.
That would be a cool application, if someone could code it.
Hmm...
I'll try to work on it....not sure where im gonna get!

timer in vb.net cf

I am trying to create a simple stopwatch like app and am having a hard time figuring it out.
in vb.net i can simply use Timer.Start() or Timer.Stop()
This will not work in the .net cf though. I googled the topic for over an hour and did a quick search on the forum and found no result.
Can anyone help me with a way around this, there has to be something simple I am missing or another way to do it. I just need a timer i can start, stop, pause and resume.
Thanks in advance.
Set the timer's Enabled property to true/false.
that works to start and stop it but if i want to pause and then resume it starts from the very begging instead of where it was paused.
ex: pause after 10sec. wait 10sec and hit resume....the timer jumps to 20sec instead of going to 11sec
Why not increment a variable when the timer ticks? Post some sample code here and we could help you debug it....
Do the calculations by using DateTime and TimeSpan.
Code:
Public Class Form1
Dim startTime As DateTime
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
Dim span As TimeSpan = DateTime.Now.Subtract(startTime)
lblTimer.Text = span.Hours.ToString & ":" & span.Minutes.ToString & ":" & span.Seconds.ToString
btnStop.Enabled = True
btnPause.Enabled = True
End Sub
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
startTime = DateTime.Now()
Timer.Start()
If (Timer.Enabled = True) Then
btnStart.Text = "Restart"
End If
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
If (Timer.Enabled) Then
Timer.Stop()
End If
End Sub
Private Sub btnPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPause.Click
If (Timer.Enabled) Then
Timer.Stop()
btnPause.Text = ("Resume")
Else : Timer.Start()
btnPause.Text = ("Pause")
End If
End Sub
End Class
now the problem is timer.start and timer.stop do not work as they are not included in the cf
I code in C#, but don't you need to declare a variable of type Timer to use it? I don't think there are any static methods for the Timer class.
the above code works fine in the standard .net framework but the start and stop methods are not in the compact framework so i need to find a way around that
Sorry, I got confused with the naming conventions - I thought Timer was a class reference.
Start and Stop works in the full framework, but the logic of your code is wrong - you are always subtracting the _start_ time from the current time when the timer ticks. This is why when you resume, it's still counting how many seconds has passed since you pressed Start.
This should work:
Code:
Public Class Form1
Dim startTime As DateTime
Dim span As TimeSpan
Dim hours, minutes, seconds As Integer
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
span = DateTime.Now.Subtract(startTime)
lblTimer.Text = span.Hours.ToString & ":" & span.Minutes.ToString & ":" & span.Seconds.ToString
End Sub
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
startTime = DateTime.Now()
Timer.Enabled = True
If (Timer.Enabled = True) Then
btnStart.Text = "Restart"
End If
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
Timer.Enabled = False
End Sub
Private Sub btnPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPause.Click
If (Timer.Enabled) Then
Timer.Enabled = False
btnPause.Text = ("Resume")
hours = span.Hours
minutes = span.Minutes
seconds = span.Seconds
Else
startTime = DateTime.Now.Subtract(New TimeSpan(hours, minutes, seconds))
Timer.Enabled = True
btnPause.Text = ("Pause")
End If
End Sub
End Class
Man, coding in VB brings back memories...
...i see your point thanks a lot...as soon as i am done backing the hard drive up in my msi wind i will give this a shot...thanks again

Hiding/showing a form (vb.net)

I am trying to replace my contacts program with one I wrote myself but I'm having a little problem getting the form to hide and then show again?
I would like to start my app from a button, easy enough but I'm a little confused with hiding it again. I can hide the form but if I press the button again nothing happens but I'd like my app to show itself again?
Could someone please help the village idiot and point me in the right direction please?
Ok solved my problem. I used another exe to boot the program and if it was already booted then show the program via the API.
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Module ModMain
<DllImport("coredll")> _
Public Function FindWindow(ByVal lpClass As String, ByVal lpTitle As String) As IntPtr
End Function
<DllImport("CoreDll")> _
Public Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
End Function
<DllImport("CoreDll")> _
Public Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean
End Function
Const SW_HIDE As Integer = 0
Const SW_SHOW As Integer = 5
Public Sub Main()
Dim hWnd As Long = FindWindow("#NETCF_AGL_BASE_", "Contacts")
If hWnd = IntPtr.Zero Then
Dim AP As New Process
AP.StartInfo.FileName = "Program Files\ContactsList2\ContactsList2.exe"
AP.Start()
Else
ShowWindow(hWnd, SW_SHOW)
SetForegroundWindow(hWnd)
End If
End Sub
End Module

Categories

Resources