I am trying to use an MSMQ internal transaction in a call to MQReceiveMessage and at compile time am getting the following errors:
filename.cpp(600) : error C2027: use of undefined type 'ITransaction'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\mq.h(26) : see declaration of 'ITransaction'
filename.cpp(600) : error C2227: left of '->Release' must point to class/struct/union
Error executing cl.exe.
Creating browse info file...
The code I have (which for the most part came directly off the MSDN website's MSMQ examples page) looks as follows:
ITransaction *pTransaction; // Pointer to transaction object
// Initiate an internal transaction.
hr = MQBeginTransaction(&pTransaction);
hr = MQReceiveMessage(
pLinkUserData->hQueue, // Queue handle
pLinkUserData->receiveTimeout, // Max time to (msec) to receive the message
pLinkUserData->receiveAction, // Receive action
&msgprops, // Message property structure
NULL, // No OVERLAPPED structure
NULL, // No callback function
pLinkUserData->hCursor, // No cursor handle
pTransaction // Join in a transaction
pTransaction->Release(); // <--- line 600 where the errors are being generated upon compilation.
Based on the errors I am getting my suspicion is that I may have the wrong version of MQ.H although I recently went through the painful experience of downloading and installing the entire latest windows SDK kit for a related reason in which MQReceiveMessageByLookupId was not declared in the MQ.H I previously had.
My point is that I believe I have the latest version of MQ.H at this point and am still getting the errors outlined above.. has anyone seen this and know how I can get past this problem? if I am doing something wrong Please let me know, if this is yet another MQ.H versioning problem, then the joy I am having just can't be measured...! Btw, I am on Windows XP Pro running MSMQ 3.0
PS: I have cross-posted this question in the Windows Programming topic area.