Search found 28 matches

by GJ-68
Sun Jun 25, 2017 6:51 pm
Forum: Tricks 'n' Tips
Topic: [PB4] Split() and Join() commands
Replies: 16
Views: 13853

Re: [PB4] Split() and Join() commands

@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.
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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 ...
by GJ-68
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
by GJ-68
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 ...
by GJ-68
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.
by GJ-68
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 ...
by GJ-68
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.
by GJ-68
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 ...