TailBite 1.0 Preview, soon in PureProject and PureArea
Moderators: gnozal, ABBKlaus, lexvictory
ABBKlaus wrote:@Maxus,
Please supply a snippet for what is not working![]()
This is from the TailBite manual and should work :You can make your function accept variable arguments. To do so, you must include two or more ProcedureDLL's with the same name and an index number:
This use to work in TailBite for PB3.94
Code: Select all
ProcedureDLL.l MsgTest3(Line.s,Title.s,Icon.l)
MessageRequester(Title,Line,Icon)
EndProcedure
ProcedureDLL.l MsgTest2(Line.s,Title.s)
MsgTest3(Line,Title,#MB_ICONINFORMATION)
EndProcedure
ProcedureDLL.l MsgTest(Line.s)
MsgTest3(Line,"Hello",#MB_ICONINFORMATION)
EndProcedure
MsgTest(Line.s [, Title.s [, Icon.l]])
If you TailBite this code for PB4.x you get...
MsgTest(Line.s [, Title.s , Icon.l])
Latest TailBite seems to only recognize 1 additional argument, not multiple arguments.
Code: Select all
ProcedureDLL DEbuger_Init()
Global ST=1
EndProcedure
ProcedureDLL.l MSGBOX(String.s, FColor.l)
If Not IsWindow(0)
ExamineDesktops()
LoadFont(0,"Sans Serif",8,#PB_Font_Bold)
OpenWindow(0,0,0,DesktopWidth(0),400,"Debug"):CreateGadgetList(WindowID(0))
ListIconGadget(0,5,5,DesktopWidth(0)-10,390,"Message",DesktopWidth(0)-31,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
SetGadgetFont(0,FontID(0))
EndIf
AddGadgetItem(0,-1,String$)
If Fcolor=-1:Fcolor=0:EndIf
SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_FrontColor,FColor)
If ST=0
SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_BackColor,$EEEEEE):ST=1
Else
SetGadgetItemColor(0,CountGadgetItems(0)-1,#PB_Gadget_BackColor,$FFFFFF):ST=0
EndIf
EndProcedure
ProcedureDLL.l MSGBOX2(String$)
MSGBOX(String$,-1)
EndProcedure
ProcedureDLL DECL()
ClearGadgetItemList(0)
EndProcedure
ProcedureDLL DEbuger_End()
If IsWindow(0)
Repeat
Until WindowEvent()=#PB_Event_CloseWindow
EndIf
EndProcedure
What's wrong? ? ?
Sorry my English, I'm Russian
AMT Laboratory
AMT Laboratory
@Paul
i know this worked in PB3.94 but i don´t have that sources anymore
(TailBite1.3B0.1)
this works in the current version of TailBite :
@Maxus :
some typing errors with string$/string.s and i prefer internal procedures. That way you can use optional parameters
PS:
the order of the functions is essential in the current version of TailBite
Right usage :
Regards Klaus
i know this worked in PB3.94 but i don´t have that sources anymore

this works in the current version of TailBite :
Code: Select all
Declare.l MsgTest3(Line.s,Title.s,Icon.l)
ProcedureDLL.l MsgTest(Line.s)
MsgTest3(Line,"Hello",#MB_ICONINFORMATION)
EndProcedure
ProcedureDLL.l MsgTest2(Line.s,Title.s)
MsgTest3(Line,Title,#MB_ICONINFORMATION)
EndProcedure
ProcedureDLL.l MsgTest3(Line.s,Title.s,Icon.l)
MessageRequester(Title,Line,Icon)
EndProcedure
some typing errors with string$/string.s and i prefer internal procedures. That way you can use optional parameters

Code: Select all
ProcedureDLL DEbuger_Init()
Global ST=1
Global Window_MSGBox
Global Font_SansSerif
Global ListIcon_MSGBox
EndProcedure
Procedure.l ipf_MSGBOX(String.s, FColor.l=-1)
If Not IsWindow(Window_MSGBox)
ExamineDesktops()
Font_SansSerif=LoadFont(#PB_Any,"Sans Serif",8,#PB_Font_Bold)
Window_MSGBox=OpenWindow(#PB_Any,0,0,DesktopWidth(0),400,"Debug"):CreateGadgetList(WindowID(Window_MSGBox))
ListIcon_MSGBox=ListIconGadget(#PB_Any,5,5,DesktopWidth(0)-10,390,"Message",DesktopWidth(0)-31,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
SetGadgetFont(ListIcon_MSGBox,FontID(Font_SansSerif))
EndIf
AddGadgetItem(ListIcon_MSGBox,-1,String)
If Fcolor=-1:Fcolor=0:EndIf
SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_FrontColor,FColor)
If ST=0
SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_BackColor,$EEEEEE):ST=1
Else
SetGadgetItemColor(ListIcon_MSGBox,CountGadgetItems(ListIcon_MSGBox)-1,#PB_Gadget_BackColor,$FFFFFF):ST=0
EndIf
EndProcedure
ProcedureDLL.l MSGBOX(String.s)
ipf_MSGBOX(String)
EndProcedure
ProcedureDLL.l MSGBOX2(String.s,FColor.l)
ipf_MSGBOX(String,FColor)
EndProcedure
ProcedureDLL DECL()
ClearGadgetItemList(ListIcon_MSGBox)
EndProcedure
ProcedureDLL DEbuger_End()
If IsWindow(Window_MSGBox)
Repeat
Until WindowEvent()=#PB_Event_CloseWindow
EndIf
EndProcedure
the order of the functions is essential in the current version of TailBite

Right usage :
Code: Select all
ProcedureDLL SomeFunction(Param1)
EndProcedure
ProcedureDLL SomeFunction2(Param1,Param2)
EndProcedure
ProcedureDLL SomeFunction3(Param1,Param2,Param3)
EndProcedure
Last edited by ABBKlaus on Tue Jul 10, 2007 8:25 pm, edited 1 time in total.
update is out : TailBite v1.3 PR 1.848
- should be more VISTA compatible now, TailBite_Intstaller.exe + TBUpdater.exe now request administrator mode
would be nice if someone could test this, i don´t have vista atm
- fixed : the preferences are loaded correctly now
- fixed : under some conditions the Compilers folder could be deleted
- added : Subsystem now changes accordingly to the checkboxes
Regards Klaus
- should be more VISTA compatible now, TailBite_Intstaller.exe + TBUpdater.exe now request administrator mode
would be nice if someone could test this, i don´t have vista atm

- fixed : the preferences are loaded correctly now
- fixed : under some conditions the Compilers folder could be deleted
- added : Subsystem now changes accordingly to the checkboxes
Regards Klaus
Excuse me but if I declare a prototype like this, MsgBox doesn't become a function...ABBKlaus wrote:same restrictions as ProcedureDLL, no optional parameters.
Code: Select all
ProcedureDLL Lib_Init()
OpenLibrary(0, "User32.dll")
Endprocedure
Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l = 0)
Global MsgBox.ProtoMessageBox = GetFunction(0, "MessageBoxA")
@Progi1984
Your MsgBox-Function is like a variable, so you can't export it in a lib.
You have to wrappe this in a ProcedureDLL like:
but this make no sense 
Your MsgBox-Function is like a variable, so you can't export it in a lib.
You have to wrappe this in a ProcedureDLL like:
Code: Select all
Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l)
ProcedureDLL Lib_Init()
OpenLibrary(0, "User32.dll")
Global MsgBox_.ProtoMessageBox = GetFunction(0, "MessageBoxA")
EndProcedure
Procedure MsgBox(Fenetre.l, Corps$, Titre$)
ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, 0)
EndProcedure
Procedure MsgBox2(Fenetre.l, Corps$, Titre$, Options.l)
ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, Options)
EndProcedure

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

@TS-Soft :
small bug in your example
@Progi1984 please forget what i said about the prototypes and optional parameters, should work with it 
small bug in your example

Code: Select all
Prototype.l ProtoMessageBox(Fenetre.l, Corps$, Titre$, Options.l=0)
ProcedureDLL Lib_Init()
Global User32
Global MsgBox_.ProtoMessageBox
User32=OpenLibrary(#PB_Any, "User32.dll")
If User32
MsgBox_ = GetFunction(User32, "MessageBoxA")
EndIf
EndProcedure
ProcedureDLL Lib_End()
If IsLibrary(User32)
CloseLibrary(User32)
EndIf
EndProcedure
ProcedureDLL MsgBox(Fenetre.l, Corps$, Titre$)
If MsgBox_
ProcedureReturn MsgBox_(tre.l, Corps$, Titre$)
EndIf
EndProcedure
ProcedureDLL MsgBox2(Fenetre.l, Corps$, Titre$, Options.l)
If MsgBox_
ProcedureReturn MsgBox_(tre.l, Corps$, Titre$, Options)
EndIf
EndProcedure

Last edited by ABBKlaus on Tue Jul 10, 2007 8:10 pm, edited 1 time in total.
Code: Select all
OpenLibrary(0, "User32.dll")
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

good point ts-softts-soft wrote:And in a lib you should use the dynamic IDs: #PB_Any ! (for all, not only for DLLs)Code: Select all
OpenLibrary(0, "User32.dll")

this should be true for all PB-ID´s !
PS: i replaced all examples above with #PB_Any´s
@ABBKlaus : continued thanks for your great work. Just wondering though if you might create another thread where the latest versions of Tailbite could be easily found, i.e. the most up to date link kept permanently in the first post etc? As it is I always seem to miss the latest updates!
Thanks.
**EDIT: just compiled a lib with the unicode switch. Is this new version of Tailbite supposed to place the compiled lib in the unicode subsystem? In my case it is simply placing it in the regular PureLibraries\UserLibraries folder etc.
Thanks.
**EDIT: just compiled a lib with the unicode switch. Is this new version of Tailbite supposed to place the compiled lib in the unicode subsystem? In my case it is simply placing it in the regular PureLibraries\UserLibraries folder etc.
I may look like a mule, but I'm not a complete ass.