Data Statement Support for GUID's and CLSID's
Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Data Statement Support for GUID's and CLSID's
Please add a new Data statement type so thatcan be shortened to:and/or to:
Code: Select all
DataSection
Data.l 332ドルC4425
Data.w 26ドルCB,11ドルD0
Data.b $B4,83,ドル00,ドル$C0,4ドルF,$D9,01,ドル19ドル
EndDataSectionCode: Select all
DataSection
Data.g {332C4425-26CB-11D0-B483-00C04FD90119}
EndDataSectionCode: Select all
DataSection
Data.g 332C4425-26CB-11D0-B483-00C04FD90119
EndDataSectionAnthony Jordan
Actually a "virtual" function to do that would be much better as you could then use it sort of directly when using API calls as well.
Like: SomeApiCallHere_(GUID("{332C4425-26CB-11D0-B483-00C04FD90119}"))
GUID() basically turns the string into 16byte binary and returns a pointer.
Or something similar to that.
Or even a
#SomeGUID=GUID("{332C4425-26CB-11D0-B483-00C04FD90119}")
So you could do:
SomeApiCallHere_(#SomeGUID) ;basically a pointer to the 16byte data.
Or even maybe:
Define someguid.guid
someguid=GUID("{332C4425-26CB-11D0-B483-00C04FD90119}")
So you could do:
SomeApiCallHere_(someguid) ;basically someguid would be a pointer in this case I guess.
Question is, how common is GUID's on Linux or Mac?
And if it's only used on Windows is it worth the effort adding it?
http://en.wikipedia.org/wiki/Globally_U ... [quote]The term GUID usually refers to Microsoft's implementation of the Universally Unique Identifier (UUID) standard; however, many other pieces of software use the term GUID including Oracle Database, dBase and Novell eDirectory. The GUID is also the basis of the GUID Partition Table, Intel's replacement for Master Boot Records under EFI.[/quote]
Edit: more info
http://en.wikipedia.org/wiki/Universall ... Identifier
So maybe some UUID support is warranted?
Like: SomeApiCallHere_(GUID("{332C4425-26CB-11D0-B483-00C04FD90119}"))
GUID() basically turns the string into 16byte binary and returns a pointer.
Or something similar to that.
Or even a
#SomeGUID=GUID("{332C4425-26CB-11D0-B483-00C04FD90119}")
So you could do:
SomeApiCallHere_(#SomeGUID) ;basically a pointer to the 16byte data.
Or even maybe:
Define someguid.guid
someguid=GUID("{332C4425-26CB-11D0-B483-00C04FD90119}")
So you could do:
SomeApiCallHere_(someguid) ;basically someguid would be a pointer in this case I guess.
Question is, how common is GUID's on Linux or Mac?
And if it's only used on Windows is it worth the effort adding it?
http://en.wikipedia.org/wiki/Globally_U ... [quote]The term GUID usually refers to Microsoft's implementation of the Universally Unique Identifier (UUID) standard; however, many other pieces of software use the term GUID including Oracle Database, dBase and Novell eDirectory. The GUID is also the basis of the GUID Partition Table, Intel's replacement for Master Boot Records under EFI.[/quote]
Edit: more info
http://en.wikipedia.org/wiki/Universall ... Identifier
Even Atom and some RSS feeds use them.A Universally Unique Identifier is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE).
So maybe some UUID support is warranted?
Re: Data Statement Support for GUID's and CLSID's
You could use a macro:akj wrote:Please add a new Data statement type so thatcan be shortened to...[/code]Code: Select all
DataSection Data.l 332ドルC4425 Data.w 26ドルCB,11ドルD0 Data.b $B4,83,ドル00,ドル$C0,4ドルF,$D9,01,ドル19ドル EndDataSection
Code: Select all
Macro GUID(__name, __l, __w1, __w2, __b1, __b2, __b3, __b4, __b5, __b6, __b7, __b8)
DataSection
__name:
Data.l $__l
Data.w $__w1, $__w2
Data.b $__b1, $__b2, $__b3, $__b4, $__b5, $__b6, $__b7, $__b8
EndDataSection
EndMacro
GUID(CLSID_Test,332C4425,26CB,11D0,B4,83,00,C0,4F,D9,01,19)
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
PB Last Final / Last Beta Testing
Re: Data Statement Support for GUID's and CLSID's
> You could use a macro
True, but I'm guessing akj wants to be able to copy-and-paste the GUID
into his code, because they're such a hassle to type manually, and a macro
doesn't help because it still requires manual typing of each component.
Alternatively, akj could write an add-in tool that takes the GUID and puts
it into 3 data statements automatically for him, and then auto-types it into
the editor, or puts it in the clipboard. ;)
[Edit] Had the wrong user name in my post.
True, but I'm guessing akj wants to be able to copy-and-paste the GUID
into his code, because they're such a hassle to type manually, and a macro
doesn't help because it still requires manual typing of each component.
Alternatively, akj could write an add-in tool that takes the GUID and puts
it into 3 data statements automatically for him, and then auto-types it into
the editor, or puts it in the clipboard. ;)
[Edit] Had the wrong user name in my post.
Last edited by PB on Tue Aug 07, 2007 11:52 am, edited 1 time in total.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- ts-soft
- Always Here
Always Here - Posts: 5756
- Joined: Thu Jun 24, 2004 2:44 pm
- Location: Berlin - Germany
Many of guid, clsid, iid can you simple import:
Code: Select all
Import "uuid.lib"
CLSID_TaskbarList
IID_ITaskbarList
EndImport
Procedure HideFromTaskBar(hWnd.l, Flag.l)
Protected TBL.ITaskbarList
CoInitialize_(0)
If CoCreateInstance_(@CLSID_TaskBarList, 0, 1, @IID_ITaskBarList, @TBL) = #S_OK
TBL\HrInit()
If Flag
TBL\DeleteTab(hWnd)
Else
TBL\AddTab(hWnd)
EndIf
TBL\Release()
EndIf
CoUninitialize_()
EndProcedure
; DataSection
; CLSID_TaskBarList:
; Data.l 56ドルFDF344
; Data.w $FD6D, 11ドルD0
; Data.b 95,ドル 8ドルA, 00,ドル 60,ドル 97,ドル $C9, $A0, 90ドル
; IID_ITaskBarList:
; Data.l 56ドルFDF342
; Data.w $FD6D, 11ドルD0
; Data.b 95,ドル 8ドルA, 00,ドル 60,ドル 97,ドル $C9, $A0, 90ドル
; EndDataSection
If OpenWindow(0, #PB_Ignore, #PB_Ignore, 640, 480, "test")
HideFromTaskBar(WindowID(0), #True)
While WaitWindowEvent() <> 16 : Wend
EndIf
Last edited by ts-soft on Tue Aug 07, 2007 9:11 am, edited 1 time in total.
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.
Image
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
whaoo that's great tip. i didn't know that. thanks you ts-soft.ts-soft wrote:Many of guid, clsid, iid can you simple import:Code: Select all
Import "uuid.lib" CLSID_TaskbarList IID_ITaskbarList EndImport
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
- ts-soft
- Always Here
Always Here - Posts: 5756
- Joined: Thu Jun 24, 2004 2:44 pm
- Location: Berlin - Germany
Here an importfile with over 3000 imports of CLSID, GUID and IID
It's autogenerated but should work
http://ts-soft.eu/dl/GUID_CLID_IID_Import.zip
It's autogenerated but should work
http://ts-soft.eu/dl/GUID_CLID_IID_Import.zip
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.
Image
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
I would not include the whole list all the time, as then all the imported GUIDs will
get linked even if not used in the code. (just check the exe size,
its about 50k larger with the full list compared to a single import)
A nice little macro can be helpful here:
With the compilerif, even multiple use with the same name is no error.
To further the number of possibilities, here are two ways from me to define
such values (in case one is not contained in the above list):
There is my GUIDViewer tool that exist since a while that has all the GUIDs from
the MS headers and generates the PB datasections:
http://freak.purearea.net/tools/GuidViewer.zip
My prefered way however is included in my COM Framework (here: http://freak.purearea.net/tools/ComFramework.zip)
It includes a resident called "GuidList.res", which contains a macro to
automatically define the GUIDs from the GUIDViewer tool.
There you can just do this and it automatically inserts the needed datasection:
So... do you still think a spechial compiler feature is needed for this ? ;)
get linked even if not used in the code. (just check the exe size,
its about 50k larger with the full list compared to a single import)
A nice little macro can be helpful here:
Code: Select all
Macro ImportGUID(name)
CompilerIf Defined(name, #PB_Variable) = 0
Import "uuid.lib"
name
EndImport
CompilerEndIf
EndMacro
ImportGUID(IID_IXMLElementCollection)
x = @IID_IXMLElementCollectionTo further the number of possibilities, here are two ways from me to define
such values (in case one is not contained in the above list):
There is my GUIDViewer tool that exist since a while that has all the GUIDs from
the MS headers and generates the PB datasections:
http://freak.purearea.net/tools/GuidViewer.zip
My prefered way however is included in my COM Framework (here: http://freak.purearea.net/tools/ComFramework.zip)
It includes a resident called "GuidList.res", which contains a macro to
automatically define the GUIDs from the GUIDViewer tool.
There you can just do this and it automatically inserts the needed datasection:
Code: Select all
DefineKnownGuid(IID_IXMLElementCollection)
x = ?IID_IXMLElementCollectionquidquid Latine dictum sit altum videtur
- ts-soft
- Always Here
Always Here - Posts: 5756
- Joined: Thu Jun 24, 2004 2:44 pm
- Location: Berlin - Germany
very nice macro, thanks
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.
Image
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Return to "Feature Requests and Wishlists"
Jump to
- PureBasic
- ↳ Coding Questions
- ↳ Game Programming
- ↳ 3D Programming
- ↳ Assembly and C Programming in PureBasic
- ↳ The PureBasic Editor
- ↳ The PureBasic Form Designer
- ↳ General Discussion
- ↳ Feature Requests and Wishlists
- ↳ Tricks 'n' Tips
- Bug Reports
- ↳ Bugs - Windows
- ↳ Bugs - Linux
- ↳ Bugs - Mac OSX
- ↳ Bugs - C backend
- ↳ Bugs - 3D Engine
- ↳ Bugs - IDE
- ↳ Bugs - Documentation
- OS Specific
- ↳ AmigaOS
- ↳ Linux
- ↳ Windows
- ↳ Mac OSX
- ↳ Raspberry PI
- Miscellaneous
- ↳ Announcement
- ↳ Off Topic
- Showcase
- ↳ Applications - Feedback and Discussion
- ↳ PureFORM & JaPBe
- ↳ TailBite