![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Additional Libraries Users contributed libraries. This sub-forum is only available to licensed users. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Did you ever miss a B4PPC control event? This is the answer.
This library allows you to add more (missed) events to B4PPC controls. Based on excellent code of the ".NET Compact Framework Team" found here http://blogs.msdn.com/netcfteam/arch...20/420551.aspx Needs .NET 2.0 (don't forget MyApp.EXE.config file) DLLs for desktop and device among with sample project (source and exe) are attached. Windows Events list can be found here http://wiki.winehq.org/List_Of_Windows_Messages and here http://www.autohotkey.com/docs/misc/SendMessageList.htm A useful windows spy application (Winspector) can be downloaded here http://www.windows-spy.com/ Sample code used to move a label on a form while pressing arrow keys Code:
Sub Globals
End Sub
Sub App_Start
'Add dzEventsMagic object and name it dzem
dzem.New1("Form1", true)
'Hook WM_KEYDOWN message
dzem.Hook(256)
Form1.Show
End Sub
Sub Form1_Close
dzem.UnHook(256)
End Sub
Sub dzem_MagicEvent
'Left Arrow
If dzem.wParam = 37 Then
label1.Text = "LEFT"
If label1.Left > 0 Then
label1.Left = label1.Left - 1
End If
End If
'Up Arrow
If dzem.wParam = 38 Then
label1.Text = "UP"
If label1.Top > 0 Then
label1.Top = label1.Top - 1
End If
End If
'Right Arrow
If dzem.wParam = 39 Then
label1.Text = "RIGHT"
If label1.left < Form1.Width - label1.Width Then
label1.Left = label1.Left + 1
End If
End If
'Down Arrow
If dzem.wParam = 40 Then
label1.Text = "DOWN"
If label1.Top < Form1.Height - label1.Height Then
label1.Top = label1.Top + 1
End If
End If
End Sub
|
|
||||
|
From what I could see, with this lib we can now raise an event upon a key stroke, correct?
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
||||
|
Search using Google for every message of your interest (See message lists in my first post). Usually the first hit is an MSDN article describing the message.
Or/And download and install Winspector (see also my first post). Run it, and drag (while pressing CTRL key) the red circle with a cross to a control or window to see it's messsges. Detailed instructions here http://www.windows-spy.com/features/findwindow.shtml |
|
||||
|
And... one more sample. A clickable label showing how to add mouse events to controls using dzEventsMagic.
Code:
Sub Globals
Dim Label1Clicked
End Sub
Sub App_Start
'Add dzEventsMagic object and name it dzem
'Set by default ReturnHandled parameter to false
'so the message can be farther processed
dzem.New1("Label1", false)
'Hook WM_LBUTTONDOWN
dzem.Hook(513)
'WM_LBUTTONUP
dzem.Hook(514)
Label1Clicked = false
Form1.Show
End Sub
Sub Form1_Close
dzem.UnHook(513)
dzem.UnHook(514)
End Sub
Sub dzem_MagicEvent
'WM_LBUTTONDOWN
If dzem.msg = 513 Then
label1.Color = 0,128,0
label1.FontSize = 12
Label1Clicked = true
End If
'WM_LBUTTONUP
'This message fires for the Label only in PC
If dzem.msg = 514 Then
label1.Color = 0,255,0
label1.FontSize = 9
End If
End Sub
'Tip. In PPC WM_LBUTTONUP is received by the form, not the label
'So we catch Form MouseUp event to release label
Sub Form1_MouseUp (x,y)
If Label1Clicked Then
Label1Clicked = false
label1.Color = 0,255,0
label1.FontSize = 9
End If
End Sub
Last edited by dzt : 09-01-2007 at 07:51 AM. |
|
||||
|
Hello Dimitris
Perhaps you are already aware of it, the label move demo works only under the condition that no input controls (numerical UpDn, Textbox, Image button) are on that form. MagicEvent does not fire in presence of input controls. Cheers Robert |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|