• Welcome to Theos PowerBasic Museum 2017.

Recent posts

#51
General Discussion / Re: What would be best C++ IDE...
Last post by Patrice Terrier - June 15, 2017, 09:14:33 AM
Visual Studio is the best choice, especially if you need further help.
#52
General Discussion / Re: What would be best C++ IDE...
Last post by Chris Chancellor - June 15, 2017, 06:19:16 AM
Thanxx Carlo

i don't like microsoft stuff,  how about Codeblocks is it good for beginners ?
#53
General Discussion / Re: What would be best C++ IDE...
Last post by Carlo Pagani - June 14, 2017, 09:47:47 PM
In my opinion, the best would be Visual Studio  - Community edition is free and setup only downloads the components select (2017) so you don't need the huge downloads from the past.
#54
OpenGL / Needing Direction
Last post by Ron Allen - June 14, 2017, 08:41:48 PM
Hello,
I am trying to set up a FBO for use in powerbasic. For some reason these functions are not being found.

SUB initFrameBufferDepthBuffer()
    glGenRenderbuffersEXT(1, fbo_depth)                    'Generate one render buffer and store the ID in fbo_depth
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, fbo_depth)  'Bind the fbo_depth RENDER buffer
    glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, window_width, window_height)' Set the render buffer storage to be a depth component, with a width and height of the window
    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, fbo_depth)'Set the render buffer of this buffer to the depth buffer
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0)'Unbind the render buffer
END SUB           

any idea as to why?  or where I can find the .inc files for their use?
Anyone know where files can be forun to use GLEW and GUT in Powerbasic?

as always, thank you for your help.

Ron

Ron
#55
General Discussion / What would be best C++ IDE and...
Last post by Chris Chancellor - June 14, 2017, 05:57:02 PM
Hello folks

I'm trying to learn C++ and I wish to know what would be the best C++ compiler and IDE
for beginners like myself.   I'm only a part timer in programming. i learn some BASIC and VB.net
for the past 3 or 4 years, i'm no expert in these either.  i don't like microsoft visual stuff
please advise
ThanXXX
#56
Addon tools for PB / Re: USB hardware serial numbe...
Last post by Patrice Terrier - June 03, 2017, 10:27:06 AM
Instead of using the WMI Win32_DiskDrive class, you can use the MSFT_PhysicalDisk class and query for the MediaType property, that returns a UInt16 (WORD) value indicating the media type of the disk:

0 Unspecified
3 HDD
4 SSD
5 SCM

See: https://msdn.microsoft.com/en-us/library/windows/desktop/hh830532(v=vs.85).aspx

#57
Discussion / Re: REPLACE
Last post by Patrice Terrier - May 26, 2017, 02:35:36 PM
James--

You are absolutly right, i forget to multiply delta by sizeof(WCHAR), as i am dealind with Unicode while BC9 is using ANSI
CopyMemory(r, p, delta*sizeof(WCHAR));

My mistake, thank you!
#58
Discussion / Re: REPLACE
Last post by James C. Fuller - May 24, 2017, 02:10:20 PM
Patrice,
  I think your problem might be your use of CopyMemory instead of wmemcpy in the replace function??
Aren't you copying char's instead of wchar's?

James
#59
Discussion / Re: REPLACE
Last post by James C. Fuller - May 24, 2017, 01:49:50 PM
Patrice,
  I don't know what the problem may be?
Bcx/Bc9 uses a circular buffer for returning strings (char[]/wchar[]) from functions.
I have never had any issues with it, although I thought I might with wchar[]'s.

I found out when using the stl string/wstring you don't have to worry about it. The compiler will do the copy from a local string to your calling var for you. I thought this was just an stl function but it seems it's for all classes.
I have used Fred's String class this way with no issues.
Yes you do have the overhead but it's not much with Fred's String class.

In your replace function example you are modifying the main string where the bc9 replace does not.

Try it with my tchar.h and see if that helps.
James
tchar.h

// tchar.h
#ifndef tchar_h
   #define tchar_h
   #ifdef  _UNICODE
      typedef wchar_t     TCHAR;
      typedef wchar_t     _TCHAR;
      #define _T(x)       L## x
      #define _tmain      wmain
      #define _tWinMain   wWinMain
      #define _tfopen     _wfopen
      //#define _fgetts     fgetws
      #define _fgetts     fgetws
      #define _tprintf    wprintf
      #define _ftprintf   fwprintf
      //#define _ftprintf   fprintf
      #define _stprintf   swprintf
      #define _tcslen     wcslen
      #define _tcscpy     wcscpy
      #define _tcscat     wcscat
      #define _tcsncpy    wcsncpy
      #define _tcscmp     wcscmp
      //jcfuller added
      #define _tcsicmp    wcsicmp
      #define _tcsncmp    wcsncmp
      #define _tcsnicmp   _wcsnicmp
      #define _tcsrev     _wcsrev
      //#define FltToTch    FltToWch
      #define _ttol       _wtol
      #define _ttoi       _wtoi
      #define _ttoi64     _wtoi64
      #define _gettchar getchar
      #define _ttof       _wtof
      //jcfuller added
      #define _tcschr     _wcschr
      #define Version VersionW
      #define _totupper   towupper
      #define _totlower   tolower
      #define _istspace   _iswspace
      #define _istdigit   _iswdigit
      #define _istxdigit  _iswxdigit
      #define _istalpha   _iswalpha
      #define _istalnum   _iswalnum
      #define _istcntrl   _iswcntrl
      #define _istprint   _iswprint
      #define _istgraph   _iswgraph
      #define _istlower   _iswlower
      #define _istpunct   _iswpunct
      #define _istupper   _iswupper
      #define _tsystem    tcl__wsystem
      #define _tsplitpath tcl_wsplitpath
      #define wcsstr _wcsstr
      //#define rand _rand
      //#define srand _srand
      //#define exit tcl_exit
      #define fflush tcl_fflush
      #define _fgettc fgetwc
      #define _ungettc ungetwc
      #define _TEOF WEOF
      #define _istspace   _iswspace
   #else
      typedef char        TCHAR;
      #define _T(x)       x
      #define _tmain      main
      #define _tWinMain   WinMain
      #define _tfopen     fopen
      #define _fgetts     fgets
      #define _tprintf    printf
      #define _ftprintf   fprintf
      #define _stprintf   sprintf
      #define _tcslen     strlen
      #define _tcscpy     strcpy
      #define _tcscat     strcat
      #define _tcsncpy    strncpy
      #define _tcscmp     strcmp
      //jcfuller added
      #define _tcsicmp    stricmp
     
      #define _tcsncmp    strncmp
      #define _tcsnicmp   _strnicmp
      #define _tcsrev     _strrev
      #define FltToTch    FltToCh
      #define _ttol       atol
      #define _ttoi64     _atoi64
      //jcfuller added
      #define strchr     _strchr
      #define Version VersionA
      #define _istspace   _isspace
      //#define rand _rand
      //#define srand _srand
      #define exit tcl_exit
      #define fflush tcl_fflush
      #define _tsplitpath tcl_splitpath   
      #define isspace   _isspace
      #define isdigit   _isdigit
      #define isxdigit  _isxdigit
      #define isalpha   _isalpha
      #define isalnum   _isalnum
      #define iscntrl   _iscntrl
      #define isprint   _isprint
      #define isgraph   _isgraph
      #define islower   _islower
      #define ispunct   _ispunct
      #define isupper   _isupper
      #define _atof atof
      #define _fgettc fgetc
      #define _ungettc ungetc
      #define _TEOF EOF
   #endif
#endif


#60
Discussion / Re: REPLACE
Last post by Patrice Terrier - May 23, 2017, 07:59:01 PM
James

Just in case, here is the function i wrote to match my need

WCHAR* Replace(IN WCHAR* zMain, IN WCHAR* zSearch, IN WCHAR* zReplace) {
    static WCHAR sResult[512];
    ZeroMemory(sResult, 512 * sizeof(WCHAR));

    long nMain = (long)wcslen(zMain);
    long nSearch = (long)wcslen(zSearch);
    WCHAR* zParse = new WCHAR[nMain];
    long K = 0, nFound = 0, nStart = 0, ptr = 0;

    for (K = 0; K < nMain; K++) {
        if (zMain[K] == zSearch[nFound]) {
            nFound++;
            if (nStart == 0) { nStart = K; }
        } else if (nFound) {
            if (nFound == nSearch) {
                ZeroMemory(zParse, nMain * sizeof(WCHAR));
                MoveMemory(&zParse[0], &zMain[ptr], (nStart - ptr) * sizeof(WCHAR));
                AddStr(sResult, zParse); AddStr(sResult, zReplace);
                ptr = nStart + nSearch;
                nFound = 0; nStart = 0;
            } else if (nFound) {
                if (zMain[K] != zSearch[nFound]) {
                    nFound = 0; nStart = 0;
                }
            }
        }
    }

    if ((ptr > 0) && (nMain > ptr)) {
        ZeroMemory(zParse, nMain * sizeof(WCHAR));
        MoveMemory(&zParse[0], &zMain[ptr], (nMain - ptr) * sizeof(WCHAR));
        AddStr(sResult, zParse);
    }
    delete [] zParse;
    return sResult;
}


with minor change i could also use it to parse a string.