Commit 8a91d071 authored by Ulrich Fröbe's avatar Ulrich Fröbe Committed by Alois SCHLOEGL
Browse files

bug fix: avoid crash when closing IgorPro8

parent f475425d
......@@ -146,7 +146,7 @@ telegraphed data but also for the flags (e.g. bIsConnected) and also the TimerI
#include "FP_MC700Tg.h" // sets MCTG_IGORMAINFRM: compile and link all code necessary for the MultiClamp telegraph connection
#pragma pack(4) // All structures are 4-byte-aligned for MCTG .
#pragma pack(2) // All structures are 2-byte-aligned for Igor Toolkit .
// SAME ORDER HERE IN '(*sFunc[])' AND IN xxxWinCustom.RC
......@@ -168,8 +168,8 @@ FUNC sFunc[] =
#pragma pack() // All structures are default-aligned
#pragma pack() // All structures were 4-byte-aligned for MCTG .
......@@ -657,7 +657,7 @@ void OnRequest( HWND hWnd, UINT nMC )
void OnBroadcast( HWND hWnd )
char sMsg[2000];
// LPARAM lparamSignalIDs;
// LPARAM lparamSignalIDs;
UINT uRetVal;
ASSERT(hWnd != NULL, "Window handle in OnBroadcast is NULL " );
......@@ -827,7 +827,11 @@ int ProcessTimerMsg( HWND hwnd, WPARAM TimerId ) //todo return TRUE,FALSE or br
// Search all ComPorts and search all possible devices up to MAX_MC700CHANS
// if only com port 1 is used in demo mode then searching com ports 2..4 is not necessary..
//sprintf( sMsg, "Info (FPulseCed.xop): No AxoPatch MultiClamp found, starting in demo mode. Trying to connect.... \r" );
sprintf( sMsg, "Info (FP_MC700Tg.xop): No AxoPatch MultiClamp found. \r" );
#ifdef _DEBUG
sprintf( sMsg, "Info FP_MC700Tg.xop (debug): No AxoPatch MultiClamp found. \r" );
sprintf(sMsg, "Info FP_MC700Tg.xop (release): No AxoPatch MultiClamp found. \r");
XOPNotice( sMsg );
return TRUE;
......@@ -25,9 +25,6 @@
#pragma pack(4) // all structures are 4-byte-aligned for MCTG.
......@@ -117,7 +114,6 @@ static void XOPEntry(void)
XOPMain( IORecHandle ioRecHandle )
// This is the initial entry point at which the host application calls XOP.
......@@ -125,13 +121,15 @@ XOPMain( IORecHandle ioRecHandle )
// main() does any necessary initialization and then sets the XOPEntry field of the
// ioRecHandle to the address to be called for future MessMages.
char sMsg[300];
#ifdef __MWERKS__
// For CodeWarrior 68K XOPs.
SetCurrentA4(); // Set up correct A4. This allows globals to work.
SendXOPA4ToIgor(ioRecHandle, GetA4()); // And communicate it to Igor.
// 2021-03-12 what is this? VC2015 complains in combination with Toolkit6, but is not mentionned in manual
//LoadXOPSegs(); // fr Funktionen
......@@ -142,13 +140,19 @@ XOPMain( IORecHandle ioRecHandle )
// char sMsg[200];
// SetXOPType((long)(RESIDENT | IDLES)); // Specify XOP to stick around and to receive IDLE messages.
gTheWindow = GetParent(IgorClientHWND() );
// Initialisation message is confusing for the user so it has been removed
//sprintf( sMsg, "FPulseCed.XOP (+MCTG)\tWITHOUT XOP WINDOW (#ifdef MCTG_IGORMAINFRM) IgorClientHWND:%08X>%08X (%s) \r", IgorClientHWND(), gTheWindow, CALLING_METHOD ? "direct" : "message" ); XOPNotice( sMsg );
// 2021-04-23 GetParent() a reasonable value in Igor637 but NULL in Igor8 which will finally crash Igor 8. GetAncestor() seems to work.
// gTheWindow = GetParent(IgorClientHWND()); // gWindow is a reasonable value in Igor637 but NULL in Igor8 (will crash)
gTheWindow = GetAncestor(IgorClientHWND(), GA_PARENT);//GA_PARENT, GA_ROOT and GA_ROOTOWNER: handles gTheWindow and IgorClientHWND() are same
if (gTheWindow == NULL) {
sprintf(sMsg, "*** FATAL ERROR *** while loading FP_Mc700Tg.xop (Axon MC7700 will not work) \r\tParent window handle is NULL IgorClientHWND:%08X -> gTheWindow:>%08X \r", IgorClientHWND(), gTheWindow); XOPNotice(sMsg);
// Initialisation message may be confusing to the user so it can be removed
sprintf(sMsg, "Loaded FP_Mc700Tg.xop (210421)\tWITHOUT XOP WINDOW (#ifdef MCTG_IGORMAINFRM) IgorClientHWND:%08X > %08X \r", IgorClientHWND(), gTheWindow); XOPNotice(sMsg);
// This hook is for the 'Registered' messages (Open, Close, Request, Broadcast, Reconnect, Id) and for WM_TIMER
gRegisteredMsgHook = SetWindowsHookEx( WH_GETMESSAGE, &GetMsgFirstProc,NULL,GetCurrentThreadId());
......@@ -168,14 +172,18 @@ XOPMain( IORecHandle ioRecHandle )
// Initialisation message to remind the programmer about the Release/Debug mode..
// Better: Remind earlier, remind while releasing and not at program start...
#ifdef _DEBUG
sprintf(sMsg, "Loaded FP_MC700Tg.xop (210421 debug)\r");
sprintf(sMsg, "Loaded FP_MC700Tg.xop (210421)\r");
SetXOPResult(0L);//0L);// test: -1 has no effect
#pragma pack() // All structures are 4-byte-aligned for MCTG.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment