QB64 Phoenix Edition
C++ types > QB64 types: do we have an equivalent QB64PE page? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: C++ types > QB64 types: do we have an equivalent QB64PE page? (/showthread.php?tid=2758)



C++ types > QB64 types: do we have an equivalent QB64PE page? - madscijr - 05-31-2024

For some API work I'm doing, I found this page useful: 

Do we have an equivalent QB64PE page with this info?


C++ Variable Types

C Name
Description
Size
QB64 Type
Character or small integer.
1 byte
Short Integer(Word)
2 byte
Integer(Dword)
4 byte
Int32, Long integer or Long
4 byte
Long long (Qword)
8 byte
Boolean value true or false.
1 byte
Floating point number
4 byte
Double precision floating.
8 byte
Long double precision float
10 byte
2 or 4
void pointer(void *)
ANY


PS Useful trick for anyone who wants to copy a table with hyperlinks from a Web page to forum post markdown quickly - you can use Excel. A couple small macros and some formulas gets you a nice reusable template. Here's the macro and see the screenshot for how to set up the formulas. Thereafter all you have to do is paste your table into the sheet and voila! the final markdown is calculated in cells M2-M(endrow). Slap that inside
tags and done. (Note: if you need more than 4 columns, insert n columns, copy the formula columns over, and add the new columns to the final row mardown formula.) The ability to paste directly from rich text into the forums editor would eliminate all this nonsense but this beats manually typing in everything. 

Code: (Select All)
' /////////////////////////////////////////////////////////////////////////////
' FROM:

' vba - Extract URL From Excel Hyperlink Formula - Stack Overflow
' https://stackoverflow.com/questions/32230657/extract-url-from-excel-hyperlink-formula

' Excel VBA to extract Hyperlink from Hyperlink Formula - Super User
' https://superuser.com/questions/1313339/excel-vba-to-extract-hyperlink-from-hyperlink-formula

Public Function GetHyperLinkAddress(ByVal Target As Excel.Range) As String
    Dim RoutineName As String:: RoutineName = "GetHyperLinkAddress"
    Dim sFormula As String
    Dim sExpression As String
    Dim iStart As Long
    Dim iPos As Long
    Dim iEnd As Long
    Dim sURL As String
    Dim sSubAddress As String
    Dim sFind As String
   
    'Set Target = ActiveCell
    sURL = ""
    
    On Error Resume Next ' handle errors manually
   
    If Target.Hyperlinks.Count > 0 Then
        sURL = Target.Hyperlinks(1).Address
        sSubAddress = Target.Hyperlinks(1).SubAddress
        If Len(sSubAddress) > 0 Then
            sURL = sURL & "#" & sSubAddress
        End If
    ElseIf Target.HasFormula Then
        sFormula = Target.Formula
        sFind = "HYPERLINK("
        iPos = InStr(1, sFormula, sFind, vbTextCompare)
        If (iPos > 0) Then
            iEnd = InStr(iPos + 1, sFormula, ",", vbTextCompare)
            If (iEnd > 0) Then
                iStart = iPos + Len(sFind)
                sExpression = Mid(sFormula, iStart, iEnd - iStart)
                sURL = Evaluate(sExpression)
            End If
        End If
    End If
   
    If Err.Number <> 0 Then
        Debug.Print CStr(Now) & " " & RoutineName & " failed with error #" & CStr(Err.Number) & ": " & Err.Description
        Err.Clear
        sURL = ""
    End If
    
    On Error Goto 0 ' resume automatic error handling
    
    GetHyperLinkAddress = sURL
End Function ' GetHyperLinkAddress

' /////////////////////////////////////////////////////////////////////////////

Public Function GetURL(ByVal Target As Excel.Range) As String
    Application.Volatile
    GetURL = GetHyperLinkAddress(Target)
End Function ' GetURL

[Image: table-markdown-from-excel.png]


RE: C++ types > QB64 types: do we have an equivalent QB64PE page? - a740g - 05-31-2024

This?

C Libraries - QB64 Phoenix Edition Wiki


RE: C++ types > QB64 types: do we have an equivalent QB64PE page? - madscijr - 05-31-2024

(05-31-2024, 03:47 PM)a740g Wrote: This?

C Libraries - QB64 Phoenix Edition Wiki
Yes - thanks...


RE: C++ types > QB64 types: do we have an equivalent QB64PE page? - grymmjack - 05-31-2024

(05-31-2024, 03:26 PM)madscijr Wrote: For some API work I'm doing, I found this page useful: 


PS Useful trick for anyone who wants to copy a table with hyperlinks from a Web page to forum post markdown quickly - you can use Excel. A couple small macros and some formulas gets you a nice reusable template. Here's the macro and see the screenshot for how to set up the formulas. Thereafter all you have to do is paste your table into the sheet and voila! the final markdown is calculated in cells M2-M(endrow). Slap that inside
tags and done. (Note: if you need more than 4 columns, insert n columns, copy the formula columns over, and add the new columns to the final row mardown formula.) The ability to paste directly from rich text into the forums editor would eliminate all this nonsense but this beats manually typing in everything. 

This is awesome! You should make a video tutorial showing us how to do this Smile

Well done!!!


RE: C++ types > QB64 types: do we have an equivalent QB64PE page? - madscijr - 05-31-2024

(05-31-2024, 05:01 PM)grymmjack Wrote:
(05-31-2024, 03:26 PM)madscijr Wrote: For some API work I'm doing, I found this page useful: 


PS Useful trick for anyone who wants to copy a table with hyperlinks from a Web page to forum post markdown quickly - you can use Excel. A couple small macros and some formulas gets you a nice reusable template. Here's the macro and see the screenshot for how to set up the formulas. Thereafter all you have to do is paste your table into the sheet and voila! the final markdown is calculated in cells M2-M(endrow). Slap that inside
tags and done. (Note: if you need more than 4 columns, insert n columns, copy the formula columns over, and add the new columns to the final row mardown formula.) The ability to paste directly from rich text into the forums editor would eliminate all this nonsense but this beats manually typing in everything. 
This is awesome! You should make a video tutorial showing us how to do this Smile

Well done!!!
Thanks, it feels like such a kludge! 

If we can't find a control to let you paste tables / rich text directly into the forum editor, what I'd really like to do is make a QB64PE utility that reads a rich text table or range of Excel cells directly from the clipboard and auto-generates the markdown. I'm not sure what kind of API or QB64 wizardry we would need to make that work, anybody got any ideas?? 

I'll post an Excel tutorial when I get a chance... not today! LoL


RE: C++ types > QB64 types: do we have an equivalent QB64PE page? - grymmjack - 06-01-2024

I think if you use bbcode...

Code: (Select All)
[table][/table]
[tr][/tr]
[td][/td]

That'd work? Like what @SMcNeill posted, etc.