• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

My first steps with C++

Started by Patrice Terrier, July 30, 2010, 10:01:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jürgen Huhn

#15
It`s good to know this:

From Microsoft to Development of Visual C++:

-----------------------------------------------------------------------
long long n = 9223372036854775807LL; // Works fine.
printf("n: %lld\n", n);             // Output n:
// 9223372036854775807

// (correct)
   printf("n: %+lld\n", n);     // Output n:
// (wrong)
    printf("n: %5lld\n", n);  // Output wrong

------------------------------------------------------------------------
Thanks for the report. We need more information to process this bug

- what compiler options and CPU are you compiling for
- what was the actual output you saw from this program
- what output did you expect to see?

Please reactivate this bug with the extra information.

Thanks,

Martyn Lovell
Development Lead
Visual C++ Libraries

Most of the articles describe how to do it in Visual Basic, but I think it`s
near to finding how to do it accurate in Visual C++.
,,,
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

#16
Quote
QuoteGuess that the C++ package will include a utility to make an import .lib file from the .dll.

I wrote about it also in  OpenGl thread..

The question was,

is it allowed to translate OpenGl.dll to PowerBasic?
Most of other Compiler inluding yet Tools for translation. (as as is) 1 to 1..
...
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Jürgen Huhn

Good moorning to all!

I have tried the imnport procedures of Visual C++ 2010.
And the locations of Menu `s are on other Positions in Visual C++ 2010 and even enhanced for importing a DLL.
The procedures in my older licenced  Microsoft Visual C++ 6.0, are working on the main principle  equal as in Visual C++ 2010, but i didn`t used  until tofay the .dll import in Visual C++ 2010

I also want to explain my confusion about questions i had yesterday, it could be consisting additional knowlege:

Question from Patrice was;

QuoteJürgen,

Indeed my question was:

Quote
how to create the C++ header file for my GDImage.inc

Here is an example of what i would like to turn into a C++ header:


... example ..
 

Here is an example of explicit DLL linking, using LoadLibrary and GetProcAdress to call my zTrace utility.


... example ...



Until Jose`s Statements about the Tools to create the translation for the import procedure,


i really was in the good faith that you well know how to implicitly linking a DLL in C++ with the import Tools there
and you needed the syntax to create your import Library manually, not with the linker Tool.)

Because of your examples after your Question and the Fact that i know you as a very good Programmer with a large professional Knowlege.

----------------------------------------------------------------------------------------

I know how i could do it using "LoadDll" and "LoadLibrary" (explicit linking)              ' <-- many times i read in your Codes how you performt "LoadLibrary" in PB.
but i don't know the syntax to use to make implicit linking like in PowerBASIC.            ' <-- My brain was cooking about how to do that with your GDI_Image.dll
                                                                                       

Of course Patrice and i know this very well.. Instead of understanding your Question i wonder!!Also about your first steps..
------------------------------------------------------------------------------------

implicit linking like in PowerBASIC says to me "manually translation without any Tool to get a translation for an import to PB". 


I was wondwering and i don`t know any about the Routines that you wanted to import from your .dll ( for mwe apparently to follow the manualy Way on your examples..)

For sure that is also possible, even to have other Situations , or that we must link part`s of .dll Code manually that`s depending on the used Data Types used
on import functions that use calling conventions other than in C/C++.

I`m glad that we have Jose who filled once again at the right Point of Disscussion the Gap with the right Statement.

Also thank`s to all other`s for they given Statement`s to find that what was needeed.

Nwxt i`ll try to to play around with Bcx3264.

My intension was to help and i`ve learned a lot on this Disscussion.

...    :)

.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

#18
Here is another question.

What is the best (and most concise) way to translate this small piece of PB's code to C++:
QuoteMixedString$ = "Window handle =" + STR$(hWnd&)

:)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

Quote from: Patrice Terrier on July 31, 2010, 09:50:56 AM
Here is another question.

What is the best (and most concise) way to translate this small piece of PB's code to C++:
QuoteMixedString$ = "Window handle =" + STR$(hWnd&)

:)

Patrice,
  I am a real c++ novice but I am in education mode now and was looking for something similar.
I am primarily using wxWidgets which has it's own string handling but it's similar to the STL std::string
This is what I came up with. I am sure there is better....
Here is a reference to std::strings : http://www.cplusplus.com/reference/string/string/
James


#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>
#include <stdexcept>

class BadConversion : public std::runtime_error {
public:
   BadConversion(std::string const& s)
     : std::runtime_error(s)
     { }
};

template<typename T>
inline std::string stringify(T const& x)
{
   std::ostringstream o;
   if (!(o << x))
     throw BadConversion(std::string("stringify(")
                         + typeid(x).name() + ")");
   return o.str();
}


int main (int argc, char** argv)
{
   std::string  S1;
   std::string  S2;
   long     hwnd;
  hwnd=12345;
  S1 = "Window Handle = ";
  S1+= stringify(hwnd);
  std::cout << S1 << std::endl;
  return 0;
}



James C. Fuller

#20
Patrice,
 As a follow up this is the Bcx code I used to obtain the previous.
Here I used the $SOURCE directive which includes the commented Bcx code in
the cpp source.(it seems to have a problem with double colons)
Also note the $CCODE This allows c/c++ "as is" in your source;so if I fine a piece of code I want to use, no translating it first.
James

Bcx Code:


$NOMAIN
$ONEXIT "GCTD.BAT $FILE$ -m32"
$CPP
$CCODE
// File: convert.h
#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>
#include <stdexcept>

class BadConversion : public std::runtime_error {
public:
  BadConversion(std::string const& s)
    : std::runtime_error(s)
    { }
};

template<typename T>
inline std::string stringify(T const& x)
{
  std::ostringstream o;
  if (!(o << x))
    throw BadConversion(std::string("stringify(")
                        + typeid(x).name() + ")");
  return o.str();
}
$CCODE

$SOURCE
Function main( argc As Integer,argv As char Ptr Ptr)
Raw S1 As std::string
Raw S2 As std::string

Raw hwnd As long
hwnd = 12345


S1 = "Window Handle = "
S1 += stringify(hwnd)

std::cout << S1 << std::endl
End Function
$SOURCE



cpp code:

// *********************************************************************
// Created with BCX32 - BASIC To C/C++ Translator (V) 6.1.5 (2010/07/29)
//                 BCX (c) 1999 - 2009 by Kevin Diggins
// *********************************************************************
//              Translated for compiling with a C++ Compiler
// *********************************************************************
#include <windows.h>    // Win32 Header File
#include <windowsx.h>   // Win32 Header File
#include <commctrl.h>   // Win32 Header File
#include <commdlg.h>    // Win32 Header File
#include <mmsystem.h>   // Win32 Header File
#include <shellapi.h>   // Win32 Header File
#include <shlobj.h>     // Win32 Header File
#include <richedit.h>   // Win32 Header File
#include <wchar.h>      // Win32 Header File
#include <objbase.h>    // Win32 Header File
#include <ocidl.h>      // Win32 Header File
#include <winuser.h>    // Win32 Header File
#include <olectl.h>     // Win32 Header File
#include <oaidl.h>      // Win32 Header File
#include <ole2.h>       // Win32 Header File
#include <oleauto.h>    // Win32 Header File
#include <conio.h>
#include <direct.h>
#include <ctype.h>
#include <io.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <setjmp.h>
#include <time.h>
#include <stdarg.h>
#include <process.h>
// *************************************************

// ***************************************************
// Compiler Defines
// ***************************************************

// C++
#if defined( __cplusplus )
 #define overloaded
 #define C_EXPORT EXTERN_C __declspec(dllexport)
 #define C_IMPORT EXTERN_C __declspec(dllimport)
#else
 #define C_EXPORT __declspec(dllexport)
 #define C_IMPORT __declspec(dllimport)
#endif

// Open Watcom defs
#if defined( __WATCOM_CPLUSPLUS__ ) || defined( __TINYC__ )
 #define atanl atan
 #define sinl  sin
 #define cosl  cos
 #define tanl  tan
 #define asinl asin
 #define acosl acos
 #define log10l log10
 #define logl   log
 #define _fcloseall fcloseall
#endif

// Borland C++ 5.5.1 defs - bcc32.exe
#if defined( __BCPLUSPLUS__ )
 // ===== Borland Libraries ==========
 #include <dos.h>
 #pragma comment(lib,"import32.lib")
 #pragma comment(lib,"cw32.lib")
 // ==================================
#endif

// Microsoft VC++
#ifndef DECLSPEC_UUID
 #if (_MSC_VER >= 1100) && defined ( __cplusplus )
   #define DECLSPEC_UUID(x)    __declspec(uuid(x))
 #else
   #define DECLSPEC_UUID(x)
 #endif
#endif


#if !defined( __LCC__ )
// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"comctl32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"winspool.lib")
#pragma comment(lib,"shell32.lib")
#pragma comment(lib,"ole32.lib")
#pragma comment(lib,"oleaut32.lib")
#pragma comment(lib,"uuid.lib")
#pragma comment(lib,"odbc32.lib")
#pragma comment(lib,"odbccp32.lib")
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"comdlg32.lib")
#pragma comment(lib,"imagehlp.lib")
#pragma comment(lib,"version.lib")
#else
#pragma lib <winspool.lib>
#pragma lib <shell32.lib>
#pragma lib <ole32.lib>
#pragma lib <oleaut32.lib>
#pragma lib <uuid.lib>
#pragma lib <odbc32.lib>
#pragma lib <odbccp32.lib>
#pragma lib <winmm.lib>
#pragma lib <imagehlp.lib>
#pragma lib <version.lib>
// *************************************************
// End of Object/Import Libraries To Search
// *************************************************
#endif
//               User Prototypes
// *************************************************


int     main (int, char** );


// *************************************************
//            User Global Initialized Arrays
// *************************************************


// File: convert.h
#include <iostream>
#include <sstream>
#include <string>
#include <typeinfo>
#include <stdexcept>

class BadConversion : public std::runtime_error {
public:
  BadConversion(std::string const& s)
    : std::runtime_error(s)
    { }
};

template<typename T>
inline std::string stringify(T const& x)
{
  std::ostringstream o;
  if (!(o << x))
    throw BadConversion(std::string("stringify(")
                        + typeid(x).name() + ")");
  return o.str();
}
// [S01.BAS - 32] Function main( argc As Integer,argv As char Ptr Ptr)

// *************************************************
//                 Runtime Functions
// *************************************************


// ************************************
//       User Subs and Functions
// ************************************


int main (int argc, char** argv)
{
// [S01.BAS - 33] Raw S1 As stdnnstring
  std::string  S1;
// [S01.BAS - 34] Raw S2 As stdnnstring
  std::string  S2;
// [S01.BAS - 36] Raw hwnd As long
  long     hwnd;
// [S01.BAS - 37] hwnd = 12345
 hwnd=12345;
// [S01.BAS - 40] S1 = "Window Handle = "
 S1="Window Handle = ";
// [S01.BAS - 41] S1 += stringify(hwnd)
 S1+=stringify(hwnd);
// [S01.BAS - 43] stdnncout << S1 << stdnnendl
 std::cout<<S1<<std::endl;
// [S01.BAS - 44] End Function
 return 0;
}





Patrice Terrier

#21
James,

I have made some good progress using:
Quote#include <iostream>
#include <string.h>
using namespace std;

altogether with sprintf_s, this way:
Quotestring Msg = "Window";
char szStr[12];
sprintf_s(szStr, "% d ", hWnd);
Msg += szStr;
zTrace(Msg);

and i have changed my zTrace.h to this:
//#include <windows.h>
//#include <tchar.h>
//
//#include <iostream>
//#include <string.h>
//using namespace std;

//void zTrace(char szMsg[])
void zTrace(string sMsg)
{
   static HMODULE hDLL;
   typedef int (__stdcall *ZTRACE) (char*);
   ZTRACE hPROC;

   if (!hDLL)
      hDLL = LoadLibrary(L"zTrace");//_T("zTrace.dll"));
   if (hDLL)
   {
      hPROC = (ZTRACE) GetProcAddress(hDLL, "zTrace");
      if (hPROC)
      {
        //int nRet = hPROC(szMsg);
        int nRet = hPROC((char*) sMsg.c_str());
      }
      else
      {
        FreeLibrary(hDLL);
      }
   }
}


In the source code, note: int nRet = hPROC((char*) sMsg.c_str()); that allows me to convert a the sMsg string, back to asciiz pointer.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

I don't think sprintf_s is part of the standard C library so is not portable.

I am using the latest MinGWTD 32/64 compiler.

James


Patrice Terrier

James,

So far, i am focusing on Microsoft C and C++, because i am a Windows SDK programmer only.

:)
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

James C. Fuller

Quote from: Patrice Terrier on August 01, 2010, 03:43:09 PM
James,

So far, i am focusing on Microsoft C and C++, because i am a Windows SDK programmer only.

:)

There are a number of Windows C++ compilers. Why paint yourself into a corner by using non-standard code when alternatives exist?

James

Patrice Terrier

#25
James,

Well i would rather say that (by me) VISUAL STUDIO is THE standard ;)

and i can use either sprintf or sprintf_s

However, when using sprintf alone i got this warning message from VS2010:
Quotewarning C4996: 'sprintf':
This function or variable may be unsafe. Consider using sprintf_s instead.
To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
See online help for details.   c:\vs2005\hellowin32\hellowin32\hellowin32.cpp
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#26
Here is my first try to skin a Win32 C++ window.


      string SkinTheme = ExePath();
      SkinTheme += "Sony.sks";
      if (skInitEngine (SkinTheme, ""))
      {
        skSkinWindow(hWnd, "Dock|Undock|Minimize|Maximize|Restore|Close");
      }

      ShowWindow(hWnd, nCmdShow);
      UpdateWindow(hWnd);
   
      // Main message loop
      while (GetMessage(&msg, NULL, 0, 0))
      {
           TranslateMessage(&msg);
           DispatchMessage(&msg);
      }


Two new functions:

string FullExeName()
{
    string sResult;
    char exepath[MAX_PATH];
    if (GetModuleFileNameA(0, exepath, sizeof(exepath)))
    {
        sResult = exepath;
    }
    return sResult;
}

string ExePath()
{
    string sResult;
    char exepath[MAX_PATH];
    if (GetModuleFileNameA(0, exepath, sizeof(exepath)))
    {
        sResult = exepath;
        sResult = sResult.substr( 0, sResult.rfind("\\"));
        sResult += "\\";
    }
    return sResult;
}


One new include file:

#include <windows.h>
//
#include <iostream>
#include <string.h>

HMODULE g_hWLFTdll;

int skInitEngine(std::string skinfile, std::string suserkey)
{
    int nRet = 0;

    if (!g_hWLFTdll)
        g_hWLFTdll = LoadLibrary(L"WinLIFT");

    if (g_hWLFTdll)
    {
        typedef int (__stdcall *skProc) (char*, char*);
        skProc hPROC;
        hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skInitEngine");
        if (hPROC)
        {
            nRet = hPROC((char*) skinfile.c_str(), (char*) suserkey.c_str());
        }
        else
        {
            FreeLibrary(g_hWLFTdll);
        }
    }
    return nRet;
}

int skSkinWindow(HWND hWnd, std::string sbuttontip)
{
int nRet = 0;

    if (g_hWLFTdll)
    {
        typedef int (__stdcall *skProc) (HWND, char*);
        skProc hPROC;
        hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSkinWindow");
        if (hPROC)
        {
            nRet = hPROC(hWnd, (char*) sbuttontip.c_str());
        }
    }
    return nRet;
}



I have learned also how to use the #include directive:

  • #include <windows.h> // With <>, search along the path.
  • #include "WinLIFT.h"  // With "", search in the same directory of the current file.

Added:
The size of the resulting EXE in relase mode is 13,312 bytes.


...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#27
Until now i had always translated from C++ to PB, but doing the reverse is a good experience, that helps me to understand the idiosyncrasy of the C++ syntax.   :)


Here is an example of header translation:
#include <windows.h>
//
#include <iostream>
#include <string.h>

#define WM_SKGETMENUICON (WM_USER + WM_GETICON)

// Anchor constants
#define ANCHOR_NONE                0
#define ANCHOR_LEFT                ANCHOR_NONE
#define ANCHOR_WIDTH               1
#define ANCHOR_RIGHT               2
#define ANCHOR_CENTER_HORZ         3
#define ANCHOR_HEIGHT              4
#define ANCHOR_HEIGHT_WIDTH        5
#define ANCHOR_HEIGHT_RIGHT        6
#define ANCHOR_BOTTOM              7
#define ANCHOR_BOTTOM_WIDTH        8
#define ANCHOR_BOTTOM_RIGHT        9
#define ANCHOR_CENTER_HORZ_BOTTOM  10
#define ANCHOR_CENTER_VERT         11
#define ANCHOR_CENTER_VERT_RIGHT   12
#define ANCHOR_CENTER              13

// Use this value in the optional GMToffset parameter to disable local timer in case of animated background
#define DISABLE_TIMER              99

HMODULE g_hWLFTdll;

// Init the WinLIFT SkinEngine
int skInitEngine(std::string skinfile, std::string suserkey) {
   int nRet = 0;

   if (!g_hWLFTdll)
       g_hWLFTdll = LoadLibrary(L"WinLIFT");

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (char*, char*);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skInitEngine");
       if (hPROC) {
           nRet = hPROC((char*) skinfile.c_str(), (char*) suserkey.c_str());
       }
       else {
           FreeLibrary(g_hWLFTdll);
       }
   }
   return nRet;
}

// The main function to skin a window
int skSkinWindow(HWND hWnd, std::string sbuttontip) {
int nRet = 0;

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, char*);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSkinWindow");
       if (hPROC) {
           nRet = hPROC(hWnd, (char*) sbuttontip.c_str());
       }
   }
   return nRet;
}

// Disable skinning of a specific control
int skSkinDisable(HWND hCtrl) {
int nRet = 0;

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSkinDisable");
       if (hPROC) {
           nRet = hPROC(hCtrl);
       }
   }
   return nRet;
}

// Enable skinning of a specific control (use it only after a previous call to skSkinDisable)
int skSkinEnable(HWND hCtrl) {
int nRet = 0;

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSkinEnable");
       if (hPROC) {
           nRet = hPROC(hCtrl);
       }
   }
   return nRet;
}

// Anchor child controls
int skSetAnchorCtrl(HWND hCtrl, int AnchorMode) {
int nRet = 0;

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, int);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSetAnchorCtrl");
       if (hPROC) {
           nRet = hPROC(hCtrl, AnchorMode);
       }
   }
   return nRet;
}

// 4.73 Animated clock control
HWND skClockCtrl (
   HWND hOwner,                     // Handle of the window parent owner.
   std::string sImageFile,          // Full path name to the clock image background.
   int x,                           // X location of the clock control.
   int y,                           // Y location of the clock control.
   int w,                           // Width of the clock control.
   int h,                           // Height of the clock control.
   int ButID,                       // Unique ID of the clock control.
   int ARGB1,                       // The color to draw the Hour/Minute hands.
   int ARGB2,                       // The color to draw the second hands.
   int GMToffset ) {                // The GMT offset to be used.

HWND hCtrl = 0;

   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, char*, int, int, int, int, int, int, int, int);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skClockCtrl");
       if (hPROC) {
           hCtrl = (HWND) hPROC(hOwner, (char*) sImageFile.c_str(), x, y, w, h, ButID, ARGB1, ARGB2, GMToffset);
       }
   }
   return hCtrl;    
}

// Create Tooltip.
HWND skCreateToolTip (
   HWND hCtrl,                      // Handle of the child control.
   std::string sText) {             // The text to display.

HWND hTooltip = 0;

if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, char*);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skCreateToolTip");
       if (hPROC) {
           hCtrl = (HWND) hPROC(hCtrl, (char*) sText.c_str());
       }
   }
   return hCtrl;
}

// Assign new tooltip text to control.
void skSetToolTipText (
   HWND hCtrl,                      // Handle of the child control.
   std::string sText) {             // The new text to display.

if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, char*);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSetToolTip");
       if (hPROC) {
           (HWND) hPROC(hCtrl, (char*) sText.c_str());
       }
   }
}

// Get the tooltip text of a specific control.
string skGetToolTipText (
   HWND hCtrl) {                    // Handle of the child control.

std::string sText;

if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skSetToolTipText");
       if (hPROC) {
           sText = (char*) hPROC(hCtrl);
       }
   }

return sText;
}


And did i say, i am glad to have learned SDK programming to perform the conversion  :D

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Jürgen Huhn

#28
QuoteUntil now i had always translated from C++ to PB, but doing the reverse is a good experience, that helps me to understand the idiosyncrasy of the C++ syntax.

That`s same what i`ve learned even in this Disscussion... :)

..
.¸.•'´¯)¸.•'´¯)¸.•'´¯)¸.•'´¯)
¤ª"˜¨¨¯¯¨¨˜"ª¤....¤ ª"˜¨

Patrice Terrier

Example on how to pass variable by reference:

QuoteHWND hCtrl = ...;
int nMin = 0, nMax = 0;
skGaugeGetMinMax(hCtrl, nMin, nMax);

// Retrieve the Min/Max gauge value (passing variable by reference).
void skGaugeGetMinMax (
   HWND hCtrl,                      // The control handle.
   int &nMin,                       // Minimum value (for knob this is a rotation angle in the range 0-359).
   int &nMax                        // Maximum value (for knob this is a rotation angle in the range 0-359).
   ) {
   if (g_hWLFTdll) {
       typedef int (__stdcall *skProc) (HWND, int*, int*);
       skProc hPROC = (skProc) GetProcAddress(g_hWLFTdll, "skGaugeGetMinMax");
       if (hPROC) {
           hCtrl = (HWND) hPROC(hCtrl, &nMin, &nMax); // Passage by reference.
       }
   }
}
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com