i have this code:
<DllImport("coredll")> _
Private Shared Function SetDevicePower(ByVal pvDevice As String, ByVal dwDeviceFlags As Integer, ByVal DeviceState As devicepowerstate) As Integer
End Function
Public Enum devicepowerstate : int
Unspecified = -1
D0 = 0
D1 = 1
D2 = 2
D3 = 3
D4 = 4
End Enum
Const POWER_NAME As Integer = &H1
SetDevicePower("BKL1:", POWER_NAME, devicepowerstate.D3)
when i use D3, my backlight goes DIM (which is what i am aiming for) but when my LCD goes off (idle mode) and then i click on any key to reactivate my DIMMED backlight, the LCD does TURN ON but my backlight stays OFF.
im using it on my T-Mobile SDA WM5.
Related
Dim CanRat As LINEHSCSDCODING = LINEHSCSDCODING.CODING_4800
Dim Ekip As LINEEQUIPSTATE = LINEEQUIPSTATE.FULL
ret = CellTSP.lineGetCurrentHSCSDStatus(BuHat.hLine, Ekip, System.Runtime.InteropServices.Marshal.ReadInt32(iki), System.Runtime.InteropServices.Marshal.ReadInt32(uc), System.Runtime.InteropServices.Marshal.ReadInt32(dort), CanRat)
what is wrong
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.
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!
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
I am currently working on my "SciLor's WiMoBlue". The new protocol is ready. Everything works fine, until I send much data at the same time.
For example if I try to send an image in that way:
Code:
Public Sub SendImage(ByVal Image As Bitmap, ByVal Position As Point, ByVal Format As ImageFormat)
Dim PosX, PosY, Width, Height As Byte()
Dim ImageStream As New IO.MemoryStream
Dim ImageLength As Integer
Dim ImageLengthBytes As Byte()
Dim ImageBuffer(MaxChunkSize - HeaderSize - 1) As Byte
PosX = BitConverter.GetBytes(Position.X)
PosY = BitConverter.GetBytes(Position.Y)
Width = BitConverter.GetBytes(Image.Width)
Height = BitConverter.GetBytes(Image.Height)
Image.Save(ImageStream, ImageFormat2ImagingFormat(Format))
ImageStream.Seek(0, SeekOrigin.Begin)
ImageLength = ImageStream.Length
ImageLengthBytes = BitConverter.GetBytes(ImageLength)
SendData(BuildCommand(BaseProtocol.Image, ImageProtocol.Initiate, CombineBytes(PosX, PosY, Width, Height, ImageLengthBytes)))
Thread.Sleep(2000)
Dim DataPos As Integer
For DataPos = 0 To ImageStream.Length - MaxChunkSize - HeaderSize - 1 Step MaxChunkSize - HeaderSize
ImageStream.Read(ImageBuffer, 0, MaxChunkSize - HeaderSize)
SendData(BuildCommand(BaseProtocol.Image, ImageProtocol.Data, ImageBuffer))
'WaitForNextChunk = True
'Do While WaitForNextChunk = True
'Loop
'Thread.Sleep(2000)
Next
ImageBuffer = New Byte(ImageLength - DataPos - 1) {}
ImageStream.Read(ImageBuffer, 0, ImageBuffer.Length)
SendData(BuildCommand(BaseProtocol.Image, ImageProtocol.End, ImageBuffer))
End Sub
SendData:
Code:
If Data.Length > MaxChunkSize Then
MsgBox("Data to long... " & vbNewLine & "SendSize:" & Data.Length & vbNewLine & "MaxSize:" & MaxChunkSize)
Else
If btClient.Connected = True And isRecieving = True Then
btStream.Write(Data, 0, Data.Length)
btStream.Flush()
End If
End If
Recieving Part:
Code:
While isRecieving = True
If btStream IsNot Nothing And btStream.DataAvailable = True Then
Try
Recieved = btStream.Read(myHeader, 0, myHeader.Length)
If myHeader(0) = HeaderIdentifier And myHeader(1) = OtherModeHeader Then
btStream.Read(myDataSize, 0, 2)
DataLength = BitConverter.ToInt16(myDataSize, 0)
myBuffer = New Byte(DataLength - 1) {}
Recieved = 0
Do Until Recieved = DataLength
If btStream.DataAvailable = True Then
Recieved += btStream.Read(myBuffer, Recieved, DataLength - Recieved)
End If
Loop
ExecuteCommand(myHeader(2), myHeader(3), myBuffer)
Else
Debug.WriteLine("WrongData")
Exit While
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
If Recieved = 0 Then
Exit While
End If
End Try
End If
End While
If I send the image, without Thread.Sleeps (huighe ones). The recieving stream gets weird. The gets btStream.DataAvailable = False forever. If I remove that ckeck, it hangs at the btStream.Read.
I also tried to fix that with waiting for the answer of the server, but the problem doesn't get solved.
Do you have any idea how to fix that problem?. In that speed the image sending is worthless
SciLor