Page 1 of 2

SkinButton() Problem

PostPosted: Sat Apr 15, 2023 7:20 pm
by Jimmy
hi,

i have Problem to use SkiButton() with this HB_FUNC()
Code: Select all  Expand view
#include "FiveWin.ch"

PROCEDURE Main()
LOCAL oMain, oButton
LOCAL cSource := GetAppName()
LOCAL cPath, cFile

   IF PCOUNT() > 0
      SkinButtons()
   ENDIF

   cPath := Pathonly( cSource )
   cFile := Fileonly( cSource )


   DEFINE WINDOW oMain TITLE "FiveWin Skin Demo"

   @ 10, 10 BUTTON oButton PROMPT "Property" SIZE 74, 42 PIXEL ;
              ACTION SHOWFILEPROPERTIES( oMain:Hwnd, cPath, cFile )

   ACTIVATE WINDOW oMain CENTER

RETURN

FUNCTION GetAppName()
RETURN GetModuleFileName( GetInstance() )

FUNCTION Pathonly( cFull )
LOCAL cRet  := ´´
LOCAL nPosi

   nPosi := RAT( ´\´, cFull )
   IF nPosi > 0
      cRet := SUBSTR( cFull, 1, nPosi - 1 )
   ENDIF

RETURN cRet

FUNCTION Fileonly( cFull )
LOCAL cRet  := ´´
LOCAL nPosi

   nPosi := RAT( ´\´, cFull )
   IF nPosi > 0
      cRet := SUBSTR( cFull, nPosi + 1 )
   ENDIF

RETURN cRet


*****************************************************************************

#pragma BEGINDUMP

#include <windows.h>
#include <commctrl.h>
#include <dbt.h>
#include <hbapi.h>
#include <hbapiitm.h>


HB_FUNC( SHOWFILEPROPERTIES )
{
   #ifndef _WIN64
      HWND hWnd = ( HWND ) hb_parnl( 1 );
   #else
      HWND hWnd = ( HWND ) hb_parnll( 1 );
   #endif

   SHELLEXECUTEINFO SHExecInfo;
   ZeroMemory(&SHExecInfo, sizeof(SHExecInfo));

   SHExecInfo.cbSize       = sizeof(SHExecInfo);
   SHExecInfo.fMask        = SEE_MASK_INVOKEIDLIST;
   SHExecInfo.lpVerb       = "Properties";
   SHExecInfo.lpDirectory  = hb_parc(2);
   SHExecInfo.lpFile       = hb_parc(3);
   SHExecInfo.nShow        = SW_SHOW;
   SHExecInfo.hwnd         = hWnd;

   ShellExecuteEx(&SHExecInfo);
}

#pragma ENDDUMP


run Sample and it will show you "Property" of File

run Sample again but with "any" Parameter and click Button and it will crash
Application Internal Error - C:\fwh\0\BUG\BUGSKIN.exe
Terminated at: 2023-04-15 21:10:53
Unrecoverable error 9015: Symbol item expected from hb_vmDo()
Called from REGQUERYVALUEEX(0)
Called from GETCPU(546) in .\source\function\ERRSYSW.PRG
Called from GETCPU(546) in .\source\function\ERRSYSW.PRG
Called from ERRORDIALOG(218) in .\source\function\ERRSYSW.PRG
Called from (b)ERRORSYS(24) in .\source\function\ERRSYSW.PRG
Called from (b)ERRORSYS(24) in .\source\function\ERRSYSW.PRG
Called from FWSKINBTNPAINT(87) in .\source\internal\SKINS.PRG
Called from DBUFFERSTART(0)
Called from FWSKINBTNFOCUSED(336) in .\source\internal\SKINS.PRG
Called from WINRUN(0)
Called from TWINDOW:ACTIVATE(1114) in .\source\classes\WINDOW.PRG
Called from TWINDOW:ACTIVATE(1114) in .\source\classes\WINDOW.PRG


p.s. how are FUNCTION Pathonly() and Fileonly() called under Fivewin :?:

Re: SkinButton() Problem

PostPosted: Sat Apr 15, 2023 8:23 pm
by karinha
Code: Select all  Expand view

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL oWnd, oButton
   LOCAL cSource := GetAppName()
   // LOCAL cSource := GetModuleFileName( GetInstance() ) // Name .EXE
   LOCAL cPath, cFile

   // IF PCOUNT() > 0    // ??
   IF GetActive() == Nil
      SkinButtons()
   ENDIF

   cPath := Pathonly( cSource )  // // MsgInfo( GETCURDIR() )
   cFile := Fileonly( cSource )

   DEFINE WINDOW oWnd TITLE "FiveWin SkinButtons Demo"

   @ 10, 10 BUTTON oButton PROMPT "Property" SIZE 74, 42 PIXEL ;
      ACTION SHOWFILEPROPERTIES( oWnd:Hwnd, cPath, cFile )

   ACTIVATE WINDOW oWnd CENTERED

RETURN NIL

FUNCTION GetAppName()
RETURN GetModuleFileName( GetInstance() )

FUNCTION Pathonly( cFull )

   LOCAL cRet := "" // ´´  // ERROR Chinese Char?
   LOCAL nPosi

   nPosi := RAT( "\", cFull )

   IF nPosi > 0
      cRet := SUBSTR( cFull, 1, nPosi - 1 )
   ENDIF

RETURN( cRet )

FUNCTION Fileonly( cFull )

   LOCAL cRet := "
" //´´  // ERROR Chinese Char?
   LOCAL nPosi

   nPosi := RAT( "
\", cFull )
   IF nPosi > 0
      cRet := SUBSTR( cFull, nPosi + 1 )
   ENDIF

RETURN cRet

#pragma BEGINDUMP

#include <windows.h>
#include <commctrl.h>
#include <dbt.h>
#include <hbapi.h>
#include <hbapiitm.h>

HB_FUNC( SHOWFILEPROPERTIES )
{
   #ifndef _WIN64
      HWND hWnd = ( HWND ) hb_parnl( 1 );
   #else
      HWND hWnd = ( HWND ) hb_parnll( 1 );
   #endif

   SHELLEXECUTEINFO SHExecInfo;
   ZeroMemory(&SHExecInfo, sizeof(SHExecInfo));

   SHExecInfo.cbSize       = sizeof(SHExecInfo);
   SHExecInfo.fMask        = SEE_MASK_INVOKEIDLIST;
   SHExecInfo.lpVerb       = "
Properties";
   SHExecInfo.lpDirectory  = hb_parc(2);
   SHExecInfo.lpFile       = hb_parc(3);
   SHExecInfo.nShow        = SW_SHOW;
   SHExecInfo.hwnd         = hWnd;

   ShellExecuteEx(&SHExecInfo);
}

#pragma ENDDUMP

// fin / end


Regards, saludos.

Re: SkinButton() Problem

PostPosted: Sat Apr 15, 2023 9:07 pm
by Jimmy
hi,
LOCAL cRet := "" // ´ ´ // ERROR Chinese Char?

sorry, i have change " (double) to ´ (Single) online while " make "red Color" in Source

have test your Version but it still crash :(

---

i use IF PCOUNT() > 0 to show that HB_FUNC() does work if NOT use SkinButtons()
but when pass "any" Parameter, PCOUNT() > 0 , to enable CODE for SkinButtons() it does crash

Re: SkinButton() Problem

PostPosted: Sun Apr 16, 2023 12:53 pm
by karinha
What if you use HB_AParams() --> <aValues> ?

Regards, saludos.

Re: SkinButton() Problem

PostPosted: Sun Apr 16, 2023 1:12 pm
by karinha
Code: Select all  Expand view

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL nArgs := 1

   TestPCount( nArgs )

RETURN NIL

FUNCTION TestPCount( xExp )

   IF PCount() > 0

      ? xExp

   ELSE

     ? "This function needs a parameter"

   ENDIF

RETURN NIL

// FIN / END
 


Regards, saludos.

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 6:09 am
by Jimmy
hi,
karinha wrote:What if you use HB_AParams() --> <aValues> ?

thx for Answer

the "Problem" is NOT any Parameter.

you will "get" the Problem when press Button while Skinbutton() is "active" than it will crash my HB_FUNC()
Unrecoverable error 9015: Symbol item expected from hb_vmDo()
Called from FWLOGOBITMAP(0)
Called from ERRORDIALOG(260) in .\source\function\ERRSYSW.PRG
Called from (b)ERRORSYS(24) in .\source\function\ERRSYSW.PRG
Called from FWSKINBTNPAINT(136) in .\source\internal\SKINS.PRG
Called from WINRUN(0)
Called from TWINDOW:ACTIVATE(1114) in .\source\classes\WINDOW.PRG
Called from MAIN(32) in BUGSKIN.prg

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 12:34 pm
by karinha
Hi Jimmy, POST BUGSKIN.prg complete. Pls.

Thanks.

Regards, saludos.

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 1:24 pm
by Jimmy
hi,
karinha wrote:POST BUGSKIN.prg complete

that is what i did in 1st Message

it might be that ´ make Problem which was "
i have change it while all CODE behind " become RED which is bad to read

---

in General it is Skinbutton() and my HB_FUNC()
you can use "any CODE" to call my HB_FUNC() and "see" that it work, but crash when include Skinbutton()

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 1:47 pm
by karinha
Windows 7:

[url]Image[/url]

Regards, saludos.

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 2:01 pm
by Jimmy
hi,

PLEASE press Button to let it CRASH
you need to call HB_FUNC(SHOWFILEPROPERTIES ) :!:

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 2:36 pm
by karinha
Jimmy, hello it's me, FiveWin Brasil's biggest superpower. hahahahahaha -> Just kidding Jimmy, just for fun.

look:

Image

Regards, saludos.

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 6:27 pm
by Jimmy
hi,
karinha wrote:hello it's me, FiveWin Brasil's biggest superpower. hahahahahaha -> Just kidding Jimmy, just for fun.

look:

hm ... did use "any" Parameter to use Skinbutton() :?:

sorry forgot to say : NEED Manifest :!:
have test it with
Code: Select all  Expand view
Windows10.Manifest
WindowsXP.Manifest


Code: Select all  Expand view
1 24 "WindowsXP.Manifest"

1 VERSIONINFO
FILEVERSION 0,2,26,191
PRODUCTVERSION 1,0,0,0
 FILEFLAGS 0x00000001
 FILEFLAGSMASK 0x0000003F
 FILEOS 0x00040000
 FILETYPE 0x1
 FILESUBTYPE 0x040
    BEGIN
        BLOCK "StringFileInfo"
        BEGIN
            BLOCK "040904b0"
            BEGIN
             VALUE "FileDescription", "FiveWin Skinbutton BUG\000"
             VALUE "FileVersion", "0.6.9.0\000"
             VALUE "InternalName", "DUALGRID\000"
             VALUE "LegalCopyright", "Copyright 1983-2023 Yiu-Software\000"
             VALUE "LegalTrademarks", "Harbour\000"
             VALUE "OriginalFilename", "BUGSKIN.EXE\000"
             VALUE "CompanyName", "Yiu-Software\000"
             VALUE "ProductName", "BUGSKIN\000"
             VALUE "ProductVersion", "1.0.0.0\000"
             VALUE "Comments", "Created by Auge & Ohr\000"
            END
        END
        BLOCK "VarFileInfo"
        BEGIN
            VALUE "Translation",  0x0407, 1252
        END
    END

RC Information should be under Details

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 7:10 pm
by karinha

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 9:18 pm
by Jimmy
hi,
karinha wrote:Download complete:

thx for your Work

i have look into your Sample
but i can´t use it as it is for xHarbour and CX.LNK point to
hbzip.Lib
zlib.Lib

but i don´t have those LIB on my PC

---

i´m not sure if Manifest is real load in your Demo Sample

when using Buildh.BAT and this *.RC it still CRASH

try to use same Name for RC -> JIMMYSKI.RC
Code: Select all  Expand view
// Add this to your resources RC file

#ifdef __FLAT__
   1 24 ".\Windows10.Manifest"
#endif

1 VERSIONINFO
FILEVERSION 0,2,26,191
PRODUCTVERSION 1,0,0,0
 FILEFLAGS 0x00000001
 FILEFLAGSMASK 0x0000003F
 FILEOS 0x00040000
 FILETYPE 0x1
 FILESUBTYPE 0x040
    BEGIN
        BLOCK "StringFileInfo"
        BEGIN
            BLOCK "040904b0"
            BEGIN
             VALUE "FileDescription", "FiveWin Skinbutton BUG\000"
             VALUE "FileVersion", "0.6.9.0\000"
             VALUE "InternalName", "DUALGRID\000"
             VALUE "LegalCopyright", "Copyright 1983-2023 Yiu-Software\000"
             VALUE "LegalTrademarks", "Harbour\000"
             VALUE "OriginalFilename", "BUGSKIN.EXE\000"
             VALUE "CompanyName", "Yiu-Software\000"
             VALUE "ProductName", "BUGSKIN\000"
             VALUE "ProductVersion", "1.0.0.0\000"
             VALUE "Comments", "Created by Auge & Ohr\000"
            END
        END
        BLOCK "VarFileInfo"
        BEGIN
            VALUE "Translation",  0x0407, 1252
        END
    END
 

you should see RC File Information under Detail (if not crash)

p.s. remove ".\Windows10.Manifest" and all work

Re: SkinButton() Problem

PostPosted: Mon Apr 17, 2023 11:19 pm
by karinha