Jump to content

Free C++ Compiler


wolf9228
 Share

Recommended Posts

The code contains the command lines of the Free C ++ Compiler by simplifying the work on the Free C ++ Compiler via the Autoit script.
There are several examples of creating dll files, executable files, and also dll libraries
Initially, download the Free C ++ Compiler from its official website after Free registering with this link.

https://www.embarcadero.com/free-tools/ccompiler
Free C++ Compiler
The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
award-winning C++Builder product line.

some notes

For Bat.bat File All errors and notices appear on the Ms-dos data

The _wpopen function cannot show errors that the C++ Compiler application returns /// (BCC32C.exe) ///"

This also occurs on the Autoit StderrRead function

Thanks

Compiler.zip

yProject.cpp

#include <stdio.h>
#include <shlobj.h>

#ifdef __cplusplus
extern "C"
{
#endif
__declspec(dllexport) DWORD WINAPI Func(DWORD NumA,DWORD NumB);
#ifdef __cplusplus
}
#endif

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

DWORD WINAPI Func(DWORD NumA,DWORD NumB)
{
return (NumA + NumB);
}

Project.cpp

#include <windows.h>
#include <stdio.h>

HWND yButton;
LRESULT CALLBACK GuiProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);

static TCHAR szWindowClass[] = ("win32app");
static TCHAR szTitle[] = ("Gui Win32 Application");

HINSTANCE hInst;

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{

    WNDCLASSEX wcex;
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = GuiProc;
    wcex.cbClsExtra     = 0;
    wcex.cbWndExtra     = 0;
    wcex.hInstance      = hInstance;
    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
    wcex.lpszMenuName   = NULL;
    wcex.lpszClassName  = szWindowClass;
    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

RegisterClassEx(&wcex);

HWND hWnd = CreateWindow(szWindowClass,szTitle,WS_OVERLAPPEDWINDOW|WS_VISIBLE,0,0,200,200,0,0,hInstance,0);
yButton = CreateWindowEx(0,"Button","yButton",WS_TABSTOP|WS_CHILD|BS_NOTIFY|WS_VISIBLE,10,10,80,40,hWnd,0,hInstance,0);

MSG msg;
while (GetMessage(&msg,0,0,0))
{
if (!TranslateAccelerator(msg.hwnd,0,&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
     return 0;
}

LRESULT CALLBACK GuiProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
    switch (HIWORD(wParam))
    {
    case BN_CLICKED:
    if ((HWND) lParam == yButton)
    {
	MessageBox(0,"yButton","MSG",0);
    }
    break;
    }
    break;
    case WM_PAINT:
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}

yProject_Error.cpp

#include <windows.h>
#include <stdio.h>

// Here Error
Error

HWND yButton;
LRESULT CALLBACK GuiProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);

static TCHAR szWindowClass[] = ("win32app");
static TCHAR szTitle[] = ("Gui Win32 Application");

HINSTANCE hInst;

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine,
                   int nCmdShow)
{

    WNDCLASSEX wcex;
    wcex.cbSize = sizeof(WNDCLASSEX);
    wcex.style          = CS_HREDRAW | CS_VREDRAW;
    wcex.lpfnWndProc    = GuiProc;
    wcex.cbClsExtra     = 0;
    wcex.cbWndExtra     = 0;
    wcex.hInstance      = hInstance;
    wcex.hIcon          = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
    wcex.hCursor        = LoadCursor(NULL, IDC_ARROW);
    wcex.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
    wcex.lpszMenuName   = NULL;
    wcex.lpszClassName  = szWindowClass;
    wcex.hIconSm        = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));

RegisterClassEx(&wcex);

HWND hWnd = CreateWindow(szWindowClass,szTitle,WS_OVERLAPPEDWINDOW|WS_VISIBLE,0,0,200,200,0,0,hInstance,0);
yButton = CreateWindowEx(0,"Button","yButton",WS_TABSTOP|WS_CHILD|BS_NOTIFY|WS_VISIBLE,10,10,80,40,hWnd,0,hInstance,0);

MSG msg;
while (GetMessage(&msg,0,0,0))
{
if (!TranslateAccelerator(msg.hwnd,0,&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
     return 0;
}

LRESULT CALLBACK GuiProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
    switch (message)
    {
    case WM_COMMAND:
    switch (HIWORD(wParam))
    {
    case BN_CLICKED:
    if ((HWND) lParam == yButton)
    {
	MessageBox(0,"yButton","MSG",0);
    }
    break;
    }
    break;
    case WM_PAINT:
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}

Exe_Wthe_Bat.au3

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\Project.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 1 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)
$PFile = FileGetShortName($PFile)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile & @CRLF & "Pause"

if FileExists("Batch.bat") And Not FileDelete("Batch.bat") Then Exit

FileWrite("Batch.bat",$Command)

RunWait("Batch.bat")

if $VisualStyles Then

;Enabling Visual Styles
;https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview

$ManiText = _
'<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' & @CRLF & _
'<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">' & @CRLF & _
' <security>' & @CRLF & _
'    <requestedPrivileges>' & @CRLF & _
'    <requestedExecutionLevel level="asInvoker" uiAccess="false">'& @CRLF & _
'    </requestedExecutionLevel>' & @CRLF & _
'    </requestedPrivileges>' & @CRLF & _
' </security>' & @CRLF & _
' </trustInfo>' & @CRLF & _
' <dependency>' & @CRLF & _
' <dependentAssembly>' & @CRLF & _
'    <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"></assemblyIdentity>' & @CRLF & _
' </dependentAssembly>' & @CRLF & _
' </dependency>' & @CRLF & _
'</assembly>'

$RT_MANIFEST = 24
$vDataStruct = StringToDataStruct($ManiText)
$vlpData =  DllStructGetPtr($vDataStruct)
$vcbData = DllStructGetSize($vDataStruct)
UpdateResource($NewFile,$RT_MANIFEST,1,$vlpData,$vcbData)

EndIf

Sleep(300)
RunWait($NewFile)
ShellExecute($BCC102)

Func StringToDataStruct($Text)
$Len = StringLen($Text)
if $Len = 0 Then $Len = 1
$DataStruct = DllStructCreate("char[" & $Len & "]")
DllStructSetData($DataStruct,1,$Text)
Return $DataStruct
EndFunc

Func UpdateResource($Dll_Exe_File,$lpType,$lpName,$lpData,$cbData)

$Handle = DllCall("kernel32.dll","HANDLE","BeginUpdateResourceW","wstr",$Dll_Exe_File,"BOOL",False)
if @error Or $Handle[0] = 0 Then Return SetError(1,0,False)
$Handle = $Handle[0]

Select
Case IsString($lpType)
$DTypeA = "wstr"
$lpType = StringUpper($lpType)
Case Else
$DTypeA = "long"
$lpType = Int($lpType)
EndSelect

Select
Case IsString($lpName)
$DTypeB = "wstr"
$lpName = StringUpper($lpName)
Case Else
$DTypeB = "long"
$lpName = Int($lpName)
EndSelect

$BOOL = DllCall("kernel32.dll","BOOL","UpdateResourceW","HANDLE",$Handle,$DTypeA _
,$lpType,$DTypeB,$lpName,"WORD",0,"ptr",$lpData,"DWORD",$cbData)
if @error Or $BOOL[0] = 0 Then Return SetError(2,0,False)

$BOOL = DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
if @error Or $BOOL[0] = 0 Then Return SetError(3,0,False)

Return SetError(0,0,True)

EndFunc

Exe_Wthe_wpopen.au3

$MsvcrtDll = DllOpen("Msvcrt.Dll")

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\Project.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 1 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile

Local $Buffer = DllStructCreate("wchar[1024]") , $Text = ""
$Return = DllCall($MsvcrtDll,"ptr:cdecl","_wpopen","wstr",$Command,"wstr","rt")
if @error Or $Return[0] = 0 Then Exit
$pPipe = $Return[0]

while 1
$Return = DllCall($MsvcrtDll,"ptr:cdecl","fgetws","STRUCT*",$Buffer,"int",1024,"ptr",$pPipe)
$Text &= DllStructGetData($Buffer,1)
if Not $Return[0] Then ExitLoop
WEnd

MsgBox(0,"",$Text)

if $VisualStyles Then

;Enabling Visual Styles
;https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview

$ManiText = _
'<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' & @CRLF & _
'<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">' & @CRLF & _
' <security>' & @CRLF & _
'    <requestedPrivileges>' & @CRLF & _
'    <requestedExecutionLevel level="asInvoker" uiAccess="false">'& @CRLF & _
'    </requestedExecutionLevel>' & @CRLF & _
'    </requestedPrivileges>' & @CRLF & _
' </security>' & @CRLF & _
' </trustInfo>' & @CRLF & _
' <dependency>' & @CRLF & _
' <dependentAssembly>' & @CRLF & _
'    <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"></assemblyIdentity>' & @CRLF & _
' </dependentAssembly>' & @CRLF & _
' </dependency>' & @CRLF & _
'</assembly>'

$RT_MANIFEST = 24
$vDataStruct = StringToDataStruct($ManiText)
$vlpData =  DllStructGetPtr($vDataStruct)
$vcbData = DllStructGetSize($vDataStruct)
UpdateResource($NewFile,$RT_MANIFEST,1,$vlpData,$vcbData)

EndIf

Sleep(300)
RunWait($NewFile)
ShellExecute($BCC102)

Func StringToDataStruct($Text)
$Len = StringLen($Text)
if $Len = 0 Then $Len = 1
$DataStruct = DllStructCreate("char[" & $Len & "]")
DllStructSetData($DataStruct,1,$Text)
Return $DataStruct
EndFunc

Func UpdateResource($Dll_Exe_File,$lpType,$lpName,$lpData,$cbData)

$Handle = DllCall("kernel32.dll","HANDLE","BeginUpdateResourceW","wstr",$Dll_Exe_File,"BOOL",False)
if @error Or $Handle[0] = 0 Then Return SetError(1,0,False)
$Handle = $Handle[0]

Select
Case IsString($lpType)
$DTypeA = "wstr"
$lpType = StringUpper($lpType)
Case Else
$DTypeA = "long"
$lpType = Int($lpType)
EndSelect

Select
Case IsString($lpName)
$DTypeB = "wstr"
$lpName = StringUpper($lpName)
Case Else
$DTypeB = "long"
$lpName = Int($lpName)
EndSelect

$BOOL = DllCall("kernel32.dll","BOOL","UpdateResourceW","HANDLE",$Handle,$DTypeA _
,$lpType,$DTypeB,$lpName,"WORD",0,"ptr",$lpData,"DWORD",$cbData)
if @error Or $BOOL[0] = 0 Then Return SetError(2,0,False)

$BOOL = DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
if @error Or $BOOL[0] = 0 Then Return SetError(3,0,False)

Return SetError(0,0,True)

EndFunc

Dll_Wthe_Bat.au3

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\yProject.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 2 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)
$PFile = FileGetShortName($PFile)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile & @CRLF & "Pause"

if FileExists("Batch.bat") And Not FileDelete("Batch.bat") Then Exit

FileWrite("Batch.bat",$Command)

RunWait("Batch.bat")

if $VisualStyles Then

;Enabling Visual Styles
;https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview

$ManiText = _
'<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' & @CRLF & _
'<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">' & @CRLF & _
' <security>' & @CRLF & _
'    <requestedPrivileges>' & @CRLF & _
'    <requestedExecutionLevel level="asInvoker" uiAccess="false">'& @CRLF & _
'    </requestedExecutionLevel>' & @CRLF & _
'    </requestedPrivileges>' & @CRLF & _
' </security>' & @CRLF & _
' </trustInfo>' & @CRLF & _
' <dependency>' & @CRLF & _
' <dependentAssembly>' & @CRLF & _
'    <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"></assemblyIdentity>' & @CRLF & _
' </dependentAssembly>' & @CRLF & _
' </dependency>' & @CRLF & _
'</assembly>'

$RT_MANIFEST = 24
$vDataStruct = StringToDataStruct($ManiText)
$vlpData =  DllStructGetPtr($vDataStruct)
$vcbData = DllStructGetSize($vDataStruct)
UpdateResource($NewFile,$RT_MANIFEST,1,$vlpData,$vcbData)

EndIf

Sleep(300)
$Return = DllCall($NewFile,"DWORD","Func","DWORD",5,"DWORD",5)
MsgBox(0,"Func Call",$Return[0])
ShellExecute($BCC102)

Func StringToDataStruct($Text)
$Len = StringLen($Text)
if $Len = 0 Then $Len = 1
$DataStruct = DllStructCreate("char[" & $Len & "]")
DllStructSetData($DataStruct,1,$Text)
Return $DataStruct
EndFunc

Func UpdateResource($Dll_Exe_File,$lpType,$lpName,$lpData,$cbData)

$Handle = DllCall("kernel32.dll","HANDLE","BeginUpdateResourceW","wstr",$Dll_Exe_File,"BOOL",False)
if @error Or $Handle[0] = 0 Then Return SetError(1,0,False)
$Handle = $Handle[0]

Select
Case IsString($lpType)
$DTypeA = "wstr"
$lpType = StringUpper($lpType)
Case Else
$DTypeA = "long"
$lpType = Int($lpType)
EndSelect

Select
Case IsString($lpName)
$DTypeB = "wstr"
$lpName = StringUpper($lpName)
Case Else
$DTypeB = "long"
$lpName = Int($lpName)
EndSelect

$BOOL = DllCall("kernel32.dll","BOOL","UpdateResourceW","HANDLE",$Handle,$DTypeA _
,$lpType,$DTypeB,$lpName,"WORD",0,"ptr",$lpData,"DWORD",$cbData)
if @error Or $BOOL[0] = 0 Then Return SetError(2,0,False)

$BOOL = DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
if @error Or $BOOL[0] = 0 Then Return SetError(3,0,False)

Return SetError(0,0,True)

EndFunc

Dll_Wthe_wpopen.au3

$MsvcrtDll = DllOpen("Msvcrt.Dll")

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\yProject.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 2 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile

Local $Buffer = DllStructCreate("wchar[1024]") , $Text = ""
$Return = DllCall($MsvcrtDll,"ptr:cdecl","_wpopen","wstr",$Command,"wstr","rt")
if @error Or $Return[0] = 0 Then Exit
$pPipe = $Return[0]

while 1
$Return = DllCall($MsvcrtDll,"ptr:cdecl","fgetws","STRUCT*",$Buffer,"int",1024,"ptr",$pPipe)
$Text &= DllStructGetData($Buffer,1)
if Not $Return[0] Then ExitLoop
WEnd

MsgBox(0,"",$Text)

if $VisualStyles Then

;Enabling Visual Styles
;https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview

$ManiText = _
'<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">' & @CRLF & _
'<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">' & @CRLF & _
' <security>' & @CRLF & _
'    <requestedPrivileges>' & @CRLF & _
'    <requestedExecutionLevel level="asInvoker" uiAccess="false">'& @CRLF & _
'    </requestedExecutionLevel>' & @CRLF & _
'    </requestedPrivileges>' & @CRLF & _
' </security>' & @CRLF & _
' </trustInfo>' & @CRLF & _
' <dependency>' & @CRLF & _
' <dependentAssembly>' & @CRLF & _
'    <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df"></assemblyIdentity>' & @CRLF & _
' </dependentAssembly>' & @CRLF & _
' </dependency>' & @CRLF & _
'</assembly>'

$RT_MANIFEST = 24
$vDataStruct = StringToDataStruct($ManiText)
$vlpData =  DllStructGetPtr($vDataStruct)
$vcbData = DllStructGetSize($vDataStruct)
UpdateResource($NewFile,$RT_MANIFEST,1,$vlpData,$vcbData)

EndIf

Sleep(300)
$Return = DllCall($NewFile,"DWORD","Func","DWORD",5,"DWORD",5)
MsgBox(0,"Func Call",$Return[0])
ShellExecute($BCC102)

Func StringToDataStruct($Text)
$Len = StringLen($Text)
if $Len = 0 Then $Len = 1
$DataStruct = DllStructCreate("char[" & $Len & "]")
DllStructSetData($DataStruct,1,$Text)
Return $DataStruct
EndFunc

Func UpdateResource($Dll_Exe_File,$lpType,$lpName,$lpData,$cbData)

$Handle = DllCall("kernel32.dll","HANDLE","BeginUpdateResourceW","wstr",$Dll_Exe_File,"BOOL",False)
if @error Or $Handle[0] = 0 Then Return SetError(1,0,False)
$Handle = $Handle[0]

Select
Case IsString($lpType)
$DTypeA = "wstr"
$lpType = StringUpper($lpType)
Case Else
$DTypeA = "long"
$lpType = Int($lpType)
EndSelect

Select
Case IsString($lpName)
$DTypeB = "wstr"
$lpName = StringUpper($lpName)
Case Else
$DTypeB = "long"
$lpName = Int($lpName)
EndSelect

$BOOL = DllCall("kernel32.dll","BOOL","UpdateResourceW","HANDLE",$Handle,$DTypeA _
,$lpType,$DTypeB,$lpName,"WORD",0,"ptr",$lpData,"DWORD",$cbData)
if @error Or $BOOL[0] = 0 Then Return SetError(2,0,False)

$BOOL = DllCall("kernel32.dll","BOOL","EndUpdateResourceW","HANDLE",$Handle,"BOOL",False)
if @error Or $BOOL[0] = 0 Then Return SetError(3,0,False)

Return SetError(0,0,True)

EndFunc

Exe_Wthe_wpopen_Error.au3

$MsvcrtDll = DllOpen("Msvcrt.Dll")

;The _wpopen function cannot show errors that the C++ Compiler application returns /// (BCC32C.exe) ///"

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\yProject_Error.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 1 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

;The _wpopen function cannot show errors that the C++ Compiler application returns /// (BCC32C.exe) ///"

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile

Local $Buffer = DllStructCreate("wchar[1024]") , $Text = ""
$Return = DllCall($MsvcrtDll,"ptr:cdecl","_wpopen","wstr",$Command,"wstr","rt")
if @error Or $Return[0] = 0 Then Exit
$pPipe = $Return[0]

$Text = "Important note" & @CRLF & "The _wpopen function cannot show errors that the C++ Compiler " & @CRLF & _
"application returns /// (BCC32C.exe) ///" & @CRLF & @CRLF

while 1
$Return = DllCall($MsvcrtDll,"ptr:cdecl","fgetws","STRUCT*",$Buffer,"int",1024,"ptr",$pPipe)
$Text &= DllStructGetData($Buffer,1)
if Not $Return[0] Then ExitLoop
WEnd

MsgBox(0,"",$Text)

Exe_Wthe_Bat_Error.au3

;All errors and notices appear on the Ms-dos data

;https://www.embarcadero.com/free-tools/ccompiler
;Free C++ Compiler
;The BCC32C/BCC32X Compiler is the high performance foundation and core technology of Embarcadero's
;award-winning C++Builder product line.

;This free download of the C++ Compiler for C++Builder includes C11 language support, the Dinkumware STL
;(Standard Template Library) framework, and the complete Embarcadero C/C++ Runtime Library (RTL). In this
;free version, you’ll also find a number of C/C++ command line tools—such as the high-performance linker
;and resource compiler.

;The Free C++ Compiler download includes:

    ;Embarcadero C++ Compiler (bcc32c/bcc32x)
    ;Turbo Incremental Linker (tlink32)
    ;C++ Win32 Preprocessor (cpp32)
    ;Import Library utility—for creating import libraries from DLLs (implib)
    ;Librarian for symbol case-conversion, creating extended libraries and modifying page size (tlib)
    ;Other useful command-line utilities such as make, grep, and touch
    ;Includes the Embarcadero C/C++ Runtime Library, and the DinkumwareANSI/ISO Standard Template Library (STL)

;bcc32c-101-Berlin-screenshot

;C++Builder includes compilers for Win64, macOS, iOS, and Android. And, C++Builder also features a modern,
;high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform
;UI development. Learn more about RAD Studio on its product page.
;C++ is avilable in three editions - Free, Community or Pro/Enterprise/Architect.

Global $VisualStyles = True , $BCC102 = "D:\BCC102", $compExe = "bcc32c.exe" ; $compExe compiled Exe File Name
Global $PFile = $BCC102 & "\yProject_Error.cpp" ; C++ File
Global $NewFile = "NewFile" ; New Out File
Global $Exe_Dll = 1 ; /// 1 Exe File /// 2 Dll File // Else Numbers Choose One

Switch $Exe_Dll
Case 1
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
Case 2
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
Case Else
$Gui = GUICreate("compiled", 210 + 150, 80)
GUICtrlCreateLabel("Please Choose One!", 10, 10)
$Exe = GUICtrlCreateButton("Exe File", 10, 50, 100, 23)
$DLL = GUICtrlCreateButton("Dll File", 80 + 50, 50, 100, 23)
$Ext = GUICtrlCreateButton("Exit", 150 + 100, 50, 100, 23)
GUISetState()
While 1
$iMsg = GUIGetMsg()
Select
Case $iMsg = $Exe
$FType = ".exe "
$TCod = " -tW " ; Exe File Command
ExitLoop
Case $iMsg = $DLL
$FType = ".dll "
$TCod = " -tWD " ; Dll File Command
ExitLoop
Case $iMsg = -3 Or $iMsg = $Ext ; $GUI_EVENT_CLOSE = -3
Exit
EndSelect
WEnd
GUIDelete($Gui)
EndSwitch

;All errors and notices appear on the Ms-dos data

$Dir = @ScriptDir
$yCompiled_File = $BCC102 & "\Bin\" & $compExe

if Not FileExists($yCompiled_File) Then $BCC102 = FileSelectFolder("Choose BCC102","C:\")
if @error Then Exit
if Not FileExists($PFile) Then $PFile = FileOpenDialog("Choose C++ File",$Dir,"(*.cpp)",5)
if @error Then Exit

$NewFile &= $FType
FileChangeDir($BCC102)
$PFile = FileGetShortName($PFile)

$Command = "Bin\" & $compExe & $TCod & "-IInclude -LLib -e" & $NewFile & $PFile & @CRLF & "Pause"

if FileExists("Batch.bat") And Not FileDelete("Batch.bat") Then Exit

FileWrite("Batch.bat",$Command)

RunWait("Batch.bat") ;All errors and notices appear on the Ms-dos data

 

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...