03-19-2005, 09:02 PM
Hi, All!
1. I try to set QRichEdit (RapidQ basic) properties using API SendMessage function, calling from FB created dll.
FB DLL
[syntax="qbasic"] option explicit
#ifdef FB__WIN32
'$include: 'inc\win\kernel32.bi'
#endif
#define EM_SETBKGNDCOLOR 1091
#define WM_SETTEXT 12
Declare Function SendMessageA LIB "user32" Alias "SendMessageA" _
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, byref lParam As any ) As Integer
declare function CallDll lib "fromRQObjCall.dll" alias "CallDll" _
(byval SenderHandle as long, byval targetHAndle as long) as long
'$include: 'DllMain.bi'
'*********************'
function CallDll (byval SenderHandle as long, byval targetHAndle as long) as long export
dim zzz as integer, pzzz as long ptr
dim txt as string, saddtxt as byte ptr
dim ptxt as byte ptr
txt="12345" : saddtxt=sadd(txt) : ptxt=varptr(txt)
zzz=&h000000ff : pzzz=varptr(zzz)
CallDll=SendMessageA(targetHAndle, EM_SETBKGNDCOLOR, 0, &h000000ff )
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, "12345" )
end function
[/syntax]
targetHAndle - handle of RichEdit
Question1.
Why in user32.bi
Declare Function SendMessage Alias "SendMessageA" ....
without LIB "user32" ?
Question2.
If I use
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, "12345" )
- all works fine (and EM_SETBKGNDCOLOR too ),
but if I use
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, txt )
some garbage appears in RichEdit, not "12345" string
And EM_SETBKGNDCOLOR message not workin if I use variable, not value.
Thank you.
1. I try to set QRichEdit (RapidQ basic) properties using API SendMessage function, calling from FB created dll.
FB DLL
[syntax="qbasic"] option explicit
#ifdef FB__WIN32
'$include: 'inc\win\kernel32.bi'
#endif
#define EM_SETBKGNDCOLOR 1091
#define WM_SETTEXT 12
Declare Function SendMessageA LIB "user32" Alias "SendMessageA" _
(ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, byref lParam As any ) As Integer
declare function CallDll lib "fromRQObjCall.dll" alias "CallDll" _
(byval SenderHandle as long, byval targetHAndle as long) as long
'$include: 'DllMain.bi'
'*********************'
function CallDll (byval SenderHandle as long, byval targetHAndle as long) as long export
dim zzz as integer, pzzz as long ptr
dim txt as string, saddtxt as byte ptr
dim ptxt as byte ptr
txt="12345" : saddtxt=sadd(txt) : ptxt=varptr(txt)
zzz=&h000000ff : pzzz=varptr(zzz)
CallDll=SendMessageA(targetHAndle, EM_SETBKGNDCOLOR, 0, &h000000ff )
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, "12345" )
end function
[/syntax]
targetHAndle - handle of RichEdit
Question1.
Why in user32.bi
Declare Function SendMessage Alias "SendMessageA" ....
without LIB "user32" ?
Question2.
If I use
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, "12345" )
- all works fine (and EM_SETBKGNDCOLOR too ),
but if I use
CallDll=SendMessageA(targetHAndle, WM_SETTEXT, 0, txt )
some garbage appears in RichEdit, not "12345" string
And EM_SETBKGNDCOLOR message not workin if I use variable, not value.
Thank you.
ith best regards, Andrew Shelkovenko.
http://www.wildgardenseed.com/RQDP/FreeBasic/index.html - FreeBasic documentation Project
http://www.wildgardenseed.com/RQDP/FreeBasic/index.html - FreeBasic documentation Project