Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi , Friends

WM_COPYDATA , Copy the text into another app ? Or Can we use instead of SetWindowText

SendMessageA 0,&H4A,wparam,Byval cds

the above just returen False And True Value not copy text



What I have tried:

Dim cds As COPYSTRUCT
With cds
.dwType=1
.dwSize=LenB(String)*2+2
.lpData=StrPtr(String)
End With

SendMessageA hwnd,WM_SETTEXT,0,Byval cds

no Sent The String
Posted
Comments
[no name] 27-Jan-22 10:31am    
It looks like you are trying to send Unicode data by an ASCII method. But I get the feeling that you could do things much easier by sticking to VB.NET and avoiding all these internal Windows functions and messages.
[no name] 27-Jan-22 11:27am    
the string is "123/67Xb" but return null
[no name] 27-Jan-22 11:34am    
You cannot pass a COPYSTRUCT to WM_SETTEXT, it requires a string. You also cannot send Unicode text when using SendMessageA. You must either use an ASCII string or use SendMessageW. All of the information required by these functions is documented in MSDN at Windows and Messages - Win32 apps | Microsoft Docs[^],
which is the place to check that you are following the correct procedures.

But as I suggested above, you could most likely solve your problem quicker by using the proper .NET controls.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900