The following `getRetCode` function runs normally in QM, but after generating the exe file, it fails to retrieve the text after #ret. Is this possible? What changes need to be made? Thanks in advance for any suggestions and help.
I noticed that the following code can use the text after #ret normally in the exe.
Macro Test
Function getRetCode
I noticed that the following code can use the text after #ret normally in the exe.
Macro Test
getRetCode("" &_s 1)
mes _s
;BEGIN PROJECT
;main_function Test
;exe_file $my qm$\Test.exe
;icon <default>
;manifest $qm$\default.exe.manifest
;flags 6
;guid {683DDF1D-6645-49E5-9124-A1CF5B4867B4}
;END PROJECT
#ret
using System;
class Program
{
,static void Main()
,{
,,// Get the operating system version information
,,OperatingSystem os = Environment.OSVersion;
,,// Output the operating system platform and version number
,,Console.WriteLine("Operating System Platform: " + os.Platform);
,,Console.WriteLine("Operating System Version: " + os.Version);
,,Console.WriteLine("Operating System Version String: " + os.VersionString);
,,// Get the service pack information
,,Console.WriteLine("Service Pack Version: " + os.ServicePack);
,}
}
Function getRetCode
function $Mac str&Code_ [_Context]
#opt nowarnings 1
opt noerrorshere 1
if(!Mac or (Mac>=0x10000 and !Mac[0]))
,int iid=+getopt(itemid -iif(_Context _Context 2))
else
,iid=qmitem(Mac 1); if(!iid) end ERR_MACRO
Code_.getmacro(iid)
int n i=findrx(Code_ "^#ret\b.*[]" 0 8 _i)
if i>=0
,i+_i-2
,Code_[i]=0; n=numlines(Code_)-1; Code_[i]=13
,Code_.replace(_s.all(n 2 10) 0 i)
else if 0=findrx(Code_ "^[ ;]*[/\\](?![/\*]).*[]" 0 0 _i)
,Code_.remove(0 _i-2)
Code_.trim