@wilbert
Sorry but your updated code is wrong, you must not increment the separator counter if there is no match.
The line 'i + 1' must be inside the 'If...Else' block.
					Search found 28 matches
- Sun Jun 25, 2017 6:51 pm
 - Forum: Tricks 'n' Tips
 - Topic: [PB4] Split() and Join() commands
 - Replies: 16
 - Views: 13853
 
- Sun Jun 25, 2017 9:54 am
 - Forum: Tricks 'n' Tips
 - Topic: [PB4] Split() and Join() commands
 - Replies: 16
 - Views: 13853
 
Re: [PB4] Split() and Join() commands
@wilbert
You should test your Split function with a separator with more than one character and when the first char of sep matches.
Example: StringToSplit = "ABCxzDEFxyGHI", Separator = "xy"
Fixed version:
Procedure.i Split(Array StringArray.s(1), StringToSplit.s, Separator.s = " ")
Protected c ...
					You should test your Split function with a separator with more than one character and when the first char of sep matches.
Example: StringToSplit = "ABCxzDEFxyGHI", Separator = "xy"
Fixed version:
Procedure.i Split(Array StringArray.s(1), StringToSplit.s, Separator.s = " ")
Protected c ...
- Sat Jun 24, 2017 7:59 pm
 - Forum: Coding Questions
 - Topic: Modified StringField() ?
 - Replies: 8
 - Views: 2809
 
Re: Modified StringField() ?
@wilbert
You should test your Split function with a separator with more than one character and when the first char of the sep matches.
Example: StringToSplit = "ABCxzDEFxyGHI", Separator = "xy"
Fixed version:
Procedure.i Split(Array StringArray.s(1), StringToSplit.s, Separator.s = " ")
Protected ...
					You should test your Split function with a separator with more than one character and when the first char of the sep matches.
Example: StringToSplit = "ABCxzDEFxyGHI", Separator = "xy"
Fixed version:
Procedure.i Split(Array StringArray.s(1), StringToSplit.s, Separator.s = " ")
Protected ...
- Tue Apr 11, 2017 7:39 pm
 - Forum: Coding Questions
 - Topic: [SOLVED] C UserLib isn't working; as static lib it's works
 - Replies: 5
 - Views: 2103
 
Re: @Fred: C UserLib is not working but as static lib it's w
The problem with your UserLib is the calling convention.
_PB_FloatReturn is __cdecl calling convention
PB_FloatReturn@0 is __stdcall calling convention
I'm using this:
#ifdef _M_IX86
#define FNCALL __stdcall
#pragma message("Compiling for x86")
#else // X64 doesn't have several calling ...
					_PB_FloatReturn is __cdecl calling convention
PB_FloatReturn@0 is __stdcall calling convention
I'm using this:
#ifdef _M_IX86
#define FNCALL __stdcall
#pragma message("Compiling for x86")
#else // X64 doesn't have several calling ...
- Sun Jan 01, 2017 6:05 pm
 - Forum: Coding Questions
 - Topic: Issue with custom systray clock
 - Replies: 14
 - Views: 3508
 
Re: Issue with custom systray clock
This one works on Win7 x64:
EnableExplicit
Define hwnd = FindWindow_("Shell_TrayWnd",#Null)
Define hwnd2 = FindWindowEx_(hwnd,#Null,"TrayNotifyWnd",#Null)
hwnd = FindWindowEx_(hwnd2,#Null,"TrayClockWClass",#Null)
Define Rect.RECT, Rect2.RECT
GetWindowRect_(hwnd, @Rect)
GetWindowRect_(hwnd2, @Rect2 ...
					EnableExplicit
Define hwnd = FindWindow_("Shell_TrayWnd",#Null)
Define hwnd2 = FindWindowEx_(hwnd,#Null,"TrayNotifyWnd",#Null)
hwnd = FindWindowEx_(hwnd2,#Null,"TrayClockWClass",#Null)
Define Rect.RECT, Rect2.RECT
GetWindowRect_(hwnd, @Rect)
GetWindowRect_(hwnd2, @Rect2 ...
- Sun Jan 01, 2017 11:11 am
 - Forum: Feature Requests and Wishlists
 - Topic: ThreadID not working as expected?
 - Replies: 6
 - Views: 4159
 
Re: ThreadID not working as expected?
As the name doesn't suggest, the PB function 'ThreadID(Thread)' returns the thread handle, not the thread ID.
From PureBasic help file:
Return value:
The system identifier. This result is sometimes also known as 'Handle'. Look at the extra chapter Handles and Numbers for more information. https ...
					From PureBasic help file:
Return value:
The system identifier. This result is sometimes also known as 'Handle'. Look at the extra chapter Handles and Numbers for more information. https ...
- Sun Jan 01, 2017 10:07 am
 - Forum: Coding Questions
 - Topic: PB Strings from OBJ/LIB
 - Replies: 2
 - Views: 1536
 
Re: PB Strings from OBJ/LIB
Thank you idle for your suggestion.
Tested with optional parameter and it works.
ASM output is now:
; s1 = StrTest()
PUSH dword [_PB_StringBasePosition]
PUSH dword 0 ; <- Optionnal parameter (always 0)
CALL dword [v_StrTest]
PUSH dword v_s1
CALL _SYS_AllocateString4@8
 
That means that the ...
					Tested with optional parameter and it works.
ASM output is now:
; s1 = StrTest()
PUSH dword [_PB_StringBasePosition]
PUSH dword 0 ; <- Optionnal parameter (always 0)
CALL dword [v_StrTest]
PUSH dword v_s1
CALL _SYS_AllocateString4@8
That means that the ...
- Sat Dec 31, 2016 5:21 pm
 - Forum: Coding Questions
 - Topic: PB Strings from OBJ/LIB
 - Replies: 2
 - Views: 1536
 
PB Strings from OBJ/LIB
Hi to all,
I'm not often here because I think that my use of PureBasic is not very interesting as you will see below.
In most of my projects I use helper functions compiled in an object file (C language).
Sometimes I need to return a PB String from a function but I do not want to write a UserLib ...
					I'm not often here because I think that my use of PureBasic is not very interesting as you will see below.
In most of my projects I use helper functions compiled in an object file (C language).
Sometimes I need to return a PB String from a function but I do not want to write a UserLib ...
- Sat Jun 07, 2014 3:41 pm
 - Forum: Coding Questions
 - Topic: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startup
 - Replies: 29
 - Views: 11726
 
Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu
I don't understand your problem with initial sizing.
This works for me.
OpenWindow(1, 0, 0, 220, 100, "PB 5.30 b2", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible)
ListViewGadget(1, 0, 0, 0, 0) ; <- No position and no size here
HideWindow(1,0) ; <- #PB ...
					This works for me.
OpenWindow(1, 0, 0, 220, 100, "PB 5.30 b2", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_Invisible)
ListViewGadget(1, 0, 0, 0, 0) ; <- No position and no size here
HideWindow(1,0) ; <- #PB ...
- Sat Jun 07, 2014 5:31 am
 - Forum: Coding Questions
 - Topic: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startup
 - Replies: 29
 - Views: 11726
 
Re: [PBv5.30b2] Missing #PB_Event_SizeWindow Event On Startu
Not a problem for me, I always hide the window during initialization.
					Code: Select all
OpenWindow(#MainForm, ..., ..., ..., ..., ..., ...|#PB_Window_Invisible)
; GUI initialization goes here
...
...
HideWindow(#MainForm, 0) ; <- #PB_Event_SizeWindow fired here- Mon Dec 30, 2013 8:26 am
 - Forum: Coding Questions
 - Topic: StringArray memory management
 - Replies: 0
 - Views: 1201
 
StringArray memory management
Hello,
Some functions in my UserLibs (in C) populate a String Array exactly as does 'ExtractRegularExpression'.
I don't use any PB Sting function in this case, it's a TCHAR** mapped to the Address member in the PB_Array structure.
Something like this:
M_PBFUNCTION(integer) PB_TestFunction(PB_Array ...
					Some functions in my UserLibs (in C) populate a String Array exactly as does 'ExtractRegularExpression'.
I don't use any PB Sting function in this case, it's a TCHAR** mapped to the Address member in the PB_Array structure.
Something like this:
M_PBFUNCTION(integer) PB_TestFunction(PB_Array ...
- Tue Dec 24, 2013 11:23 am
 - Forum: Coding Questions
 - Topic: 64 bits PureLibraries
 - Replies: 2
 - Views: 1025
 
Re: 64 bits PureLibraries
Thank you Fred
Joyeux Noël.
					Joyeux Noël.
- Tue Dec 24, 2013 11:03 am
 - Forum: Coding Questions
 - Topic: 64 bits PureLibraries
 - Replies: 2
 - Views: 1025
 
64 bits PureLibraries
Hello,
I want to rebuild my 32 bits visualC PureLibraries for PB x64.
I'm confused with the return data type to use in the ".desc" file.
For example:
in "PureBasic\SDK\VisualC\SampleGadget\ListIconSampleGadget.c":
M_PBFUNCTION(HWND) PB_ListIconSampleGadget returns a 64 bits HANDLE on x64.
in ...
					I want to rebuild my 32 bits visualC PureLibraries for PB x64.
I'm confused with the return data type to use in the ".desc" file.
For example:
in "PureBasic\SDK\VisualC\SampleGadget\ListIconSampleGadget.c":
M_PBFUNCTION(HWND) PB_ListIconSampleGadget returns a 64 bits HANDLE on x64.
in ...
- Mon Sep 02, 2013 7:41 pm
 - Forum: Tricks 'n' Tips
 - Topic: Registry Module (windows only)
 - Replies: 97
 - Views: 69848
 
Re: Registry Module (windows only)
@ts-soft:
Not tested but your XP_DeleteTree can not work, it deletes only one level of subkeys.
My code calls RegDeleteTree recursively.
					Not tested but your XP_DeleteTree can not work, it deletes only one level of subkeys.
My code calls RegDeleteTree recursively.
- Mon Sep 02, 2013 6:15 am
 - Forum: Tricks 'n' Tips
 - Topic: Registry Module (windows only)
 - Replies: 97
 - Views: 69848
 
Re: Registry Module (windows only)
For Windows XP, use this:
Procedure.l RegDeleteTree(hTopKey.i, sSubKey.s)
Protected hKey.i, RetCode.l, dwSize.l, sBuf.s
RetCode = RegOpenKeyEx_(hTopKey, sSubKey, 0, #KEY_ENUMERATE_SUB_KEYS, @hKey)
If RetCode = #ERROR_SUCCESS
sBuf = Space(#MAX_PATH)
Repeat
dwSize = #MAX_PATH
RetCode ...
					Procedure.l RegDeleteTree(hTopKey.i, sSubKey.s)
Protected hKey.i, RetCode.l, dwSize.l, sBuf.s
RetCode = RegOpenKeyEx_(hTopKey, sSubKey, 0, #KEY_ENUMERATE_SUB_KEYS, @hKey)
If RetCode = #ERROR_SUCCESS
sBuf = Space(#MAX_PATH)
Repeat
dwSize = #MAX_PATH
RetCode ...