Linked with external 64-bit Unicode C/C++ Visual Studio DLL

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Josep Roca
Posts: 627
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Josep Roca »

Yes, I did mean fastcall. Sorry for the typo.

I'm not seeing __fastcall being used in the declares.
srvaldez
Posts: 3665
Joined: Sep 25, 2005 21:54

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by srvaldez »

The __fastcall keyword is accepted and ignored by the compilers that target ARM and x64
https://learn.microsoft.com/en-us/cpp/c ... w=msvc-170
fxm
Moderator
Posts: 12591
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by fxm »

"Fastproc" doesn't exist in FreeBASIC, but "Fastcall" does.
See __FASTCALL
Patrice Terrier
Posts: 65
Joined: Jan 06, 2006 8:27
Location: France
Contact:

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Patrice Terrier »

Indeed.

The Microsoft x64 calling convention is the standard and only calling convention used by 64-bit Windows applications compiled with MSVC (Visual Studio). It defines how functions receive parameters and return values, and who is responsible for cleaning the stack.

All 64-bit Windows programs use this convention regardless of __cdecl, __stdcall, or __fastcall in source code.
(Uses Microsoft x64 calling convention for all functions.)
srvaldez
Posts: 3665
Joined: Sep 25, 2005 21:54

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by srvaldez »

Patrice
for you opening post, try the following

Code: Select all

#define UNICODE
#define _WIN32_WINNT &h0602 'not sure that it's needed for this test but it doesn't do harm

#include "WinLIFT.bi"
#inclib "WinLIFT64"

Dim as wstring ptr zSkinFile = Callocate(256)
Dim as wstring ptr zUserKey = Callocate(256)
Dim as wstring ptr zSysButTip = Callocate(256)
Dim hWnd as HWND
Dim as long ok

*zSkinFile="\Winlift\Clock\Clock_02_92.png"
*zUserKey="John Doe"
ok=skInitEngine(zSkinFile, zUserKey)
Print ok
Print "press return to exit"
Sleep
deallocate(zSysButTip)
deallocate(zUserKey)
deallocate(zSysButTip)
you probably need a Unicode BOM on the file
Last edited by srvaldez on Jun 12, 2025 22:12, edited 3 times in total.
srvaldez
Posts: 3665
Joined: Sep 25, 2005 21:54

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by srvaldez »

Patrice, in case you are still interested, here's the header for version 7.01

Code: Select all

#pragma once

#include once "crt/long.bi"
#include once "windows.bi"

extern "C"

const ANCHOR_NONE as const long = -1
const ANCHOR_LEFT as const long = 0
const ANCHOR_WIDTH as const long = 1
const ANCHOR_RIGHT as const long = 2
const ANCHOR_CENTER_HORZ as const long = 3
const ANCHOR_HEIGHT as const long = 4
const ANCHOR_HEIGHT_WIDTH as const long = 5
const ANCHOR_HEIGHT_RIGHT as const long = 6
const ANCHOR_BOTTOM as const long = 7
const ANCHOR_BOTTOM_WIDTH as const long = 8
const ANCHOR_BOTTOM_RIGHT as const long = 9
const ANCHOR_CENTER_HORZ_BOTTOM as const long = 10
const ANCHOR_CENTER_VERT as const long = 11
const ANCHOR_CENTER_VERT_RIGHT as const long = 12
const ANCHOR_CENTER as const long = 13
const ANCHOR_LAST as const long = ANCHOR_CENTER
const SK_METRICFIRST as const long = 0
const SK_CYCAPTION as const long = SK_METRICFIRST
const SK_CYMENU as const long = 1
const SK_CYSTATUS as const long = 2
const SK_CXFRAMELEFT as const long = 3
const SK_CXFRAMERIGHT as const long = 4
const SK_CYFRAMETOP as const long = SK_CYCAPTION
const SK_CYFRAMEBOTTOM as const long = 5
const SK_CXSIZE as const long = 6
const SK_CYSIZE as const long = 7
const SK_CXSYSBUT as const long = 8
const SK_CYSYSBUT as const long = 9
const SK_CXCAPTEXT as const long = 10
const SK_CYCAPTEXT as const long = 11
const SK_XBUT3DBORDER as const long = 12
const SK_YBUT3DBORDER as const long = 13
const SK_CXSYSICON as const long = 14
const SK_CYSYSICON as const long = 15
const SK_CXSYSLED as const long = 16
const SK_CYSYSLED as const long = 17
const SK_TRANSLUCENCY as const long = 18
const SK_MENUTRANSLUCENCY as const long = 19
const SK_PAINT_BORDER as const long = 20
const SK_PAINT_BACKGROUND as const long = 21
const SK_ICONSIZE as const long = 22
const SK_OUTER_GLOW as const long = 23
const SK_SKIN_ICON as const long = 24
const SK_DWM_AERO as const long = 25
const SK_DWM_LEFT as const long = 26
const SK_DWM_TOP as const long = 27
const SK_DWM_RIGHT as const long = 28
const SK_DWM_BOTTOM as const long = 29
const SK_USESYSMENU as const long = 30
const SK_DPI as const long = 31
const SKMETRIC_UB as const long = 32

declare function skPopupOwner(byval hWnd as HWND) as HWND
declare function skCaptionFont() as HFONT
declare function skFont() as HFONT
declare function skFontBold() as HFONT
declare function skFontDlg() as HFONT
declare function skCaptionFontPlus() as LONG_PTR
declare function skFontPlus() as LONG_PTR
declare function skFontBoldPlus() as LONG_PTR
declare function skFontDlgPlus() as LONG_PTR
declare sub skSkinDisable(byval hWnd as HWND)
declare sub skSetZorder(byval hWnd as HWND, byval UseOrder as HWND)
declare function skGetHdcMemBmp(byval hOwner as HWND) as HDC
declare function skARGB(byval A as BYTE, byval R as BYTE, byval G as BYTE, byval B as BYTE) as DWORD
declare sub ComputeAspect(byval xPic as clong, byval yPic as clong, byval xCell as clong, byval yCell as clong, byref xP as clong, byref yP as clong, byref xS as clong, byref yS as clong)
declare sub skChildOffset(byval hWnd as HWND, byref ofX as clong, byref ofY as clong)
declare sub skSetLabelFont(byval hCtrl as HWND, byval zFontName as WCHAR ptr, byval nFontSize as WORD, byval ARGBcolor as clong, byval nFontStyle as WORD, byval redraw as BOOL)
declare function skVersion() as WCHAR ptr
declare function skSetAnchorCtrl(byval hWnd as HWND, byval AnchorMode as clong) as clong
declare function skUsingDWM() as clong
declare function skSkinFolder() as WCHAR ptr
declare function skButImage(byval hOwner as HWND, byval hBitmap as HBITMAP, byval xLeft as clong, byval yLeft as clong, byval ButID as clong) as HWND
declare function skAuthor() as WCHAR ptr
declare function skBorder(byval hWnd as HWND, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval nID as clong, byval nBorder as clong) as HWND
declare sub skSkinChildCtrl(byval hWnd as HWND, byval RedrawFlag as clong)
declare sub skSkinEnable(byval hWnd as HWND)
declare sub skRedrawMenuBar(byval hWnd as HWND)
declare function skGetMenu(byval hWnd as HWND) as HMENU
declare function skMenuContainer(byval hWnd as HWND) as HWND
declare sub skSkinWindowUpdate(byval hWnd as HWND, byval RedrawFlag as clong)
declare function skSkinWindow(byval hWnd as HWND, byval zSysButTip as WCHAR ptr) as clong
declare function skCreateDW(byval hParent as HWND) as HWND
declare sub skDestroyDW(byref hDW as HWND)
declare function skDialogAlert(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogError(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogInfo(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogYesNo(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogInput(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as WCHAR ptr
declare function skButtonImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval ButID as clong, byval StateMax as clong) as HWND
declare function skPushButtonImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval zLabel as WCHAR ptr, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval ButID as clong, byval Alignment as clong) as HWND
declare sub skSetToolTipText(byval hObj as HWND, byval zText as WCHAR ptr)
declare function skGetToolTipText(byval hObj as HWND) as WCHAR ptr
declare function skCreateToolTip(byval hObj as HWND, byval zText as WCHAR ptr) as HWND
declare sub skRemoveToolTip(byval hObj as HWND)
declare function skClockCtrl(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval nID as clong, byval ARGB1 as clong, byval ARGB2 as clong, byval GMT as clong) as HWND
declare function skComputeAngleFromPoint(byval hWnd as HWND, byval mX as clong, byval mY as clong) as clong
declare sub skGaugeSetMinMax(byval hCtrl as HWND, byval nMin as clong, byval nMax as clong)
declare sub skGaugeGetMinMax(byval hCtrl as HWND, byref nMin as clong, byref nMax as clong)
declare sub skGaugeSetPos(byval hCtrl as HWND, byval nPos as clong, byval RedrawFlag as clong)
declare function skGaugeGetPos(byval hCtrl as HWND) as clong
declare function skKnobGauge(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval ButID as clong, byval MinValue as clong, byval MaxValue as clong, byval UsePos as clong, byval StateMax as clong) as HWND
declare function skStaticImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval nID as clong) as HWND
declare function skGetSystemMetrics(byval nMeasure as clong) as clong
declare function skSkiToDib(byval szFile as WCHAR ptr, byref nReserved as clong) as HBITMAP
declare function skTerminateProcess(byval szModule as WCHAR ptr) as clong
declare sub skPaintBrushBitmap(byval hDC as HDC, byval x as clong, byval y as clong, byval nWidth as clong, byval nHeight as clong, byval ARGBcolor as DWORD)
declare function skTrackbar(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval tW as clong, byval tH as clong, byval ButID as clong, byval tMin as clong, byval tMax as clong, byval tVal as clong, byval ARGBcolor as clong) as HWND
declare function skGetTrackValue(byval hWnd as HWND) as clong
declare sub skSetTrackValue(byval hWnd as HWND, byval tVal as clong)
declare sub skSetLabelColor(byval hCtrl as HWND, byval ARGBcolor as clong)
declare function skDoNotSkinPopupMenu(byval nOnOff as clong, byval RW as clong) as clong
declare sub skMaximize(byval hWnd as HWND)
declare sub skRestore(byval hWnd as HWND)
declare sub skRestoreCaption(byval hWnd as HWND, byval nBool as BOOL)
declare sub skSetTrackRange(byval hWnd as HWND, byval tMin as clong, byval tMax as clong)
declare sub skGetTrackRange(byval hWnd as HWND, byref tMin as clong, byref tMax as clong)
declare function skGetSysColor(byval nC as clong) as clong
declare function skLabel(byval hOwner as HWND, byval zFullpathBackground as WCHAR ptr, byval zLabel as WCHAR ptr, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval ButID as clong, byval Alignment as clong) as HWND
declare function skGetLabelFont(byval hCtrl as HWND) as LONG_PTR
declare function skGetSbVertBitmap() as HBITMAP
declare function skGetSbHorzBitmap() as HBITMAP
declare function skGetSbPictoBitmap() as HBITMAP
declare sub skPaintButton(byval hDC as HDC, byval nB as clong, byval hBmp as HBITMAP, byval nX as clong, byval nY as clong, byval xWidth as clong, byval yHeight as clong)
declare sub DrawPicto(byval hDC as HDC, byval nB as clong, byval nX as clong, byval nY as clong, byval xWidth as clong, byval yHeight as clong)
declare sub skSetSystemMetrics(byval nMeasure as clong, byval UseValue as clong)
declare sub skRedrawNcArea(byval hWnd as HWND)
declare function skMinTrackSizeX(byval hWnd as HWND) as clong
declare function skMinTrackSizeY(byval hWnd as HWND) as clong
declare function skInitEngine(byval zSkinFile as WCHAR ptr, byval zUserKey as WCHAR ptr) as clong
declare function skUseThisBackground(byval hWnd as HWND, byval zItem as WCHAR ptr) as clong
declare sub skGetClientSize(byval hWnd as HWND, byref xClient as clong, byref yClient as clong, byref ClientWidth as clong, byref ClientHeight as clong)

const AT_TOP as const long = 1
const AT_LEFT as const long = 2
const AT_RIGHT as const long = 4
const AT_BOTTOM as const long = 8
const AT_TOPLEFT as const long = 3
const AT_TOPRIGHT as const long = 5
const AT_BOTTOMLEFT as const long = 10
const AT_BOTTOMRIGHT as const long = 12
const AT_ALL as const long = 15
const DOCK_TOP as const long = 256
const DOCK_LEFT as const long = 512
const DOCK_RIGHT as const long = 1024
const DOCK_BOTTOM as const long = 2048
const DOCK_FILL as const long = 3840
const CANCELMODE as const long = -1
const ANCHORMODE as const long = 32
const HOMOTHETIC as const long = 64

declare function skAnchorInit(byval hWnd as HWND) as BOOL
declare function skAnchorResize(byval hWnd as HWND, byval bRepaint as BOOL) as BOOL
declare function skAnchorID(byval hWnd as HWND, byval uID as UINT, byval uFlag as UINT) as BOOL
declare function skAnchorRemoveAll(byval hWnd as HWND) as BOOL
declare function skUseAnchorMode(byval hWnd as HWND, byval UseMode as clong) as clong
declare sub skSetListViewImage(byval FullPathName as WCHAR ptr, byval ReadWriteFlag as clong)
declare sub skSetToolBarImage(byval FullPathName as WCHAR ptr, byval ReadWriteFlag as clong)
declare sub skGetWindowSize(byval hWnd as HWND, byref x as clong, byref y as clong, byref WindowWidth as clong, byref WindowHeight as clong)
declare function skSkinChange(byval zSkinFile as WCHAR ptr) as BOOL

const USE_PREV as const UINT = &h00A2
const USE_NEXT as const UINT = &h00A5
declare sub skChangeBackground(byval uMsg as UINT)
declare sub skAbout()
declare function skCaptionTip(byval hOwner as HWND, byval nID as clong, byval sText as WCHAR ptr, byval rc as RECT) as HWND

end extern
Patrice Terrier
Posts: 65
Joined: Jan 06, 2006 8:27
Location: France
Contact:

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Patrice Terrier »

@srvaldez

Thank you so much!

After many tries and errors, I was able to compile this code.

WinLift64.bi

Code: Select all

#pragma once

#if defined( __FB_64BIT__ ) and (not defined( __FB_WIN32__))
	'' On 64bit Linux/BSD systems (but not 64bit Windows), C's long is
	'' 64bit like FB's integer.
	'' Note: Using 64bit Integer here instead of LongInt, to match fbc's
	'' mangling: on 64bit Linux/BSD, Integer is mangled to C's long.
	type clong as integer
	type culong as uinteger
#else
	'' On 32bit systems and 64bit Windows, C's long is 32bit like FB's long.
	'' Note: Using 32bit Long here instead of 32bit/64bit Integer, because
	'' this is also used for 64bit Windows where Integer isn't 32bit.
	type clong as long
	type culong as ulong
#endif

#include once "windows.bi"

extern "C"

const ANCHOR_NONE as const long = -1
const ANCHOR_LEFT as const long = 0
const ANCHOR_WIDTH as const long = 1
const ANCHOR_RIGHT as const long = 2
const ANCHOR_CENTER_HORZ as const long = 3
const ANCHOR_HEIGHT as const long = 4
const ANCHOR_HEIGHT_WIDTH as const long = 5
const ANCHOR_HEIGHT_RIGHT as const long = 6
const ANCHOR_BOTTOM as const long = 7
const ANCHOR_BOTTOM_WIDTH as const long = 8
const ANCHOR_BOTTOM_RIGHT as const long = 9
const ANCHOR_CENTER_HORZ_BOTTOM as const long = 10
const ANCHOR_CENTER_VERT as const long = 11
const ANCHOR_CENTER_VERT_RIGHT as const long = 12
const ANCHOR_CENTER as const long = 13
const ANCHOR_LAST as const long = ANCHOR_CENTER
const SK_METRICFIRST as const long = 0
const SK_CYCAPTION as const long = SK_METRICFIRST
const SK_CYMENU as const long = 1
const SK_CYSTATUS as const long = 2
const SK_CXFRAMELEFT as const long = 3
const SK_CXFRAMERIGHT as const long = 4
const SK_CYFRAMETOP as const long = SK_CYCAPTION
const SK_CYFRAMEBOTTOM as const long = 5
const SK_CXSIZE as const long = 6
const SK_CYSIZE as const long = 7
const SK_CXSYSBUT as const long = 8
const SK_CYSYSBUT as const long = 9
const SK_CXCAPTEXT as const long = 10
const SK_CYCAPTEXT as const long = 11
const SK_XBUT3DBORDER as const long = 12
const SK_YBUT3DBORDER as const long = 13
const SK_CXSYSICON as const long = 14
const SK_CYSYSICON as const long = 15
const SK_CXSYSLED as const long = 16
const SK_CYSYSLED as const long = 17
const SK_TRANSLUCENCY as const long = 18
const SK_MENUTRANSLUCENCY as const long = 19
const SK_PAINT_BORDER as const long = 20
const SK_PAINT_BACKGROUND as const long = 21
const SK_ICONSIZE as const long = 22
const SK_OUTER_GLOW as const long = 23
const SK_SKIN_ICON as const long = 24
const SK_DWM_AERO as const long = 25
const SK_DWM_LEFT as const long = 26
const SK_DWM_TOP as const long = 27
const SK_DWM_RIGHT as const long = 28
const SK_DWM_BOTTOM as const long = 29
const SK_USESYSMENU as const long = 30
const SK_DPI as const long = 31
const SKMETRIC_UB as const long = 32

declare function skPopupOwner(byval hWnd as HWND) as HWND
declare function skCaptionFont() as HFONT
declare function skFont() as HFONT
declare function skFontBold() as HFONT
declare function skFontDlg() as HFONT
declare function skCaptionFontPlus() as LONG_PTR
declare function skFontPlus() as LONG_PTR
declare function skFontBoldPlus() as LONG_PTR
declare function skFontDlgPlus() as LONG_PTR
declare sub skSkinDisable(byval hWnd as HWND)
declare sub skSetZorder(byval hWnd as HWND, byval UseOrder as HWND)
declare function skGetHdcMemBmp(byval hOwner as HWND) as HDC
declare function skARGB(byval A as BYTE, byval R as BYTE, byval G as BYTE, byval B as BYTE) as DWORD
declare sub ComputeAspect(byval xPic as clong, byval yPic as clong, byval xCell as clong, byval yCell as clong, byref xP as clong, byref yP as clong, byref xS as clong, byref yS as clong)
declare sub skChildOffset(byval hWnd as HWND, byref ofX as clong, byref ofY as clong)
declare sub skSetLabelFont(byval hCtrl as HWND, byval zFontName as WCHAR ptr, byval nFontSize as WORD, byval ARGBcolor as clong, byval nFontStyle as WORD, byval redraw as BOOL)
declare function skVersion() as WCHAR ptr
declare function skSetAnchorCtrl(byval hWnd as HWND, byval AnchorMode as clong) as clong
declare function skUsingDWM() as clong
declare function skSkinFolder() as WCHAR ptr
declare function skButImage(byval hOwner as HWND, byval hBitmap as HBITMAP, byval xLeft as clong, byval yLeft as clong, byval ButID as clong) as HWND
declare function skAuthor() as WCHAR ptr
declare function skBorder(byval hWnd as HWND, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval nID as clong, byval nBorder as clong) as HWND
declare sub skSkinChildCtrl(byval hWnd as HWND, byval RedrawFlag as clong)
declare sub skSkinEnable(byval hWnd as HWND)
declare sub skRedrawMenuBar(byval hWnd as HWND)
declare function skGetMenu(byval hWnd as HWND) as HMENU
declare function skMenuContainer(byval hWnd as HWND) as HWND
declare sub skSkinWindowUpdate(byval hWnd as HWND, byval RedrawFlag as clong)
declare function skSkinWindow(byval hWnd as HWND, byval zSysButTip as WCHAR ptr) as clong
declare function skCreateDW(byval hParent as HWND) as HWND
declare sub skDestroyDW(byref hDW as HWND)
declare function skDialogAlert(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogError(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogInfo(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogYesNo(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as clong
declare function skDialogInput(byval zCaption as WCHAR ptr, byval zMessage as WCHAR ptr, byval zButton as WCHAR ptr) as WCHAR ptr
declare function skButtonImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval ButID as clong, byval StateMax as clong) as HWND
declare function skPushButtonImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval zLabel as WCHAR ptr, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval ButID as clong, byval Alignment as clong) as HWND
declare sub skSetToolTipText(byval hObj as HWND, byval zText as WCHAR ptr)
declare function skGetToolTipText(byval hObj as HWND) as WCHAR ptr
declare function skCreateToolTip(byval hObj as HWND, byval zText as WCHAR ptr) as HWND
declare sub skRemoveToolTip(byval hObj as HWND)
declare function skClockCtrl(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval nID as clong, byval ARGB1 as clong, byval ARGB2 as clong, byval GMT as clong) as HWND
declare function skComputeAngleFromPoint(byval hWnd as HWND, byval mX as clong, byval mY as clong) as clong
declare sub skGaugeSetMinMax(byval hCtrl as HWND, byval nMin as clong, byval nMax as clong)
declare sub skGaugeGetMinMax(byval hCtrl as HWND, byref nMin as clong, byref nMax as clong)
declare sub skGaugeSetPos(byval hCtrl as HWND, byval nPos as clong, byval RedrawFlag as clong)
declare function skGaugeGetPos(byval hCtrl as HWND) as clong
declare function skKnobGauge(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval ButID as clong, byval MinValue as clong, byval MaxValue as clong, byval UsePos as clong, byval StateMax as clong) as HWND
declare function skStaticImage(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval w as clong, byval h as clong, byval nID as clong) as HWND
declare function skGetSystemMetrics(byval nMeasure as clong) as clong
declare function skSkiToDib(byval szFile as WCHAR ptr, byref nReserved as clong) as HBITMAP
declare function skTerminateProcess(byval szModule as WCHAR ptr) as clong
declare sub skPaintBrushBitmap(byval hDC as HDC, byval x as clong, byval y as clong, byval nWidth as clong, byval nHeight as clong, byval ARGBcolor as DWORD)
declare function skTrackbar(byval hOwner as HWND, byval zFullpathImageName as WCHAR ptr, byval x as clong, byval y as clong, byval tW as clong, byval tH as clong, byval ButID as clong, byval tMin as clong, byval tMax as clong, byval tVal as clong, byval ARGBcolor as clong) as HWND
declare function skGetTrackValue(byval hWnd as HWND) as clong
declare sub skSetTrackValue(byval hWnd as HWND, byval tVal as clong)
declare sub skSetLabelColor(byval hCtrl as HWND, byval ARGBcolor as clong)
declare function skDoNotSkinPopupMenu(byval nOnOff as clong, byval RW as clong) as clong
declare sub skMaximize(byval hWnd as HWND)
declare sub skRestore(byval hWnd as HWND)
declare sub skRestoreCaption(byval hWnd as HWND, byval nBool as BOOL)
declare sub skSetTrackRange(byval hWnd as HWND, byval tMin as clong, byval tMax as clong)
declare sub skGetTrackRange(byval hWnd as HWND, byref tMin as clong, byref tMax as clong)
declare function skGetSysColor(byval nC as clong) as clong
declare function skLabel(byval hOwner as HWND, byval zFullpathBackground as WCHAR ptr, byval zLabel as WCHAR ptr, byval x as clong, byval y as clong, byval xW as clong, byval yH as clong, byval ButID as clong, byval Alignment as clong) as HWND
declare function skGetLabelFont(byval hCtrl as HWND) as LONG_PTR
declare function skGetSbVertBitmap() as HBITMAP
declare function skGetSbHorzBitmap() as HBITMAP
declare function skGetSbPictoBitmap() as HBITMAP
declare sub skPaintButton(byval hDC as HDC, byval nB as clong, byval hBmp as HBITMAP, byval nX as clong, byval nY as clong, byval xWidth as clong, byval yHeight as clong)
declare sub DrawPicto(byval hDC as HDC, byval nB as clong, byval nX as clong, byval nY as clong, byval xWidth as clong, byval yHeight as clong)
declare sub skSetSystemMetrics(byval nMeasure as clong, byval UseValue as clong)
declare sub skRedrawNcArea(byval hWnd as HWND)
declare function skMinTrackSizeX(byval hWnd as HWND) as clong
declare function skMinTrackSizeY(byval hWnd as HWND) as clong
declare function skInitEngine(byval zSkinFile as WCHAR ptr, byval zUserKey as WCHAR ptr) as clong
declare function skUseThisBackground(byval hWnd as HWND, byval zItem as WCHAR ptr) as clong
declare sub skGetClientSize(byval hWnd as HWND, byref xClient as clong, byref yClient as clong, byref ClientWidth as clong, byref ClientHeight as clong)

const AT_TOP as const long = 1
const AT_LEFT as const long = 2
const AT_RIGHT as const long = 4
const AT_BOTTOM as const long = 8
const AT_TOPLEFT as const long = 3
const AT_TOPRIGHT as const long = 5
const AT_BOTTOMLEFT as const long = 10
const AT_BOTTOMRIGHT as const long = 12
const AT_ALL as const long = 15
const DOCK_TOP as const long = 256
const DOCK_LEFT as const long = 512
const DOCK_RIGHT as const long = 1024
const DOCK_BOTTOM as const long = 2048
const DOCK_FILL as const long = 3840
const CANCELMODE as const long = -1
const ANCHORMODE as const long = 32
const HOMOTHETIC as const long = 64

declare function skAnchorInit(byval hWnd as HWND) as BOOL
declare function skAnchorResize(byval hWnd as HWND, byval bRepaint as BOOL) as BOOL
declare function skAnchorID(byval hWnd as HWND, byval uID as UINT, byval uFlag as UINT) as BOOL
declare function skAnchorRemoveAll(byval hWnd as HWND) as BOOL
declare function skUseAnchorMode(byval hWnd as HWND, byval UseMode as clong) as clong
declare sub skSetListViewImage(byval FullPathName as WCHAR ptr, byval ReadWriteFlag as clong)
declare sub skSetToolBarImage(byval FullPathName as WCHAR ptr, byval ReadWriteFlag as clong)
declare sub skGetWindowSize(byval hWnd as HWND, byref x as clong, byref y as clong, byref WindowWidth as clong, byref WindowHeight as clong)
declare function skSkinChange(byval zSkinFile as WCHAR ptr) as BOOL

const USE_PREV as const UINT = &h00A2
const USE_NEXT as const UINT = &h00A5
declare sub skChangeBackground(byval uMsg as UINT)
declare sub skAbout()
declare function skCaptionTip(byval hOwner as HWND, byval nID as clong, byval sText as WCHAR ptr, byval rc as RECT) as HWND

end extern
Mini.bas window template

Code: Select all

'Mini.bas window template
'skinned with WinLIFT64 version 7.01
'06-13-2025 

#Include "WinLIFT64.bi"
#inclib "WinLIFT64"

Const CLIENT_WIDTH  = 640
Const CLIENT_HEIGHT = 480

Type PROP
    hMain As HWND
    minTrackSizeW As Long
    minTrackSizeH As Long
End Type

Dim Shared gP As PROP

Function rWidth(ByRef r As RECT) As Long
    Return r.right - r.left
End Function

Function rHeight(ByRef r As RECT) As Long
    Return r.bottom - r.top
End Function

Function WndProc(ByVal hWnd As HWND, ByVal uMsg As UINT, ByVal wParam As WPARAM, ByVal lParam As LPARAM) As LRESULT
    Dim nRet As LRESULT = -1
    Dim pMM As MINMAXINFO Ptr
   
    Select Case uMsg
    Case WM_CREATE
        ' Initialization can go here if needed.

    Case WM_GETMINMAXINFO
        pMM = Cast(MINMAXINFO Ptr, lParam)
        pMM->ptMinTrackSize.x = gP.minTrackSizeW
        pMM->ptMinTrackSize.y = gP.minTrackSizeH

    Case WM_SIZE
        InvalidateRect(hWnd, NULL, TRUE)
        nRet = 0

    Case WM_PAINT
        Dim ps As PAINTSTRUCT
        Dim hDC As HDC = BeginPaint(hWnd, @ps)
        ' Paint window content here
        EndPaint(hWnd, @ps)
        nRet = 0

    Case WM_DESTROY
        PostQuitMessage(0)
        nRet = 0
    End Select

    If nRet = -1 Then nRet = DefWindowProc(hWnd, uMsg, wParam, lParam)
    Return nRet
End Function

Function WinMain(ByVal hInstance As HINSTANCE, ByVal hPrevInstance As HINSTANCE, ByVal lpCmdLine As WString Ptr, ByVal nCmdShow As Integer) As Integer
    Dim nRet As Integer = 0
    Dim szClass As ZString * 10 = "MINI"

    ' Detect process without using a Mutex
    Dim hFound As HWND = FindWindow(szClass, NULL)
    If hFound <> NULL Then
        If IsIconic(hFound) Then ShowWindow(hFound, SW_RESTORE)
        SetForegroundWindow(hFound)
        Return nRet
    End If

    Dim wcx As WNDCLASSEX
    wcx.cbSize = Len(wcx)
    Dim IsInitialized As Long = GetClassInfoEx(hInstance, szClass, @wcx)

    If IsInitialized = 0 Then
        wcx.style         = CS_HREDRAW Or CS_VREDRAW
        wcx.lpfnWndProc   = @WndProc
        wcx.cbClsExtra    = 0
        wcx.cbWndExtra    = 0
        wcx.hInstance     = hInstance
        wcx.hIcon         = LoadIcon(NULL, IDI_APPLICATION)
        wcx.hCursor       = LoadCursor(NULL, IDC_ARROW)
        wcx.hbrBackground = Cast(HBRUSH, COLOR_BTNFACE + 1) ' Fix: Windows expects a valid brush
        wcx.lpszMenuName  = NULL
        wcx.lpszClassName = @szClass
        wcx.hIconSm       = wcx.hIcon
       
        If RegisterClassEx(@wcx) <> 0 Then IsInitialized = -1
    End If

    If IsInitialized Then
        Dim dwExStyle As DWORD = 0
        Dim dwStyle As DWORD = WS_OVERLAPPEDWINDOW Or WS_CLIPSIBLINGS Or WS_CLIPCHILDREN
        Dim lpr As RECT
        SetRect(@lpr, 0, 0, CLIENT_WIDTH, CLIENT_HEIGHT)
        AdjustWindowRectEx(@lpr, dwStyle, FALSE, dwExStyle)

        gP.minTrackSizeW = rWidth(lpr)
        gP.minTrackSizeH = rHeight(lpr)

        Dim x As Long = Max((GetSystemMetrics(SM_CXSCREEN) - gP.minTrackSizeW) \ 2, 0)
        Dim y As Long = Max((GetSystemMetrics(SM_CYSCREEN) - gP.minTrackSizeH) \ 2, 0)

        gP.hMain = CreateWindowEx(dwExStyle, szClass, szClass, dwStyle, x, y, gP.minTrackSizeW, gP.minTrackSizeH, NULL, NULL, hInstance, NULL)

        If gP.hMain <> NULL Then

            Dim zSkinFile   As WString * 260 => "Sony.sks"
            Dim zUserKey    As WString * 260 => ""
            Dim zSysButTip  As WString * 260 => "  Dock  |  Undock  |  Minimize  |  Maximize  |  Restore  |  Close  "


            If skInitEngine(@zSkinFile, @zUserKey) Then
                If skSkinWindow(gP.hMain, @zSysButTip) Then
                    ShowWindow(gP.hMain, nCmdShow)
                    SetForegroundWindow(gP.hMain) ' Slightly Higher Priority

                    Dim msg As MSG
                    While GetMessage(@msg, NULL, 0, 0)
                        TranslateMessage(@msg)
                        DispatchMessage(@msg)
                    Wend
                    nRet = msg.wParam
                End If
            End If

        End If

        UnregisterClassW(szClass, hInstance)
    End If

    Return nRet
End Function

End WinMain(GetModuleHandle(NULL), NULL, NULL, SW_SHOWDEFAULT)
Now, I have to figure how to post an attachment on this forum?

Other way try this
http://www.objreader.com/download/demo/FB_Mini.7z
Last edited by Patrice Terrier on Jun 13, 2025 11:36, edited 1 time in total.
Josep Roca
Posts: 627
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Josep Roca »

> Now, I have to figure how to post an attachment on this forum?

You can't. You have to store it in another place and provide a link to it.
Patrice Terrier
Posts: 65
Joined: Jan 06, 2006 8:27
Location: France
Contact:

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Patrice Terrier »

http://www.objreader.com/download/demo/FB_Mini.7z

For an unknown reason I can't get the tooltips to work.
srvaldez
Posts: 3665
Joined: Sep 25, 2005 21:54

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by srvaldez »

congratulations Patrice :D
here's what it looks like
Image
Patrice Terrier
Posts: 65
Joined: Jan 06, 2006 8:27
Location: France
Contact:

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Patrice Terrier »

Does there is anything in FB that could add tooltip support like this VS C\C++ directive

Code: Select all

// Enable tooltip
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
To see the tooltips on the system buttons, just use an empty string in zSysButTip, then WinLIFT shall use its own set.
Dim zSysButTip As WString * 260 => "" ' Dock | Undock | Minimize | Maximize | Restore | Close "
srvaldez
Posts: 3665
Joined: Sep 25, 2005 21:54

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by srvaldez »

don't know if this will help viewtopic.php?t=32769
Patrice Terrier
Posts: 65
Joined: Jan 06, 2006 8:27
Location: France
Contact:

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Patrice Terrier »

Here is the manifest that could be used to enable tooltip support on system buttons.

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"/>
    </dependentAssembly>
  </dependency>
</assembly>
Save it as mini.exe.manifest asside the binary.

Perhaps, it could be embedded as a reource, but I don't know how to create one in FB.
dodicat
Posts: 8294
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by dodicat »

Here is how I include tooltips.
Without using main and winproc e.t.c. (Works then of course also), I just use a simple gl window with buttons to demonstrate.

Code: Select all

 
#include "windows.bi"
#Include once "/win/commctrl.bi"
#include "fbgfx.bi"
Screencontrol fb.SET_GL_2D_MODE ,fb.OGL_2D_MANUAL_SYNC
Screencontrol fb.SET_GL_SCALE ,1


Function CreateToolTip(X As hwnd,msg As String="") As hwnd
    Dim As hwnd  TT= CreateWindowEx(0,"ToolTips_Class32","",64,0,0,0,0,X,0,GetModuleHandle(0),0)
    SendMessage(TT, TTM_SETMAXTIPWIDTH, 0 , 280)
    SendMessage(TT, TTM_SETDELAYTIME, TTDT_INITIAL ,40)
    SendMessage(TT, TTM_SETDELAYTIME, TTDT_RESHOW  ,60)
    Dim bubble As TOOLINFO
    bubble.cbSize = Len(TOOLINFO)
    bubble.uFlags = TTF_IDISHWND Or TTF_SUBCLASS
    bubble.uId = Cast(Uinteger,X)
    bubble.lpszText = Strptr(msg)
    SendMessage(TT, TTM_ADDTOOL, 0,Cast(LPARAM,@bubble))
    Return TT
End Function

#include "GL/gl.bi"
Sub setupgl 
    Dim As Integer xres,yres
    Screeninfo xres,yres
    glDisable (GL_DEPTH_TEST)
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
    glEnable (GL_BLEND)
    glEnable (GL_LINE_SMOOTH)
    glOrtho 0, xres, yres,0,-1, 1
End Sub

Screen 19,32,,2
Color ,Rgb(0,100,255)
Cls
setupgl
Dim Win As Any Ptr
Screencontrol fb.GET_WINDOW_HANDLE , *Cptr(Integer Ptr,@Win )

Var btn=CreateWindowEx(0,"button","Click to end", WS_VISIBLE Or WS_CHILD,0,0,90,70,win,0,0,0)
Var spare=CreateWindowEx(0,"button","Spare", WS_VISIBLE Or WS_CHILD,90,0,90,70,win,0,0,0)
createtooltip(win,"Hello main window")
createtooltip(btn,"Hello button child window")
createtooltip(spare,"Hello spare child window")

Dim As msg msg
While true
    While (PeekMessage (@Msg, NULL, 0, 0, PM_REMOVE) > 0)
        TranslateMessage (@Msg)
        DispatchMessage (@Msg)
        Select Case msg.hwnd
        Case btn 
            Select Case msg.message
            Case WM_LBUTTONDOWN
                glClear(GL_COLOR_BUFFER_BIT)
                Locate 8,8
                Print "Bye . . ."
                Flip
                Exit While,While
            End Select
            
        Case spare 
            Select Case msg.message
            Case WM_LBUTTONDOWN
                Locate 7,7
                Print "nothing much happens"
            End Select
        End Select
        
        If Inkey=Chr(255)+"k" Then End
    Wend
    glClear(GL_COLOR_BUFFER_BIT)
    Locate 6,7
    Print "Hello"
    Flip
    Sleep 5
Wend


Sleep 1000 
.. sorry I don't have the unicode library!
Löwenherz
Posts: 292
Joined: Aug 27, 2008 6:26
Location: Bad Sooden-Allendorf, Germany

Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL

Post by Löwenherz »

Hello Patrice I would Like to Test WinLift64.bi for freebasic but the link doesn't Work for downloading fb_mini.zip
Re: Linked with external 64-bit Unicode C/C++ Visual Studio DLL
Post Jun 13, 2025 11:38

http://www.objreader.com/download/demo/FB_Mini.7z

For an unknown reason I can't get the tooltips to work.
Post Reply