|
Hi
While launching a MFC application(.exe) as OLE server, some time CWinApp::OnFileNew() gets failed; due to this frame window cannot be created and handle to the main window (m_pMainWnd) becomes NULL and error message "Error occurs in mfc42.dll" appeared.
At windows XP, CWinApp::OnFileNew() failed in 1 out of 100 times.
We have not implemented the OnFileNew() in our application; we are using default implementation of OnFileNew().
As per MSDN CWinApp::OnFileNew implements this command differently depending on the number of document templates in the application. If there is only one CDocTemplate, CWinApp::OnFileNew will create a new document of that type, as well as the proper frame and view class.
Problem occurs only at one system and frequency is one out of 100 and error message "Error occurs in mfc42.dll" appeared.
Thank You
Ashish Kumar verma
Software Engineer(VC++)
|
|
|
|
|
From your information it is rather impossible to guess what is wrong. But I will give you some notes that may help you to find the problem or enhance your question:
"Error occurs in mfc42.dll" seems to be an application specific error message (googling the exact term gives only a few results). So you should be able to locate the executed source sections before the error occurs.
Even when using the default implementation of OnFileNew() , virtual functions of your document class are involved. In this case I would especially check OnNewDocument() . When this returns FALSE , creation of the document and frame window will be stopped (see the MFC sources for CSingleDocTemplate::OpenDocumentFile() ).
|
|
|
|
|
I ran into a small problem using Visual Studio 2012 Update 1.
Any MFC dialog that has controls with icons or bitmaps does not show the graphics if it is the first one in z-order. The following controls are displayed correctly.
A simple way to demonstrate this bogus behavior is to generate a dialog application with a couple of MFC EditBrowse Controls (but you could use MFC Buttons with icons as well). You can arbitratily change the z-order of the controls with the result that the icon does not display for the first one (preview is ok but not the compiled application).
I don't know whether this problem occurs in other versions of VS or if I have overlooked something important like proper initialization.
A simple way to get around this problem is to add a control with a picture at z-order 1 and make it invisible such that subsequent controls are not affected.
Has anybody dealt with this before?
_jg_
|
|
|
|
|
Hi, I am a novice in programming on RTOS.
I have a question about the task function design. For example, the system tick is 10ms,
if one task can't finish a loop within 10 ms (do one function in one loop), then how can I guanrantee the funciton's run time?
I mean, the time it start, and the time it stop?
|
|
|
|
|
Your question is pretty valgue as there are a lot of RTOS's out there. A guess, is to put the function in its own thread and make the thread a higher priority than all others so it would not be preempted. Prioritization can be a tricky business though.
|
|
|
|
|
Not being sarcastic, but check out this article on Wikipedia: http://en.wikipedia.org/wiki/Real-time_operating_system[^]
HOW the RTOS you are using schedules threads is very important. Many (most?) RTOSs can't actually guarantee a function's run time; they simply run fast enough that with proper programming you can get close enough. Something that takes over 10ms will almost always fall into this latter category since writing a function to use such an exact amount of time is essentially impossible (hardware interrupts alone on embedded system will add enough variance to cause a measurable difference in timings.)
(Here's a good article on RTOS interrupt scheduling: http://rtos.com/articles/18835[^])
modified 7-Jan-13 16:37pm.
|
|
|
|
|
Hey guys, quick question...
I am working with treeview in win32 (VC++).
I want to remove selection facility provided for treeview. Can anyone tell what window message is posted onAfterSelect Event of tree view.
PS:- List also has checkboxes. So disabling mouse click isn't an option...
Thanks in advance...
-
Varun
|
|
|
|
|
|
Hi,I want to hide a column of my listctrl,and In my program never show,like delete,but It should not be delete,how to do with it,I set it's column width 0,but when I drag the column,It will show.
|
|
|
|
|
You should be able to get what you want from this[^] sample.
|
|
|
|
|
|
Luca D'Amico wrote: I hope that somebody can point me to the right direction. The only thing I can think of is this.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
|
|
Thanks a lot mates 
|
|
|
|
|
I have a function which return an std::vector<T>
it is quite big and moved around a lot and kept for a long time, so I put it into a
std::shared_ptr<std::vector<T>>
Now I need to access the vector as an array
with
std::vector<T> a;
I can write
T* pa = &a[0];
But this doesn't work with a std::shared_ptr<std::vector<T>>
What can I do?
Remark
Why don't I just pass it by reference around?
Well, it is created in a function, and then it is captured by a lambda that is spawn regularly into a task (i.e. in another thread) which would be the only reference left.
And I want to avoid copying the vector (it is big) and destructing when it goes out of scope, I want to create it only once and reuse it / keep it alive!...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Super Lloyd wrote: Now I need to access the vector as an array What's wrong with it?
e.g.
shared_prt<vector<int>> p(new vector<int>{1,2,3,4});
cout << (*p)[2] << endl;
Veni, vidi, vici.
|
|
|
|
|
Nothing, just me struggling with the syntax...
But thanks for your tip, it works indeed!!!
So simple! Could I add in hindsight! ^^
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I use some ATL functions to create a Media control. But, it seems that I can only use Dynamic link to ATL option, when I switch to Static link to ATL. I just can't create the control successfully.
I'm so confused. Anyone can help me?
#include <wmp.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlhost.h>
#include <atlctl.h>
CAxWindow m_wndView; m_spWMPPlayer;
CComPtr<IAxWinHostWindow> spHost;
HRESULT hr;
m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
if(!SUCCEEDED(hr)) return FALSE;
hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
if(!SUCCEEDED(hr)) return FALSE;
hr = m_wndView.QueryControl(&m_spWMPPlayer);
if(!SUCCEEDED(hr)) return FALSE;
|
|
|
|
|
You need to look at the actual error code value when you get a FAIL result, in order to see why it has failed.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi,when I Write files ,I want a carton show to let user know a data is performing.
I want to use a work thread in background to writing file,when the file finish ,it may be send a message to main window destroy the carton,but I dont't know how to do it ,please help me
|
|
|
|
|
Use an event. With MFC, check out CEvent . I talk about this briefly in this article.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Use PostMessage()[^].... make sure you know how to catch the message on your receiving window as well. MSDN usually has good tutorials. It's easier if you're using MFC since the message map is easily defined.
|
|
|
|
|
|
Hi,
cherry729 wrote: I want to use a work thread in background to writing file,when the file finish ,it may be send a message to main window destroy the carton,but I dont't know how to do it ,please help me
If you want to save some time and avoid re-inventing the wheel then you might be interested in using the old Animation Window class[^]. If you are using the MFC library... this basic window class is represented in the CAnimateCtrl Class[^]. You can open, start, stop and pause the animation by simply sending window messages from any thread in your application.
Best Wishes,
-David Delaune
|
|
|
|