|
Joe Woodbury wrote:
(BTW, I had to recently work in VS 6 after a nine month absence and hated it.)
Well, I would dislike to go back to VC6, MFC 7.1 is a large improvement, a lot of things work better and cleaner.
But I'm thinking that with some work one could integrate everything in the good old environment. (sounds like christmas is saved)
dirk
|
|
|
|
|
Hehehe, it also happened to me, i went out and spend big bucks on .NET, only to get so frustrated and disapointed by it that i put it back on its box, stored it in the "Never to be used again" section of my closet, and went back to VC6.
Without trying to start a huge devate here, it is my opinion that VC.NET´s IDE is a total piece of junk!. I mean, i dont know whats with microsoft recently, they have allways been greedy, and have overly expensive products, but at least the USED TO be of relatively good quality, now most their products are junk!
If i were you, id go back to VC6. but like i said before, Its only my opinion.
|
|
|
|
|
Well, I can see that is a lot easier to integrate everything in one environment, that looks and acts the same in VC++ and VB. But I ever disliked that VB property pages, where you have access to all and everything, but that hides the things you need and frequently use in a pile of clutter. Sometimes I feel like looking for a needle in a haystack. And then, i can deal better with a style ES_READONLY than setting something called 'read only' to false.
VC6 was not that 'one size fits all' aproach we see here
dirk
|
|
|
|
|
Hang in there!
I have not gotten the lastest and greatest from MS yet and I am not sure I want it. One thing I do know is that when I first got my hands on VC6 it drove be up the wall. Just like the operating systems that come out of MS, the development tools change in mysterious ways. Once you know how it works though you will probably never want to go back.
INTP
|
|
|
|
|
I have found many examples on how to build up a Word document. I would like to parse an Word document and extract the document content and structure. (Not the on tables, then on sections, then on paragraph). The ultimate would be the MSDN "Word2XML" project in MFC!
|
|
|
|
|
Hi, I am having an issue trying to post data using the serverxmlhttp interface. Here is a brief overview:
I am collecting data and automatically sending this data back to central repository. Currently, ftp and smtp protocols perform as expected. HTTP is another story. I have a microsoft service running that kicks of the 'transmitter' when there is enough data to send. That service is running with an administrator account (not THE administrator, but a created user with administrative privaledges.) Anyway, when this service kicks off and creates the COM component that actually does the transmissions, my http transmission portion returns a "Access denied" error. If I run the COM component from an executable, however, the transmission succeeds.
I thought that this was an inheritable rights type problem dealing with the service, however, I have redesigned the system and am now having a server component create and launch the COM transmitter. I still am having the same issue.
Any help would be greatly appreciated. Thanks
dman
|
|
|
|
|
Hi I have an array declared in function:
char test[3][10];
How do I return this whole 2 dimensional array from a function??
Thanks.
|
|
|
|
|
|
Just like you would any other pointer. Make sure that the array is either global, or a static variable. Otherwise, when the function goes out of scope, the variable is no longer valid. If the array is global, there really is no need for a function to return it, as all other functions would have access to it anyway.
Read here for more.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
public:
CImageList images;
...
images.Create (IDB_SYMBOLS, 16, 0, RGB (192, 192, 192));
...
...
for(i=0;i
|
|
|
|
|
Do you mean that you run this code for extended period of time?
If you do this 1000's of times, you will get 1000's of resource leaks.
You need to release the HICON resources aftre you have finished with them.
DestroyIcon(hIcon);
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
HICON nIcon;
nIcon=images.ExtractIcon(0);
if(!nIcon) AfxMessageBox("Icon NULL");
Bitmap bp(nIcon); //Bitmap is GDI+ class
graphics->DrawImage(&bp,(float)x1-8.0f,(float)y1-8.0f,16.0f,16.0f);
delete &bp;
DestroyIcon(nIcon);
Upwords code,memory leak out,all the same .why?
Thanks,I'm the Anonymous member just now.
VC/MFC fans.
|
|
|
|
|
I have not used the GDI+ classes before, but do you need to have the delete &bp line, as this looks like your trying to delete a pointer to an object on the stack?
The only thing I would check in the documentation is that constructing a Bitmap will call the delevant HBITMAP desroy function in the ~Bitmap() function. It probably does that if the guys/gals who wrote the GDI+ library knew their stuff.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
What did images.Create(...) return?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
public:
CImageList images;
BOOL m_i;
...
m_i=images.Create (IDB_SYMBOLS, 16, 0, RGB (192, 192, 192));
...
for(i=0;i<n;i++)
{
if(!m_i)="" break;="" but="" m_i="=TRUE
" hicon="" nicon;
="" nicon="images.ExtractIcon(0);
" if(!nicon)="" afxmessagebox("icon="" null");
="" bitmap="" bp(nicon);="" is="" gdi+="" class
="" graphics-="">DrawImage(&bp,(float)x1-8.0f,(float)y1-8.0f,16.0f,16.0f);
delete &bp;
DestroyIcon(nIcon);
}
//m_i==TRUE
Upwords code,memory leak out,all the same .why?
Thanks for your help!
VC/MFC fans.
|
|
|
|
|
There is no reason to check m_i each iteration through the for loop.
I suggest setting a breakpoint on the ExtractIcon() statement and step into it to see why it is returning NULL .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I'm writing a multi-threaded serial port program, that requires the implementation of a highly precise timer routine (around 3ms accuracy). To do this I create a worker thread which sleeps for 3ms (this is actually based upon the code from an article on windows timers from this site), processes a small amount of data and then posts a message on the windows message queue using PostMessage. The problem is when I do this I get an Access Violation.
All my related variables are stored on the heap and the handle I'm using is definately valid. I do a similar thing in each of the serial reader threads without any problem, so what am I doing wrong.
Now, I'm not brilliant at C++, particularly on a Windows platform, so please go easy on me, as it's probably something really obvious and stupid.
Here's a fragment of my timer code:
DWORD WINAPI TimerFunction(void* pParam)<br />
{<br />
CThreadTimer* obj = (CThreadTimer*) pParam;<br />
BOOLEAN isActive = TRUE;<br />
do<br />
{<br />
Sleep(obj->elapse);<br />
<br />
EnterCriticalSection(&obj->lock);<br />
isActive = obj->isActive;<br />
LeaveCriticalSection(&obj->lock);<br />
if(isActive){<br />
CTimerRoutines* ctr = (CTimerRoutines*) obj->object;<br />
if(ctr->TimerHandler())<br />
PostMessage(obj->ghMsgWnd, UM_TRIGEVENT, (WPARAM) NULL, (LPARAM) NULL);<br />
}<br />
} while ( isActive );<br />
<br />
return 0;<br />
}<br />
CTimerRoutines contains my data handling routines, but the problem lies somewhere in the PostMessage call.
Any help appreciated.
|
|
|
|
|
Solution is logically sound.
Add breakpoins before and after the call to PostMessage(). What causes the error?
Make sure the program passes in a valid handle to CTimerRoutines structure at the creation point of the thread. Post that code.
Kuphryn
|
|
|
|
|
I have inserted breakpoints in my code and can happily step through it without problem. Even the PostMessage command executes without incident right up to the point when the main thread (with the message queue) continues execution and then I get my Access Violation.
The thread setup code looks like this:
UINT CThreadTimer::SetTimer (void* obj, UINT nIDEvent, UINT uElapse, ThreadTimerProc lpTimerProc)<br />
{<br />
object = obj;<br />
idEvent = nIDEvent;<br />
elapse = uElapse;<br />
proc = lpTimerProc;<br />
<br />
EnterCriticalSection(&lock);<br />
if (isActive)<br />
{<br />
LeaveCriticalSection(&lock);<br />
return 0;<br />
}<br />
<br />
DWORD threadId; <br />
HANDLE threadHandle = CreateThread (NULL, 0, TimerFunction, this, 0, &threadId); <br />
SetThreadPriority(threadHandle,THREAD_PRIORITY_TIME_CRITICAL);<br />
isActive = TRUE;<br />
LeaveCriticalSection(&lock);<br />
return nIDEvent;<br />
}<br />
Note that the setup routine resides within a class called CThreadTimer, and a reference to this class is passed to the main thread routine. This hasn't caused me any problems before.
Any ideas?
|
|
|
|
|
One question... The Sleep() function is not from the Windows API, is it? Because there is no way you will 3ms with any accuracy with that. See this[^] for the reason.
John
|
|
|
|
|
John M. Drescher wrote:
The Sleep() function is not from the Windows API, is it?
It is part of the platform SDK.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I know. My point is if he/she is using that one a 3ms delay is impossble.
John
|
|
|
|
|
The Sleep() function is from the Windows API and tends to be highly accurate particularly when runs from a thread operating at a Real-time priority level.
I have read the article you refer to and was also under that impression, but when I actually tested the system using this method with the HighPerformance counter function I found that the Sleep() function operated reliably down to 1ms and returned virtually immediately.
When I loaded the system down by performing a lot of highly computational programs, the accuracy deminished to 1.1ms - 0.1ms of delay was added due to system overhead.
(I am however running on a 2GHz Celeron system under XP Pro, maybe that's make a significant difference)
|
|
|
|
|
Thanks for the info. I have not tested this recently but with previous operating systems this information was correct. MS must have changed the implementation in XP.
John
|
|
|
|
|
PostMessage should not give you an access violation, no matter what parameters you pass so the problem must be with obj.
John
|
|
|
|