Thanks for the reply.

I have a Zorro S license. I am able to compile and run the Process.c program from NotePad++, I can get the zOpen api to work in C program when editing and running in Zorro GUI, but not a C++ program when editing and running from visual studio.
.
I think the zInit call is running fine, otherwise, the application would print a different error message.

Code
	if(!zInit(2,sizeof(int))) {
		printf("Can't initialize communication!"); return EXIT_FAILURE;
	}


The problem happens when I tried to build the ZorroControl cpp program. Here is the code I used. The program prints "handle=00000000"

The zInit, zData and zClose API seems to work fine. but zOpen returns 0 in the C++ program.

Code
#include "stdafx.h"
#include "ZorroControl.h"

int _tmain(int argc, _TCHAR* argv[])
{
// open ZorroControl.dll and get its function pointers
	HINSTANCE H = LoadLibrary(TEXT("ZorroControl.dll"));
	if(!H) {
		printf("Can't mount ZorroControl.dll!"); return EXIT_FAILURE;
	}
	_zInit zInit = (_zInit)GetProcAddress(H,"zInit");
	_zOpen zOpen = (_zOpen)GetProcAddress(H,"zOpen");
	_zClose zClose = (_zClose)GetProcAddress(H,"zClose");
	_zStatus zStatus = (_zStatus)GetProcAddress(H,"zStatus");
	_zData zData = (_zData)GetProcAddress(H,"zData");

// initialize process communication
	if(!zInit(2,sizeof(int))) {
		printf("Can't initialize communication!"); return EXIT_FAILURE;
	}

// get and clear the data area
	int* Info = (int*)zData(1);
	*Info = 0; 

	HANDLE open = zOpen(2, "-w 320");
	printf("handle=%p\n", open);

	// display it and quit
	printf("Zorro returned %i\n",*Info);

	zClose(2);

	Sleep(1000);
	return EXIT_SUCCESS;
}



Perhaps I'm missing something trivial. Is it related to how I loaded the ZorroControl.dll in C++ program? That seems to be the only difference between the Process.C and ZorroControl.



Attached Files zorrocontrol.PNG
Last edited by hanw; 06/01/21 09:12.