Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#Resource RcData, 9999, "test.bas" '<---- put name of source code file here
Global hDlg As Dword
%IDC_Button = 500
Function PBMain() As Long
Dialog New Pixels, 0, "gbCodeInside",300,300,200,100, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Get Source Code", 40,30,125,25
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = %IDC_Button And Cb.CtlMsg = %BN_Clicked Then ExtractSourceCode
End Function
Sub ExtractSourceCode
Local fName$, temp$
fName$ = LCase$(EXE.Full$)
Replace ".exe" With ".bas" In fName$
temp$ = Resource$(RcData,9999)
Open fName$ + ".bak" For Output As #1 '<--- .bak just so I won't override existing *.bas, if it exists
Print #1, temp$
Close #1
End Sub
'gbs_00738
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm