Click here to Skip to main content
15,913,669 members
Home / Discussions / Mobile
   

Mobile

 
AnswerRe: Animation image Pin
Christopher Fairbairn22-May-07 16:37
Christopher Fairbairn22-May-07 16:37 
GeneralRe: Animation image Pin
Blue_Boy23-May-07 1:57
Blue_Boy23-May-07 1:57 
QuestionHow to retreive UUID of the device connected via USB to my PC. Pin
AmarjeetSinghMatharu18-May-07 2:06
AmarjeetSinghMatharu18-May-07 2:06 
AnswerRe: How to retreive UUID of the device connected via USB to my PC. Pin
Christopher Fairbairn22-May-07 16:22
Christopher Fairbairn22-May-07 16:22 
Questiondatagrid Pin
minkinin17-May-07 23:04
minkinin17-May-07 23:04 
AnswerRe: datagrid Pin
Yogesh Kumar Chauhan28-May-07 1:06
Yogesh Kumar Chauhan28-May-07 1:06 
QuestionHow to insert phonebookentry in the sim? Pin
genoher16-May-07 9:31
genoher16-May-07 9:31 
Question.NET CF 1.1 Clipboard [modified] Pin
Burillo15-May-07 9:43
Burillo15-May-07 9:43 
As you might know, there's no "Clipboard" object in .NET Compact Framework 1.1 (target device PocketPC2002). However, i can access the clipboard through P/Invoke.

The thing is:

Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _<br />
ByVal hWnd As Long, ByVal uMsg As Long, _<br />
ByVal wParam As Long, ByVal lParam As Long) As Long


typical clipboard function call would be SendMessage(hWnd, WM_COPY, 0, 0). But i don't know how to obtain a handle of the TextBox control. Can someone help me?

i tried this solution, but it didn't work.

EDIT: Looks like i need a handle of an active window, so i get it through GetFocus(). I saw a hWnd as Long declaration somewhere, but it doesn't affect anything since IntPtr and Long are basically the same.

Here's my code:

<br />
...P/INVOKE<br />
    Declare Function GetFocus Lib "coredll.dll" () As IntPtr<br />
    Declare Function SendMessage Lib "coredll.dll" Alias "SendMessageA" ( _<br />
    ByVal hWnd As IntPtr, ByVal uMsg As Long, _<br />
    ByVal wParam As Long, ByVal lParam As Long) As Long<br />
...END P/INVOKE<br />
<br />
...SUB<br />
        Dim hWnd As IntPtr<br />
        hWnd = GetFocus()<br />
        Try<br />
            SendMessage(hWnd, WM_COPY, 0, 0)<br />
            MsgBox("SUCCESS")<br />
        Catch ex As Exception<br />
            MsgBox("FAILED" & vbCrLf & ex.Message)<br />
        End Try<br />
...END SUB<br />


Msgboxing hWnd returns a value (some integers, so this one works), but SendMessage fails throwing NotSupportedException. Any solution out there?


EDIT

i found a working solution!

the correct function declaration is:

Declare Function SendMessage Lib "coredll.dll" (ByVal hWnd As IntPtr, ByVal Msg As System.Int32, ByVal wParam As System.Int32, ByVal lParam As System.Int32) As IntPtr

This is the code for obtaining a handle of the control:

Public Function gethWnd(ByVal ctrl As Control)<br />
    Dim hOldWnd As IntPtr = GetCapture()<br />
    ctrl.Capture = True<br />
    Dim hWnd As IntPtr = GetCapture()<br />
    ctrl.Capture = False<br />
    SetCapture(hOldWnd)<br />
    Return hWnd<br />
End Function


This code requires two additional declarations:

Declare Function GetCapture Lib "coredll.dll" () As IntPtr<br />
Declare Function SetCapture Lib "coredll.dll" (ByVal hWnd As IntPtr) As IntPtr


And so the final message call will look like this:

SendMessage(gethWnd(CONTROL), WM_COPY, 0, 0)

and the constants declaration:

Public Const EM_CANUNDO = &HC6<br />
Public Const EM_EMPTYUNDOBUFFER = &HCD<br />
Public Const WM_COPY = &H301<br />
Public Const WM_PASTE = &H302<br />
Public Const WM_CLEAR = &H303<br />
Public Const WM_UNDO = &H304

QuestionHow to set namespace to xmlDocument Pin
shay_he15-May-07 7:50
shay_he15-May-07 7:50 
QuestionInstall .NETCF Pin
Blue_Boy15-May-07 5:35
Blue_Boy15-May-07 5:35 
QuestionTextbox caret position (trigger events when changed) [modified] Pin
Burillo14-May-07 0:50
Burillo14-May-07 0:50 
Questioncontrol desappears after rebuild Pin
Tushar Mahajan13-May-07 23:21
Tushar Mahajan13-May-07 23:21 
Questionhow to take data from USB port using C Pin
yong_fuk13-May-07 13:57
yong_fuk13-May-07 13:57 
QuestionProblem accessing files that are stored in ROM Pin
ReinerZiegler11-May-07 3:36
ReinerZiegler11-May-07 3:36 
AnswerRe: Problem accessing files that are stored in ROM Pin
Mike Dimmick12-May-07 13:29
Mike Dimmick12-May-07 13:29 
GeneralRe: Problem accessing files that are stored in ROM Pin
ReinerZiegler13-May-07 1:26
ReinerZiegler13-May-07 1:26 
QuestionHow to create an application to Convert Cell phone Airtime Pin
Vimalsoft(Pty) Ltd11-May-07 2:32
professionalVimalsoft(Pty) Ltd11-May-07 2:32 
QuestionSqlCe Error Pin
Blue_Boy10-May-07 0:30
Blue_Boy10-May-07 0:30 
QuestionPocketPC Java editor Pin
ztech.ru9-May-07 13:09
ztech.ru9-May-07 13:09 
Questionreplication Pin
SVb.net9-May-07 8:32
SVb.net9-May-07 8:32 
QuestionPlaying video file on pocket pc Pin
chloe_hhi8-May-07 21:57
chloe_hhi8-May-07 21:57 
AnswerRe: Playing video file on pocket pc Pin
Christopher Fairbairn22-May-07 15:21
Christopher Fairbairn22-May-07 15:21 
QuestionCheckbox on a BlackBerry 8800 Pin
JollyRubber8-May-07 2:39
JollyRubber8-May-07 2:39 
QuestionHandling the PIN entering dialog Pin
Tjie Pouw7-May-07 20:20
Tjie Pouw7-May-07 20:20 
AnswerRe: Handling the PIN entering dialog Pin
Christopher Fairbairn22-May-07 15:27
Christopher Fairbairn22-May-07 15:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.