Author Topic: Unable to File Binary  (Read 211 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Unable to File Binary
« on: January 05, 2019, 10:39:57 AM »

 I am intermittently getting this error:

Code: [Select]
Unable to File Binary C:\Example.exe 112
This Started happening after i added these declarations:

Code: [Select]
DECLARE FUNCTION _10SetProp               Lib "user32.dll"   Alias "SetPropA" (ByVal hWnd As SYS, lpString As String, byval hAddr AS SYS) AS SYS
DECLARE FUNCTION _10GetProp               Lib "user32.dll"   Alias "GetPropA" (ByVal hWnd As SYS, lpString As String) As SYS
DECLARE FUNCTION _10RemoveProp            Lib "user32.dll"   Alias "RemovePropA" (ByVal hWnd As SYS, lpString As String) As SYS
DECLARE FUNCTION _10GetProcessHeap        Lib "Kernel32.dll" Alias "GetProcessHeap" () As SYS
DECLARE FUNCTION _10HeapAlloc             Lib "Kernel32.dll" Alias "HeapAlloc" (ByVal hProc As SYS, ByVal mMode As dword, byval mSize as SYS) As SYS
DECLARE FUNCTION _10HeapFree              Lib "Kernel32.dll" Alias "HeapFree" (ByVal hProc As SYS, ByVal mMode As dword, byval hObj as sys) As SYS

It seems like Oxygen does create Example.exe, but its a 0kb file, and then displays the above error.

 If i dont declare the above functions, the problem seems to go away, so, i am guessing one of those is causing it...
When it does work, it works flawlessly. No runtime problems at all.

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #1 on: January 05, 2019, 11:11:48 AM »

I think i figured the pattern.

 If i add a certain print statement in a certain place to monitor the result of an operation, oxygen doesnt like it and starts displaying that error.
then i need to delete the file manually, wait like a minute, then try again.


Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #2 on: January 05, 2019, 11:21:49 AM »
Actually i dont need to dlete the file, just giving it a few seconds (like 20), it makes a successful compilation again.

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3946
    • Oxygen Basic
Re: Unable to File Binary
« Reply #3 on: January 05, 2019, 12:02:03 PM »
Hi Brian,

Your file might be locked down while being scanned for malware. I noticed strange delays when filing exe files to the Desktop. (Windows 10). Assume we are all under surveillance!

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #4 on: January 05, 2019, 12:07:56 PM »

Yes, i suspect that as well Charles, Its strange i didnt got this before... :)

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #5 on: January 05, 2019, 12:18:48 PM »
 Hmmm, Actually, the issue persists even if i successfully delete the exe... so, im clueless.
I will post the code here for you to see, maybe you can repdocude it. By the way, the following code
(which causes this issue) works on 32 bit and fails on 64 bits... (works fine until closed)


Code: [Select]
'Generated with PluriBASIC 6.0.203001.0

$ filename "Example.exe"

uses rtl64


MACRO _10ONERR(l, e)
   Err.err = e
   IF (Err.err>0) THEN
      Err.ers = Err.erp
      Err.erl = l   
      IF Err.Oe1 THEN
         JMP Err.Oe1
      ELSEIF Err.Oe2 THEN
         CALL Err.Oe2
      END IF
   else
      Err.ers = ""
      Err.erl = 0   
   END IF
END MACRO

MACRO ERRCLEAR
    Err.err = 0
    Err.erl = 0
    Err.ers = ""
END MACRO

CLASS _10SYSERR
    public sys Oe1 = 0
    public sys Oe2 = 0
    public int err = 0
    public int erl = 0
    public string erp = ""
    public string ers = ""
END CLASS

TYPE _10RECT
    long left
    long top
    long right
    long bottom
END TYPE

DECLARE FUNCTION _10GetParent             LIB "USER32.DLL"   ALIAS "GetParent" (BYVAL hWnd AS SYS) AS SYS
DECLARE FUNCTION _10GetDC                 LIB "USER32.DLL"   ALIAS "GetDC" (BYVAL hWnd AS SYS) AS SYS
DECLARE function _10GetStockObject        lib "GDI32.DLL"    alias "GetStockObject"
DECLARE function _10GetSystemMetrics      lib "USER32.DLL"   ALIAS "GetSystemMetrics"
DECLARE function _10GetDeviceCaps         lib "GDI32.DLL"    alias "GetDeviceCaps" (byval hdc as sys, byval nIndex as int) as int
DECLARE function _10ReleaseDC             lib "USER32.DLL"   alias "ReleaseDC" (byval hWnd as sys, byval hDC as sys) as INT
Declare Function _10CreateWindowEx        Lib "user32.dll"   Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as INT
Declare Function _10CreateSolidBrush      Lib "gdi32.dll"    Alias "CreateSolidBrush"(ByVal crColor As INT) As INT
Declare Function _10GetSysColor           Lib "user32.dll"   Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10LoadIcon              Lib "user32.dll"   Alias "LoadIconA" (ByVal hInstance As INT, ByVal lpIconName As Any) As INT
Declare Function _10LoadCursor            Lib "user32.dll"   Alias "LoadCursorA" (ByVal hInstance As INT, ByVal lpCursorName As Any) As INT
Declare Function _10GetModuleHandle       Lib "kernel32.dll" Alias "GetModuleHandleA" (int lpModuleName) as SYS
Declare Function _10CallWindowProc        Lib "user32.dll"   Alias "CallWindowProcA" (byval hProc as sys, ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProc         Lib "user32.dll"   Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProcCallBack Lib "user32.dll"   Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10GetSysColor           Lib "user32.dll"   Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10GetDialogBaseUnits    LIB "User32.dll"   ALIAS "GetDialogBaseUnits" () AS INT
Declare Function _10MulDiv                LIB "KERNEL32.DLL" ALIAS "MulDiv" (BYVAL nNumber AS INT, BYVAL nNumerator AS INT, BYVAL nDenominator AS INT) AS INT
Declare Function _10MapDialogRect         LIB "user32.DLL"   ALIAS "MapDialogRect" (ByVal hWnd As SYS, Byref RC AS _10RECT) AS SYS
Declare Function _10GetDesktopWindow      LIB "user32.DLL"   ALIAS "GetDesktopWindow" () AS SYS
Declare Function _10GetLastError          LIB "Kernel32.DLL" ALIAS "GetLastError" () AS SYS
Declare Function _10FormatMessage         LIB "Kernel32.dll" ALIAS "FormatMessageA" (BYVAL dwFlags AS DWORD, BYVAL lpSource AS DWORD, BYVAL dwMessageId AS DWORD, BYVAL dwLanguageId AS DWORD, lpBuffer AS ASCIIZ, BYVAL nSize AS DWORD, BYVAL Arguments AS DWORD) AS DWORD
DECLARE FUNCTION _10CreateDialogIParam    LIB "user32.dll"   ALIAS "CreateDialogIndirectParamA" (sys hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit) as sys
DECLARE SUB _10PostQuitMessage            LIB "User32.dll"   ALIAS "PostQuitMessage"
DECLARE SUB _10DestroyWindow              LIB "User32.dll"   ALIAS "DestroyWindow"
DECLARE FUNCTION _10GetDlgItem            LIB "User32.dll"   ALIAS "GetDlgItem" (BYVAL hDlg AS SYS, BYVAL nIDDlgItem AS LONG) AS SYS

DECLARE FUNCTION _10SetProp               Lib "user32.dll"   Alias "SetPropA" (ByVal hWnd As SYS, BYVAL lpString As String, BYVAL hAddr AS DWORD) AS SYS
DECLARE FUNCTION _10GetProp               Lib "user32.dll"   Alias "GetPropA" (ByVal hWnd As SYS, BYVAL lpString As String) AS SYS
DECLARE FUNCTION _10RemoveProp            Lib "user32.dll"   Alias "RemovePropA" (ByVal hWnd As SYS, BYVAL lpString As String) AS SYS
DECLARE FUNCTION _10GetProcessHeap        Lib "Kernel32.dll" Alias "GetProcessHeap" () As SYS
DECLARE FUNCTION _10HeapAlloc             Lib "Kernel32.dll" Alias "HeapAlloc" (ByVal hProc As DWORD, ByVal mMode As dword, byval mSize as DWORD) AS SYS
DECLARE FUNCTION _10HeapFree              Lib "Kernel32.dll" Alias "HeapFree" (ByVal hProc As DWORD, ByVal mMode As dword, byval hObj as DWORD) AS SYS

TYPE _10DLGTEMPLATE
   dword style
   dword eStyle
   word  cdit
   short x
   short y
   short cx
   short cy
END TYPE

    _10RECT _10RC
   
    sys _10LPPI = 0
    SYS _10HPPA = 0
    _10DLGTEMPLATE _10LPDT

    _10LPDT.style  = 2155872320
    _10LPDT.eStyle = 1
    _10LPDT.cdit   = 0
    _10LPDT.x      = 1
    _10LPDT.y      = 1
    _10LPDT.cx     = 2
    _10LPDT.cy     = 2

    ' Create a dummy dialog to retrieve dialog units.
    sys _10TODL = _10CreateDialogIParam(_10GetModuleHandle(0), @_10LPDT, _10HPPA, @_10DEFAULT_CALLBACK_PROC, _10LPPI)
   
    _10RC.right  = 1
    _10RC.bottom = 1       
   
    _10MapDialogRect(_10TODL, _10RC)  ' returns 0
   
 
TYPE _10WNDCLASSEX ' 64 bit headers for use with DIALOG NEW
    int cbSize
    int style
    sys lpfnwndproc
    int cbClsextra
    int cbWndExtra
    sys hInstance
    sys hIcon
    sys hCursor
    sys hbrBackground
    sys lpszMenuName
    sys lpszClassName
    sys hIconSm
END TYPE

Declare Function _10RegisterClassEx     Lib "user32.dll"   Alias "RegisterClassExA" (byref lpwcx as _10WNDCLASSEX) as INT
   
    _10WNDCLASSEX _10WClass

    _10WClass.cbSize        = SizeOf(_10WNDCLASSEX)
    _10WClass.style         = 40
    _10WClass.lpfnWndProc   = &_10DefWindowProcCallBack
    _10WClass.hInstance     = _10GetModuleHandle(0) 
    _10WClass.hIcon         = _10LoadIcon(0, ByVal 32512)         'loads an icon for use by the program
    _10WClass.hCursor       = _10LoadCursor(0, ByVal 32512)       'loads a mouse cursor for use by the program
    _10WClass.hbrBackground = _10CreateSolidBrush(_10GetSysColor(15))
    _10WClass.lpszMenuName  = STRPTR("")
    _10WClass.lpszClassName = STRPTR("DDTDialog")
    _10WClass.hIConSm       = _10LoadIcon(0, ByVal 32512) 'loads an icon for use by the program

    Call _10RegisterClassEx(_10WClass)       'registers a window class for the program window   
   
    'print _10RC.right " - " _10RC.bottom
                         
Declare Function PluriBASICMessageBox  Lib "user32.dll" Alias "MessageBoxA"
TYPE _10MSG
   hwnd    as int
   message as int
   wParam  as int
   lParam  as int
   time    as dword
   'part of pointapi.
   X       as INT
   Y       as INT
END TYPE
Declare Function _10ShowWindow       Lib "user32.dll" Alias "ShowWindow" (ByVal hWnd As INT, ByVal nCmdShow As INT) As INT
Declare Function _10TranslateMessage Lib "user32.dll" Alias "TranslateMessage" (byref lpMsg as _10MSG) as INT
Declare Function _10DispatchMessage  Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as _10MSG) as INT
Declare Function _10GetMessage       Lib "user32.dll" Alias "GetMessageA" (lpMsg As _10MSG, ByVal hWnd As INT, ByVal wMsgFilterMin As INT, ByVal wMsgFilterMax As INT) As INT
DECLARE FUNCTION _10IsWindow         LIB "USER32.DLL" ALIAS "IsWindow" (BYVAL hWnd AS DWORD) AS int
DECLARE FUNCTION _10SetWindowLong    LIB "USER32.DLL" ALIAS "SetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT, BYVAL lNewLong AS QUAD) AS INT
DECLARE FUNCTION _10SendMessage      LIB "USER32.DLL" ALIAS "SendMessageA" (BYVAL hWnd AS DWORD, BYVAL dwMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS INT) AS INT
DECLARE FUNCTION _10SetWindowLongPtr LIB "USER32.DLL" ALIAS "SetWindowLongPtrA" (BYVAL hWnd AS sys, BYVAL nIndex AS INT, BYVAL lNewLong AS sys) AS SYS
DECLARE FUNCTION _10GetWindowLongPtr LIB "USER32.DLL" ALIAS "GetWindowLongPtrA" (BYVAL hWnd AS sys, BYVAL nIndex AS INT) AS SYS

TYPE _10HPROP
    long elem
    long dmode
    sys oldProc
    sys curProc
    long user1
    long user2   
END TYPE

Function _10DEFAULT_CALLBACK_PROC(sys hwnd, wMsg, wParam, lParam) as sys callback

    _10HPROP *hdata
    _10HPROP *hdat2
   
    sys retval = 0
   
    @hData = _10GetProp(hwnd, "DATA")
   
    If @hData Then
        if hData.curProc then
            retval = _10CallWindowProc(hData.curProc, hWnd, wMsg, wParam, lParam)                               
        end if
    end if
   
    if retval=0 then ' Yes, destroying the object.
        if @hData then
            if hData.elem = 2 then
               
                sys hParent = _10GetParent(hWnd)               
                @hdat2 = _10GetProp(hParent, "DATA")               
                if @hdat2 then                   
                    if hdat2.curProc then
                        retval = _10CallWindowProc(hDat2.curProc, hWnd, wMsg, wParam, lParam)
                    end if
                end if   
               
                if retval=0 then
                    retval = _10CallWindowProc(hData.oldProc, hWnd, wMsg, wParam, lParam)
                end if
            else
                retval = _10DefWindowProc(hwnd,wMsg,wParam,lParam)             
            end if
                   
            if wMsg=2 then ' WM_DESTROY     
                If hData.oldProc Then
                    _10SetWindowLongPtr(hWnd, -4, hData.oldProc)
                end if
                _10HeapFree(_10GetProcessHeap(), 0, ByVal @hData)
               
                _10RemoveProp(hWnd, "DATA")
               
            end if
        else
            retval = _10DefWindowProc(hwnd, wMsg, wParam, lParam)
        end if
    end if
   
    return retval
   
End Function


' STARTS PLURIBASIC_PREPARE.BIN
' This code is executed before anything else, if you want to do something after defining other things, see PLURIBASIC_INIT





' END OF PLURIBASIC_PREPARE.BIN
' STARTS PRINTR.BIN
' STARTS MSGBOX.BIN
FUNCTION MSGBOX(string sText, sys mOptions = 0, string sCaption = "PluriBASIC") AS LONG
   FUNCTION = PluriBASICMessageBox(0, sText, sCaption, mOptions)
END FUNCTION
' END OF MSGBOX.BIN
' CONTINUES (1) PRINTR.BIN
macro PRINTR(p1, p2)
    MSGBOX(p1 + p2)
end macro
' END OF PRINTR.BIN
' STARTS PLURIBASIC_INIT.BIN
' This code is executed before anything else, if you want to do something before nything else, see PLURIBASIC_PREPARE
       
   
   
   

' END OF PLURIBASIC_INIT.BIN
' STARTS DIALOGSHOW.BIN



Function DialogShow(BYVAL dMode AS LONG, BYVAL hDlg AS SYS, BYVAL hCallback AS DWORD, BYREF Result AS DWORD) AS LONG

    Dim wm as _10MSG
    dword rr = 0
   
    _10HPROP *hdata
   
   
    If @hData Then
        hData.oldProc = _10GetWindowLongPtr(hDlg, -4)
    end if       
    sys r = _10SetWindowLongPtr(hDlg, -4, @_10DEFAULT_CALLBACK_PROC)

    _10SendMessage(hDlg, 272, 0, 0)
   
    _10ShowWindow(hDlg, 5)
    _10ShowWindow(hDlg, 5) ' first one never works.   
   
    @hData = _10GetProp(hDlg, "DATA")
   
    If @hData Then
        hData.curProc = hCallback
    end if
   
    If @hData Then
        hData.oldProc = _10GetWindowLongPtr(hDlg, -4)
    end if
   
    Result = 0
   
    if dMode = 1 then
        while _10GetMessage(wm,0,0,0)
            rr = _10TranslateMessage(wm)
            _10DispatchMessage(wm)           
            IF _10IsWindow(hDlg) = 0 THEN
                Result = rr
                EXIT DO
            end if
        Wend
    end if
   
end function
 
' END OF DIALOGSHOW.BIN
' STARTS DIALOGNEW.BIN
' STARTS CALLBACKDATA.BIN
' END OF CALLBACKDATA.BIN
' CONTINUES (1) DIALOGNEW.BIN

FUNCTION DialogNew(BYVAL dMode AS LONG, byval hParent AS DWORD, BYVAL sCaption AS STRING, BYREF Xt AS LONG, BYREF Yt AS LONG, BYVAL W AS LONG, BYVAL H AS LONG, BYVAL dStyle AS DWORD, BYVAL exStyle AS DWORD, BYREF Result AS DWORD) AS LONG

' Im clueless, dont ask me.
single ratioX = 1.58 
single ratioY = 1.82
'=========================

sys hFont = _10GetStockObject(17)

long DX = 0
long dy = 0
long dw = 0
long dH = 0 
 
SELECT CASE dMode
    case 0, 6 ' UNITS.
        dw = w * RatioX
        dh = h * RatioY       

        IF @Xt=0 THEN
            dx = (_10GetSystemMetrics(0)/2) - (dw/2)
        ELSE
            dx = Xt * RatioX
        END IF       
        if @Yt=0 then
            dy = (_10GetSystemMetrics(1)/2) - (dh/2)
        else
            dy = Yt * RatioY
        end if
         
    case 5    ' PIXELS           
        if @Xt=0 then
            DX = (_10GetSystemMetrics(0)/2) - (w/2)
        ELSE
            DX = Xt
        end if
        if @Yt=0 then
            dy = (_10GetSystemMetrics(1)/2) - (h/2)
        ELSE
            dy = Yt
        end if   
        dw = w
        Dh = h
       
    case 7    ' DPIAWARE
   
END SELECT

Result = _10CreateWindowEx(exStyle,_          'extended styles
                        "DDTDialog", _        'window class name
                        sCaption,_            'window caption
                        dStyle,_              'window style
                        DX, _                 'initial x position
                        dy, _                 'initial y position
                        dw, _                 'initial x size
                        DH, _                 'initial y size
                        hParent, _            'parent window handle
                        0, _                  'window menu handle
                        _10GetModuleHandle(0), _ 'program instance handle
                        0)                    'creation parameter
                       
  if Result then                             
      _10SendMessage(Result, 48, hFont, 0)     
      _10HPROP *hdata
      @hData = _10HeapAlloc(_10GetProcessHeap(), 8, SizeOf(_10HPROP))
      If @hData Then
         hData.elem  = 1
         hData.dMode = dMode
         _10SetProp(Result, "DATA", @hData)         
      end if
  end if                         

END FUNCTION


' END OF DIALOGNEW.BIN
' STARTS CONTROLADD.BIN

FUNCTION ControlAdd(string tControl, sys hParent, long cID, string sCaption, long X, Y, W, H, sys dStyle, sys exStyle, sys hCallback) AS sys

  int Result

  sys       hDC = _10GetDC(0)
  single ratioX = (_10GetDeviceCaps(hDC, 88) / 96)
  single ratioY = (_10GetDeviceCaps(hDC, 90) / 96)
 
  _10ReleaseDC(0, hDC)
 
  int dx        = (X * RatioX) * 1.53
  int dy        = (Y * RatioY) * 1.7
  int dW        = (W * RatioX) * 1.53
  int dH        = (H * RatioY) * 1.7

  sys defStyle = 1073741824 or 268435456         
  sys hFont     = _10GetStockObject(17)
 
  string tctrl = lcase(Ltrim(rtrim(tControl)))

  if tCtrl = "label" then
     tCtrl = "Static"

  elseif tCtrl = "textbox" then
     tCtrl = "Edit"     
 
  elseif tCtrl = "listview" then   
     tCtrl = "SysListView32"
     
  end if
 
  if dStyle = 0 then dStyle = defStyle
                                           
  Result = _10CreateWindowEx(exStyle,_   'extended styles
                          tCtrl,    _           'control class name
                          sCaption,_            'control caption
                          dStyle,_              'control style
                          DX, _                 'initial x position
                          DY, _                 'initial y position
                          DW, _                 'initial x size
                          DH, _                 'initial y size
                          hParent, _            'parent window handle
                          cID, _                'control ID
                          _10GetModuleHandle(0), _ 'program instance handle
                          0)                    'creation parameter

  if Result then
    sys hMsg = -4
      _10SendMessage(Result, 48, hFont, 0)     
      _10HPROP *hdata
      @hData = _10HeapAlloc(_10GetProcessHeap(), 8, SizeOf(_10HPROP))
      If @hData Then
         hData.elem  = 2
         hData.oldProc = _10GetWindowLongPtr(Result, -4)
         hData.curProc = hCallback               
         _10SetProp(Result, "DATA", @hData)         
      end if     
      quad r = _10SetWindowLongPtr(Result, hMsg, @_10DEFAULT_CALLBACK_PROC)
  end if
 
  return Result                           

END FUNCTION

' END OF CONTROLADD.BIN

% WM_CREATE           = 1
% WM_COMMAND          = 273
% WM_INITDIALOG       = 272
% WS_CHILD            = 1073741824
% WS_VISIBLE          = 268435456
% WS_TABSTOP          = 65536
% MB_ICONEXCLAMATION  = 48
% IDC_BUTTON1         = 1001

' SYSTEM DECLARES FOR ARRAYS


DECLARE FUNCTION BUTTONPROC() AS LONG
DECLARE FUNCTION MAINPROC() AS LONG
DECLARE FUNCTION PBMAIN() AS LONG


' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG

END FUNCTION

FUNCTION BUTTONPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
   INT _05RETVAL = 0
   _10SYSERR Err
   INT _SC79 = cbMsg
   IF _SC79 = WM_COMMAND THEN
      INT _SC80 = loword(wParam)
      IF _SC80 = IDC_BUTTON1 THEN
         MSGBOX ("Over here!", MB_ICONEXCLAMATION)
      END IF
   END IF
   RETURN _05RETVAL
END FUNCTION

FUNCTION MAINPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
   INT _05RETVAL = 0
   _10SYSERR Err
   INT result
   INT _SC81 = cbMsg
   IF _SC81 = WM_CREATE THEN
   ELSEIF _SC81 = WM_INITDIALOG THEN
   ELSEIF _SC81 = WM_COMMAND THEN
      INT _SC82 = loword(wParam)
      IF _SC82 = IDC_BUTTON1 THEN
         MSGBOX ("You pushed me! I'm offended!", MB_ICONEXCLAMATION)
      END IF
   ELSE
   END IF
   RETURN _05RETVAL
END FUNCTION

FUNCTION PBMAIN() AS INT
   INT _05RETVAL = 0
   _10SYSERR Err
   DWORD hdlg
   INT result
   DialogNew(0, 0, "Hello World Compiled with " & "OxygenBASIC", byval 0, byval 0, 400, 400, 13565952, 0, hdlg)
   ControlAdd("button", hdlg, IDC_BUTTON1, "Don't push me", 5, 5, 80, 20, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, @BUTTONPROC)
   DialogShow(1, hdlg, @MAINPROC, result)
   PRINTR("ok", chr(10, 13))
END FUNCTION

PBMAIN() ' invoke entry point

John

  • Hero Member
  • *****
  • Posts: 3529
Re: Unable to File Binary
« Reply #6 on: January 05, 2019, 12:27:48 PM »
Quote
Assume we are all under surveillance!

Microsoft views that as user protection and risk reporting.

Arnold

  • Hero Member
  • *****
  • Posts: 741
Re: Unable to File Binary
« Reply #7 on: January 06, 2019, 05:20:02 AM »
Hi Brian,

I was able to compile your example code as a 64-bit exe. I used oxygen.dll of July 2018. But I could not run the example in 32-bit. If you want it to make 32-bit compatible you have to consider SetWindowLong and GetWindowLong too.

I also have some problems at the moment with MS Defender when using the latest oxygen.dlls. In particular finded.exe of OXSC... is quarantined and exe files which I create in 32-bit. Sometimes the newer oxygen.dlls were quarantined too.

Roland
« Last Edit: January 06, 2019, 05:31:45 AM by Arnold »

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3946
    • Oxygen Basic
Re: Unable to File Binary
« Reply #8 on: January 06, 2019, 06:26:44 AM »
Here's the page for reporting:

https://www.microsoft.com/en-us/wdsi/filesubmission

There was a Defender attack on co2.exe on 24 December. I had to submit the whole OXSC zip file because Defender seized any copy of co2 I created.

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #9 on: January 06, 2019, 07:16:12 AM »
...But I could not run the example in 32-bit. If you want it to make 32-bit compatible you have to consider SetWindowLong and GetWindowLong too...

 Hello Roland, PluriBASIC generates a completely different set of declarations for 32bit and 64 bit, what you compiled was the 64 bits version. WHen i use #OPTIONS X32 in PluriBASIC, it generates working code with no need of tweaks. :)

 In order to make it compilable in 32bits, a lot of "manual" changes need to be done.

By the way, the crashing is now fixed, i had a flawed declaration for SetProp(). Now, every control can have it's own callback function separately if needed.

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #10 on: January 06, 2019, 07:20:33 AM »
Here is what PluriBASIC generates for 32bits:

Code: [Select]
'Generated with PluriBASIC 6.0.123201.0

$ filename "C:\Users\Diamante\Documents\PluriBASIC\projects\ListViewExample.exe"

uses rtl32


MACRO _10ONERR(l, e)
   Err.err = e
   IF (Err.err>0) THEN
      Err.ers = Err.erp
      Err.erl = l   
      IF Err.Oe1 THEN
         JMP Err.Oe1
      ELSEIF Err.Oe2 THEN
         CALL Err.Oe2
      END IF
   else
      Err.ers = ""
      Err.erl = 0   
   END IF
END MACRO

MACRO ERRCLEAR
    Err.err = 0
    Err.erl = 0
    Err.ers = ""
END MACRO

CLASS _10SYSERR
    public sys Oe1 = 0
    public sys Oe2 = 0
    public int err = 0
    public int erl = 0
    public string erp = ""
    public string ers = ""
END CLASS
DECLARE function _10InitCommonControlsEx lib "Comctl32.dll"    alias "InitCommonControlsEx"

TYPE _10INITCOMMONCONTROLSEX
  DWORD dwSize
  DWORD dwICC
END TYPE

_10INITCOMMONCONTROLSEX _10ICCE
_10ICCE.dwSize = sizeof(_10INITCOMMONCONTROLSEX)
_10ICCE.dwICC = 0xffff
_10InitCommonControlsEx(&_10ICCE)

TYPE _10RECT
    long left
    long top
    long right
    long bottom
END TYPE

DECLARE FUNCTION _10GetParent             LIB "USER32.DLL"   ALIAS "GetParent" (BYVAL hWnd AS SYS) AS SYS
DECLARE FUNCTION _10GetDC                 LIB "USER32.DLL"   ALIAS "GetDC" (BYVAL hWnd AS SYS) AS SYS
DECLARE function _10GetStockObject        lib "GDI32.DLL"    alias "GetStockObject"
DECLARE function _10GetSystemMetrics      lib "USER32.DLL"   ALIAS "GetSystemMetrics"
DECLARE function _10GetDeviceCaps         lib "GDI32.DLL"    alias "GetDeviceCaps" (byval hdc as sys, byval nIndex as int) as int
DECLARE function _10ReleaseDC             lib "USER32.DLL"   alias "ReleaseDC" (byval hWnd as sys, byval hDC as sys) as INT
Declare Function _10CreateWindowEx        Lib "user32.dll"   Alias "CreateWindowExA" (byval dwExStyle AS INT,byval lpClassName AS STRING,byval lpWindowName AS STRING,byval dwStyle AS INT,byval x AS INT,byval y AS INT,byval nWidth AS INT,byval nHeight AS INT,byval hWndParent AS INT,byval hMenu AS INT,byval hInstance AS INT,byval lpParam AS INT) as INT
Declare Function _10CreateSolidBrush      Lib "gdi32.dll"    Alias "CreateSolidBrush"(ByVal crColor As INT) As INT
Declare Function _10GetSysColor           Lib "user32.dll"   Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10LoadIcon              Lib "user32.dll"   Alias "LoadIconA" (ByVal hInstance As INT, ByVal lpIconName As Any) As INT
Declare Function _10LoadCursor            Lib "user32.dll"   Alias "LoadCursorA" (ByVal hInstance As INT, ByVal lpCursorName As Any) As INT
Declare Function _10GetModuleHandle       Lib "kernel32.dll" Alias "GetModuleHandleA" (int lpModuleName) as SYS
Declare Function _10CallWindowProc        Lib "user32.dll"   Alias "CallWindowProcA" (byval hProc as sys, ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProc         Lib "user32.dll"   Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10DefWindowProcCallBack Lib "user32.dll"   Alias "DefWindowProcA" (ByVal hWnd As INT, ByVal wMsg As INT, ByVal wParam As INT, ByVal lParam As INT) As INT
Declare Function _10GetSysColor           Lib "user32.dll"   Alias "GetSysColor" (ByVal nIndex As INT) As INT
Declare Function _10GetDialogBaseUnits    LIB "User32.dll"   ALIAS "GetDialogBaseUnits" () AS INT
Declare Function _10MulDiv                LIB "KERNEL32.DLL" ALIAS "MulDiv" (BYVAL nNumber AS INT, BYVAL nNumerator AS INT, BYVAL nDenominator AS INT) AS INT
Declare Function _10MapDialogRect         LIB "user32.DLL"   ALIAS "MapDialogRect" (ByVal hWnd As SYS, Byref RC AS _10RECT) AS SYS
Declare Function _10GetDesktopWindow      LIB "user32.DLL"   ALIAS "GetDesktopWindow" () AS SYS
Declare Function _10GetLastError          LIB "Kernel32.DLL" ALIAS "GetLastError" () AS SYS
Declare Function _10FormatMessage         LIB "Kernel32.dll" ALIAS "FormatMessageA" (BYVAL dwFlags AS DWORD, BYVAL lpSource AS DWORD, BYVAL dwMessageId AS DWORD, BYVAL dwLanguageId AS DWORD, lpBuffer AS ASCIIZ, BYVAL nSize AS DWORD, BYVAL Arguments AS DWORD) AS DWORD
DECLARE FUNCTION _10CreateDialogIParam    LIB "user32.dll"   ALIAS "CreateDialogIndirectParamA" (sys hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit) as sys
DECLARE SUB _10PostQuitMessage            LIB "User32.dll"   ALIAS "PostQuitMessage"
DECLARE SUB _10DestroyWindow              LIB "User32.dll"   ALIAS "DestroyWindow"
DECLARE FUNCTION _10GetDlgItem            LIB "User32.dll"   ALIAS "GetDlgItem" (BYVAL hDlg AS SYS, BYVAL nIDDlgItem AS sys) AS SYS

DECLARE FUNCTION _10SetProp               Lib "user32.dll"   Alias "SetPropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD, BYVAL hAddr AS DWORD) AS SYS
DECLARE FUNCTION _10GetProp               Lib "user32.dll"   Alias "GetPropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD) AS SYS
DECLARE FUNCTION _10RemoveProp            Lib "user32.dll"   Alias "RemovePropA" (ByVal hWnd As SYS, BYVAL lpString As DWORD) AS SYS

'DECLARE FUNCTION _10GetProcessHeap        Lib "kernel32.dll" Alias "GetProcessHeap" () As SYS
'DECLARE FUNCTION _10HeapAlloc             Lib "kernel32.dll" Alias "HeapAlloc" (ByVal hProc As DWORD, ByVal mMode As dword, byval mSize as DWORD) AS SYS
'DECLARE FUNCTION _10HeapFree              Lib "kernel32.dll" Alias "HeapFree" (ByVal hProc As DWORD, ByVal mMode As dword, byval hObj as DWORD) AS SYS

TYPE _10DLGTEMPLATE
   dword style
   dword eStyle
   word  cdit
   short x
   short y
   short cx
   short cy
END TYPE

    _10RECT _10RC
   
    sys _10LPPI = 0
    SYS _10HPPA = 0
    _10DLGTEMPLATE _10LPDT

    _10LPDT.style  = 2155872320
    _10LPDT.eStyle = 1
    _10LPDT.cdit   = 0
    _10LPDT.x      = 1
    _10LPDT.y      = 1
    _10LPDT.cx     = 2
    _10LPDT.cy     = 2

    ' Create a dummy dialog to retrieve dialog units.
    sys _10TODL = _10CreateDialogIParam(_10GetModuleHandle(0), @_10LPDT, _10HPPA, @_10DEFAULT_CALLBACK_PROC, _10LPPI)
   
    _10RC.right  = 1
    _10RC.bottom = 1       
   
    _10MapDialogRect(_10TODL, _10RC)  ' returns 0
   

TYPE _10WNDCLASSEX ' 32 bit headers for use with DIALOG NEW
    cbSize        as int
    Style         as int
    lpfnwndproc   as sys
    cbClsextra    as int
    cbWndExtra    as int
    hInstance     as int
    hIcon         as int
    hCursor       as int
    hbrBackground as int
    lpszMenuName  as int
    lpszClassName as int
    hIconSm       AS int
END TYPE

Declare Function _10RegisterClassEx     Lib "user32.dll"   Alias "RegisterClassExA" (byref lpwcx as _10WNDCLASSEX) as INT
   
    _10WNDCLASSEX _10WClass

    _10WClass.cbSize        = SizeOf(_10WNDCLASSEX)
    _10WClass.style         = 40
    _10WClass.lpfnWndProc   = &_10DefWindowProcCallBack
    _10WClass.hInstance     = _10GetModuleHandle(0) 
    _10WClass.hIcon         = _10LoadIcon(0, ByVal 32512)         'loads an icon for use by the program
    _10WClass.hCursor       = _10LoadCursor(0, ByVal 32512)       'loads a mouse cursor for use by the program
    _10WClass.hbrBackground = _10CreateSolidBrush(_10GetSysColor(15))
    _10WClass.lpszMenuName  = STRPTR("")
    _10WClass.lpszClassName = STRPTR("DDTDialog")
    _10WClass.hIConSm       = _10LoadIcon(0, ByVal 32512) 'loads an icon for use by the program

    Call _10RegisterClassEx(_10WClass)       'registers a window class for the program window   
   
    'print _10RC.right " - " _10RC.bottom
                         
Declare Function PluriBASICMessageBox  Lib "user32.dll" Alias "MessageBoxA"
TYPE _10MSG
   hwnd    as int
   message as int
   wParam  as int
   lParam  as int
   time    as dword
   'part of pointapi.
   X       as INT
   Y       as INT
END TYPE
Declare Function _10ShowWindow       Lib "user32.dll" Alias "ShowWindow" (ByVal hWnd As INT, ByVal nCmdShow As INT) As INT
Declare Function _10TranslateMessage Lib "user32.dll" Alias "TranslateMessage" (byref lpMsg as _10MSG) as INT
Declare Function _10DispatchMessage  Lib "user32.dll" Alias "DispatchMessageA" (byref lpMsg as _10MSG) as INT
Declare Function _10GetMessage       Lib "user32.dll" Alias "GetMessageA" (lpMsg As _10MSG, ByVal hWnd As INT, ByVal wMsgFilterMin As INT, ByVal wMsgFilterMax As INT) As INT
DECLARE FUNCTION _10IsWindow         LIB "USER32.DLL" ALIAS "IsWindow" (BYVAL hWnd AS DWORD) AS int
DECLARE FUNCTION _10SetWindowLong    LIB "USER32.DLL" ALIAS "SetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT, BYVAL lNewLong AS QUAD) AS INT
DECLARE FUNCTION _10SendMessage      LIB "USER32.DLL" ALIAS "SendMessageA" (BYVAL hWnd AS DWORD, BYVAL dwMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS INT) AS INT
DECLARE FUNCTION _10SetWindowLong LIB "USER32.DLL" ALIAS "SetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT, BYVAL lNewLong AS INT) AS INT
DECLARE FUNCTION _10GetWindowLong LIB "USER32.DLL" ALIAS "GetWindowLongA" (BYVAL hWnd AS DWORD, BYVAL nIndex AS INT) AS INT

TYPE _10HPROP
    long elem
    long dmode
    sys oldProc
    sys curProc
    'long user1
    'long user2   
END TYPE

Function _10DEFAULT_CALLBACK_PROC(sys hwnd, wMsg, wParam, lParam) as sys callback

    _10HPROP *hdata
    _10HPROP *hdat2
   
    sys retval = 0
    sys hWnd2  = 0
    CHAR dtt[10] = "DATA" + chr(0)
   
    @hData = _10GetProp(hwnd, byval @dtt)
   
    If @hData Then
        if hData.curProc then
            Select case wMsg
                case 273, 78
                    sys hControl = _10GetDlgItem(hwnd, loword(wParam))                   
                    @hdat2 = _10GetProp(hControl, byval @dtt)
                    if @hDat2 then
                        if hDat2.curProc then
                            retval = _10CallWindowProc(hDat2.curProc, hWnd, wMsg, wParam, lParam)
                            goto DoneWithNotifications
                        end if
                    end if               
            end select
            retval = _10CallWindowProc(hData.curProc, hWnd, wMsg, wParam, lParam)
            DoneWithNotifications:                               
        end if
    end if
   
    if retval=0 then ' Yes, destroying the object.
        if @hData then
            if hData.elem = 2 then
                IF hData.curProc=0 then
                    hWnd2 = _10GetParent(hWnd)               
                    @hdat2 = _10GetProp(hWnd2, byval @dtt)               
                    if @hdat2 then                   
                        if hdat2.curProc then
                            retval = _10CallWindowProc(hDat2.curProc, hWnd, wMsg, wParam, lParam)
                        end if
                    END IF
                END IF   
               
                if retval=0 then
                    retval = _10CallWindowProc(hData.oldProc, hWnd, wMsg, wParam, lParam)
                end if
               
            else
                retval = _10DefWindowProc(hwnd,wMsg,wParam,lParam)             
            end if
                   
            if wMsg=2 then ' WM_DESTROY     
                If hData.oldProc then
                    _10SetWindowLong(hWnd, -4, hData.oldProc)
                end if
                freememory(@hData)               
                _10RemoveProp(hWnd, byval @dtt)
               
            end if
        else
            retval = _10DefWindowProc(hwnd, wMsg, wParam, lParam)
        end if
    end if
   
    return retval
   
End Function


' STARTS PLURIBASIC_PREPARE.BIN
' This code is executed before anything else, if you want to do something after defining other things, see PLURIBASIC_INIT





' END OF PLURIBASIC_PREPARE.BIN
' STARTS PLURIBASIC_INIT.BIN
' This code is executed before anything else, if you want to do something before nything else, see PLURIBASIC_PREPARE
       
   
   
   

' END OF PLURIBASIC_INIT.BIN
' STARTS MSGBOX.BIN
FUNCTION MSGBOX(string sText, sys mOptions = 0, string sCaption = "PluriBASIC") AS LONG
   FUNCTION = PluriBASICMessageBox(0, sText, sCaption, mOptions)
END FUNCTION
' END OF MSGBOX.BIN
' STARTS DIALOGSHOW.BIN



Function DialogShow(BYVAL dMode AS LONG, BYVAL hDlg AS SYS, BYVAL hCallback AS DWORD, BYREF Result AS DWORD) AS LONG

    Dim wm as _10MSG
    dword rr = 0
   
    _10HPROP *hdata
    CHAR dtt[10] = "DATA" + chr(0)
       
    @hData = _10GetProp(hDlg, byval @dtt)
   
    If @hData Then
        hData.curProc = hCallback
    end if   
   
    If @hData Then
        hData.oldProc = _10GetWindowLong(hDlg, -4)
    end if
    _10SetWindowLong(hDlg, -4, @_10DEFAULT_CALLBACK_PROC)

    _10SendMessage(hDlg, 272, 0, 0)
   
    _10ShowWindow(hDlg, 5)
    _10ShowWindow(hDlg, 5) ' first one never works.   

    Result = 0
   
    if dMode = 1 then
        while _10GetMessage(wm,0,0,0)
            rr = _10TranslateMessage(wm)
            _10DispatchMessage(wm)           
            IF _10IsWindow(hDlg) = 0 THEN
                Result = rr
                EXIT DO
            end if
        Wend
    end if
   
end function
 
' END OF DIALOGSHOW.BIN
' STARTS DIALOGNEW.BIN
' STARTS CALLBACKDATA.BIN
' END OF CALLBACKDATA.BIN
' CONTINUES (1) DIALOGNEW.BIN

FUNCTION DialogNew(BYVAL dMode AS LONG, byval hParent AS DWORD, BYVAL sCaption AS STRING, BYREF Xt AS LONG, BYREF Yt AS LONG, BYVAL W AS LONG, BYVAL H AS LONG, BYVAL dStyle AS DWORD, BYVAL exStyle AS DWORD, BYREF Result AS DWORD) AS LONG

' Im clueless, dont ask me.
single ratioX = 1.58 
single ratioY = 1.82
'=========================

sys hFont = _10GetStockObject(17)

long DX = 0
long dy = 0
long dw = 0
long dH = 0 
 
SELECT CASE dMode
    case 0, 6 ' UNITS.
        dw = w * RatioX
        dh = h * RatioY       

        IF @Xt=0 THEN
            dx = (_10GetSystemMetrics(0)/2) - (dw/2)
        ELSE
            dx = Xt * RatioX
        END IF       
        if @Yt=0 then
            dy = (_10GetSystemMetrics(1)/2) - (dh/2)
        else
            dy = Yt * RatioY
        end if
         
    case 5    ' PIXELS           
        if @Xt=0 then
            DX = (_10GetSystemMetrics(0)/2) - (w/2)
        ELSE
            DX = Xt
        end if
        if @Yt=0 then
            dy = (_10GetSystemMetrics(1)/2) - (h/2)
        ELSE
            dy = Yt
        end if   
        dw = w
        Dh = h
       
    case 7    ' DPIAWARE
   
END SELECT

Result = _10CreateWindowEx(exStyle,_          'extended styles
                        "DDTDialog", _        'window class name
                        sCaption,_            'window caption
                        dStyle,_              'window style
                        DX, _                 'initial x position
                        dy, _                 'initial y position
                        dw, _                 'initial x size
                        DH, _                 'initial y size
                        hParent, _            'parent window handle
                        0, _                  'window menu handle
                        _10GetModuleHandle(0), _ 'program instance handle
                        0)                    'creation parameter
                       
  if Result then
      _10SendMessage(Result, 48, hFont, 0)     
      _10HPROP *hdata
      @hData = getmemory(SizeOf(_10HPROP))
      If @hData Then
         hData.elem  = 1
         hData.dMode = dMode
         CHAR dtt[10] = "DATA" + chr(0)
         _10SetProp(Result, byval @dtt, @hData)         
      end if
  end if                         

END FUNCTION


' END OF DIALOGNEW.BIN
' STARTS CONTROLADD.BIN

FUNCTION ControlAdd(string tControl, sys hParent, long cID, string sCaption, long X, Y, W, H, sys dStyle, sys exStyle, sys hCallback) AS sys

  int Result

  sys       hDC = _10GetDC(0)
  single ratioX = (_10GetDeviceCaps(hDC, 88) / 96)
  single ratioY = (_10GetDeviceCaps(hDC, 90) / 96)
 
  _10ReleaseDC(0, hDC)
 
  int dx        = (X * RatioX) * 1.53
  int dy        = (Y * RatioY) * 1.7
  int dW        = (W * RatioX) * 1.53
  int dH        = (H * RatioY) * 1.7

  sys defStyle = 1073741824 or 268435456         
  sys hFont     = _10GetStockObject(17)
 
  string tctrl = lcase(Ltrim(rtrim(tControl)))

  if tCtrl = "label" then
     tCtrl = "Static"

  elseif tCtrl = "textbox" then
     tCtrl = "Edit"     
 
  elseif tCtrl = "listview" then   
     tCtrl = "SysListView32"
     
  end if
 
  if dStyle = 0 then dStyle = defStyle
                                           
  Result = _10CreateWindowEx(exStyle,_   'extended styles
                          tCtrl,    _           'control class name
                          sCaption,_            'control caption
                          dStyle,_              'control style
                          DX, _                 'initial x position
                          DY, _                 'initial y position
                          DW, _                 'initial x size
                          DH, _                 'initial y size
                          hParent, _            'parent window handle
                          cID, _                'control ID
                          _10GetModuleHandle(0), _ 'program instance handle
                          0)                    'creation parameter

  if Result then
    sys hMsg = -4
      _10SendMessage(Result, 48, hFont, 0)     
      _10HPROP *hdata
      @hData = getmemory(SizeOf(_10HPROP)) ' _10HeapAlloc(_10GetProcessHeap(), 8, SizeOf(_10HPROP))
      If @hData Then
         hData.elem  = 2
         hData.oldProc = _10GetWindowLong(Result, -4)
         hData.curProc = hCallback
         CHAR dtt[10] = "DATA" + chr(0)               
         _10SetProp(Result, byval @dtt, @hData)         
      end if     
      _10SetWindowLong(Result, hMsg, @_10DEFAULT_CALLBACK_PROC)
  end if
 
  return Result                           

END FUNCTION

' END OF CONTROLADD.BIN

% WM_CREATE           = 1
% WM_COMMAND          = 273
% WM_INITDIALOG       = 272
% WS_CHILD            = 1073741824
% WS_VISIBLE          = 268435456
% WS_TABSTOP          = 65536
% MB_ICONEXCLAMATION  = 48
% IDC_BUTTON1         = 1001
% IDC_LABEL1          = 1002
% IDC_LISTVIEW        = 1003

' SYSTEM DECLARES FOR ARRAYS


DECLARE FUNCTION BUTTONPROC() AS LONG
DECLARE FUNCTION MAINPROC() AS LONG
DECLARE FUNCTION PBMAIN() AS LONG


' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG

END FUNCTION

FUNCTION BUTTONPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
   INT _05RETVAL = 0
   _10SYSERR Err
   INT _SC89 = cbMsg
   IF _SC89 = WM_COMMAND THEN
      INT _SC90 = loword(wParam)
      IF _SC90 = IDC_BUTTON1 THEN
         MSGBOX ("Over here!", MB_ICONEXCLAMATION)
      END IF
   END IF
   RETURN _05RETVAL
END FUNCTION

FUNCTION MAINPROC(sys cbhndl, uint cbMsg, sys wParam, sys lParam) as int callback
   INT _05RETVAL = 0
   _10SYSERR Err
   INT result
   INT _SC91 = cbMsg
   IF _SC91 = WM_CREATE THEN
   ELSEIF _SC91 = WM_INITDIALOG THEN
   ELSEIF _SC91 = WM_COMMAND THEN
      INT _SC92 = loword(wParam)
      IF _SC92 = IDC_BUTTON1 THEN
         MSGBOX ("You pushed me! I'm offended!", MB_ICONEXCLAMATION)
      END IF
   ELSE
   END IF
   RETURN _05RETVAL
END FUNCTION

FUNCTION PBMAIN() AS INT
   INT _05RETVAL = 0
   _10SYSERR Err
   DWORD hdlg
   INT result
   DialogNew(0, 0, "Hello World Compiled with " & "OxygenBASIC", byval 0, byval 0, 400, 400, 13565952 OR WS_VISIBLE, 0, hdlg)
   ControlAdd("button", hdlg, IDC_BUTTON1, "Don't push me", 5, 5, 80, 20, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, @BUTTONPROC)
   ControlAdd("label", hdlg, IDC_LABEL1, "Some label", 5, 35, 80, 20, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, 0)
   ControlAdd("listview", hdlg, IDC_LISTVIEW, "", 5, 50, 390, 300, WS_CHILD OR WS_VISIBLE OR WS_TABSTOP, byval 0, 0)
   DialogShow(1, hdlg, @MAINPROC, result)
END FUNCTION

PBMAIN() ' invoke entry point

Brian Alvarez

  • Full Member
  • ***
  • Posts: 218
    • PluriBASIC
Re: Unable to File Binary
« Reply #11 on: January 06, 2019, 07:36:12 AM »
 The stock functions contain a lot of conditional blocks of code, see attached image.
Sometimes a 32 bit pointr is enough, but for 64 bit applications sometimes 64 bit
declarations/strucs are required.