ObjReader Community
		SDK programming => 64-bit SDK programming => Topic started by: James Fuller on July 14, 2020, 12:12:59 pm
		
			
			- 
				Patrice,
 Can zTrace be used from a dll?
 If so would you show an example?
 
 Thank you and be safe,
 
 James
 
- 
				OF COURSE !!!
 
 long zTrace(IN WCHAR* sPtr) {
 long nRet = 0;
 static HMODULE hDll;
 if (hDll == 0) {
 if (sizeof(LONG_PTR) == 8) {
 hDll = LoadLibrary(L"zTrace64");
 }
 else {
 hDll = LoadLibrary(L"zTrace32");
 }
 }
 if (hDll) {
 long_proc(WCHAR*);
 static zProc hProc;
 if (hProc == 0) { hProc = (zProc)GetProcAddress(hDll, "zTrace"); }
 if (hProc) { nRet = hProc(sPtr); }
 }
 return nRet;
 }
- 
				Thank you but...
 missed a line:
 #define long_proc typedef long (__stdcall *zProc)
 
 I thought it might be different for a dll  but it is the same as the code I use for an exe.
 
 James
 
- 
				#define long_proc typedef long (__stdcall *zProc)
 
 Yes, there is no difference.
 
 The first purpose of zTrace was to help me to debug both WinLIFT.dll and GDImage.dll...
 
- 
				Patrice,
 It is the only debugging tool I use.
 One issue I have is setting up the create debug.txt file from the dll I my trying to debug as there is no real place to stop the output so I can click on the zTrace window. Any suggestions?
 
 James
- 
				James
 
 Sorry, i am unsure to understand what you mean by "there is no real place to stop the output so I can click on the zTrace window".
 
 What you can do is to display a messagebox before full completion, to give you a chance to read the debug content.
 Or you can use the zDebug option to create a zDebug.txt report.