sancho3 wrote:I am using Ubuntu not Windows.
These 3 tries return 0, the last attempt is the window name.
Code: Select all
#Include Once "IUP/iup.bi"
#Include Once "IUP/iup_scintilla.bi"
'dim As ihandle ptr hsci = IupGetHandle( Strptr("DirectorExtension"))
'dim As ihandle ptr hsci = IupGetHandle( Strptr( "CLASS:Scintilla; INSTANCE:0"))
dim As ihandle ptr hsci = IupGetHandle( Strptr( "poseidonFB - FreeBasic IDE"))
? hsci
Sleep
We couldn't use IupGetHandle in different program, they have Independent memory block, so the getting handle is null.....
I am not a expert about get the window message/handle, what I think is dynamic library( like plugin......I think ):
(1) poseidonFB send the main handle to DLL
(2) In DLL code blocks, Use main handle to do something
(3) ......
I wrote below code and worked in Windows 7 / Linux mint, it convert the document text to upper case and show the poseidonFB main dialog raster size, but it need poseidonFB init/send the handle first.....
Code: Select all
#include once "IUP/iup.bi"
#include once "IUP/iup_scintilla.bi"
'Compile with -dll option
extern "C"
declare sub Send_PoseidonFB_HANDLE alias "Send_PoseidonFB_HANDLE" ( _ih as Ihandle ptr ) ' Send poseidonFB's main dialog handle to DLL, the using "IupGetDialogChild" get child handle
declare sub Send_SCINTILLA alias "Send_SCINTILLA" ( _ih as Ihandle ptr )
declare sub Dll_Go alias "Dll_Go" ()
dim shared as Ihandle ptr POSEIDONFB_HANDLE
dim shared as Ihandle ptr SCINTILLA_HANDLE
sub Send_PoseidonFB_HANDLE alias "Send_PoseidonFB_HANDLE"( _ih as Ihandle ptr ) export
POSEIDONFB_HANDLE = _ih
end sub
sub Send_SCINTILLA alias "Send_SCINTILLA"( _ih as Ihandle ptr ) export
SCINTILLA_HANDLE = _ih
end sub
sub Dll_Go alias "Dll_Go"() export
' open a dialog
IupOpen( 0, 0 )
var dlg = IupDialog( 0 )
IupSetAttributes( dlg, "TITLE=Dll Dialog,RASTERSIZE=640x480" )
IupShow( dlg )
' Upper case All Document Text
if( SCINTILLA_HANDLE <> 0 ) then
dim as zstring ptr fileString = IupGetAttribute( SCINTILLA_HANDLE, "VALUE" )
dim as string document = ucase( fileString[0] )
IupSetAttribute( SCINTILLA_HANDLE, "VALUE", document )
end if
' Show the poseidonFB main dialog size
if( POSEIDONFB_HANDLE <> 0 ) then
IupMessage( "PoseidonFB Size", IupGetAttribute( POSEIDONFB_HANDLE, "RASTERSIZE" ) )
end if
IupMainLoop()
IupClose()
end sub
end extern