Solved

Troubleshooting with converting code from WIN NT to WIN 2000

Posted on 2002-07-02
4
162 Views
Last Modified: 2013-12-03
Hi
My name is Avishay abahel, and I m software engineer from Israel.

My question:
I m trying to run a software (contains com objects and multithreaded) which were written in WIN NT, on Windows 2000.
When I m run it with within the msdev(by pressing the F5 key), it’s running.
But, if I m trying to run the executable file, it fails in mode debug and release as follow:
1.     Mode debug: I m using the “MsgWaitForMultipleObjects” API function which I pass it an array of handles I have created. The ret code from this function is ok when it receives messages from the queue. But for the handles array the ret code is –1. I used the “GetLastError” function to figure out what is the problem and the message was: “Handle is invalid”. My question is: why the handle is valid when I m run the software through the msdev environment and invalid if I run the executable file from the explorer.
2.     Release mode: I have exception immediately after I m using the “PostThreadMessage” function.

Thanks for your help!
0
Comment
Question by:Avishaya
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7124419
One (or more) of your handles being passed to WaitForMultipleObjects() is probably NOT getting initialized.  You realize, I hope, that in DEBUG mode, there is really no such thing as an unititialized variable since the DEBUG library initializes everything for its own purposes.

So when you run DEBUG code OUTSIDE the debugger, you never get a truly uninitialized pointer or handle.  In RELEASE mode, you do and you get a crash.

Check the SOURCE of ALL of your HANDLES passed to WaitFor... and find out which one or ones you are neglecting to init.  That should do it...
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10786971
PAQed - no points refunded (of 50)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now