110,536
社区成员
发帖
与我相关
我的任务
分享
long test()
{
return 0;
}
long test()
{
__asm {
//xor eax, eax;
//xor ebx, ebx;
//xor ecx, ecx;
xor edx, edx;
}
return 0;
}
}
/// <summary>
/// 加载prg文件.
/// </summary>
/// <param name="handle">指向PG_HANDLE结构的指针,从PG_LoadSpecCode获得</param>
/// <param name="path">*.prg文件的路径</param>
/// <returns>if ok, 0; else if -9: speccode未加载; else -1;</returns>
/// <remarks>使用前,应该先调用PG_LoadSpecCode,获取对应的handle</remarks>
[DllImport("Prog32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public static extern long PG_LoadItemCode(IntPtr handle, string path);
使用:
private void btnLoad_Click(object sender, EventArgs e)
{
ptrSpec = Prog32DllAPI.PG_LoadSpecCode(strSpecPath);
Msg(ptrSpec.ToString());
long ret = Prog32DllAPI.PG_LoadItemCode(ptrSpec, strPrgPath);
Msg(ret.ToString());
switch (ret)
{
case 0:
Msg("Read " + strPrgPath + " OK!");
break;
case -1:
Msg("Failed to load" + strPrgPath + "!");
break;
case -9:
Msg("Speccode not loaded!");
break;
}
}