Page 1 of 1

Is George Jopling here?

Posted: Tue May 27, 2014 12:06 pm
by PB
Was doing a web search for a caps lock util and found this site:

http://www.georgejopling.co.uk/capslock/capslock.html

He says the apps are written in PureBasic! A pleasant surprise.
So George, if you're here: say hi to us! Good to see PureBasic
promoted on your website.

Re: Is George Jopling here?

Posted: Tue May 27, 2014 11:46 pm
by Neil
PB wrote:Was doing a web search for a caps lock util and found this site:

http://www.georgejopling.co.uk/capslock/capslock.html

He says the apps are written in PureBasic!
Hi PB,

I downloaded the source code and tried to compile it. Note latest version stated in file is PB 4.20

I get an error "Structure KBDLLHOOKSTRUCT already declared in a resident file" from this code:

Code: Select all

Structure KBDLLHOOKSTRUCT 
  vkCode.l 
  scanCode.l 
  flags.l 
  time.l 
  dwExtraInfo.l 
EndStructure 
Also, has the required format for Data definitions changed ?

original:

Code: Select all

DataSection
  Beep:   IncludeBinary "beep.wav"
  redcross:   IncludeBinary "redcross.ico"
  greentick:  IncludeBinary "greentick.ico"
EndDataSection 
required:

Code: Select all

DataSection
  Beep: 
  IncludeBinary "beep.wav"
  redcross: 
  IncludeBinary "redcross.ico"
  greentick:
  IncludeBinary "greentick.ico"
EndDataSection 
Cheers,

Neil

Re: Is George Jopling here?

Posted: Wed May 28, 2014 12:09 am
by luis
Neil wrote: Also, has the required format for Data definitions changed ?
No, but labels must be followed by a ":" like any other statement when on a line with multiple statements, it was a bug before.

The change originated from here -> http://www.purebasic.fr/english/viewtop ... 28&t=55874

Re: Is George Jopling here?

Posted: Wed May 28, 2014 12:48 am
by Neil
luis wrote:
Neil wrote: Also, has the required format for Data definitions changed ?
No, but labels must be followed by a ":" like any other statement when on a line with multiple statements, it was a bug before.

The change originated from here -> http://www.purebasic.fr/english/viewtop ... 28&t=55874
Hi Luis,

Thanks for info.

Any thoughts on the "Structure defined" bug ??

Cheers,

Neil

Re: Is George Jopling here?

Posted: Wed May 28, 2014 1:03 am
by Tenaja
Neil wrote:
Any thoughts on the "Structure defined" bug ??

Cheers,

Neil
As the error message indicates, it is defined elsewhere. Comment it out, and the code works after you add another colon to the labels.

Re: Is George Jopling here?

Posted: Wed May 28, 2014 1:07 am
by luis
It's not a bug: it just means the structure is now predefined in the residents.
Open Tools -> Structure Viewer and look for "KBDLLHOOKSTRUCT".
You can just comment out the declaration in the source and it should work.

Re: Is George Jopling here?

Posted: Wed May 28, 2014 2:31 am
by Neil
Hi Luis,
luis wrote:It's not a bug: it just means the structure is now predefined in the residents..
Yes sorry - I shouldn't have referred to it as a "bug" - which would imply an error in PB.
Anyway, what are the "residents" ??
luis wrote:Open Tools -> Structure Viewer and look for "KBDLLHOOKSTRUCT".
Yes - the structure shown in the viewer is the same as in the code.
So why would he have included this definition in the code ??
luis wrote:You can just comment out the declaration in the source and it should work.
Yes I had done this and program compiled ok.
The "key count" sound does not sound and I was wondering if this was the cause.

Thanks,

Neil

Re: Is George Jopling here?

Posted: Wed May 28, 2014 11:04 am
by luis
Neil wrote: Anyway, what are the "residents" ??
It's explained in the manual, now: http://www.purebasic.fr/english/viewtop ... 77#p369177
Thanks for the addition, BTW :wink:

And here it is what the manual says:
HELP wrote: Residents are precompiled files which are loaded when the compiler starts. They can be found in the 'residents' folder of the PureBasic installation path. A resident file must have the extension '.res' and can contain the following items: structures, interfaces, macros and constants. It can not contain dynamic code or procedures.

When a resident is loaded, all its content is available for the program being compiled. That's why all built-in constants like #PB_Event_CloseWindow are available, they are in the 'PureBasic.res' file. All the API structures and constants are also in a resident file. Using residents is a good way to store the common macros, structure and constants so they will be available for every programs. When distributing an user library, it's also a nice solution to provide the needed constants and structures, as PureBasic does.

To create a new resident, the command-line compiler needs to be used, as there is no option to do it from the IDE. It is often needed to use /IGNORERESIDENT and /CREATERESIDENT at the same time to avoid duplicate errors, as the previous version of the resident is loaded before creating the new one.

Residents greatly help to have a faster compilation and compiler start, as all the information is stored in binary format. It is much faster to load than parsing an include file at every compilation
Neil wrote: So why would he have included this definition in the code ??
Evidently at the time the structure was not yet been added in the residents and he had to declare it by himself.

Re: Is George Jopling here?

Posted: Wed May 28, 2014 10:27 pm
by Neil
Hi Luis,

Thanks again for detailed response - much appreciated.

I always learn something new from PB forum posts.

Cheers,

Neil