|
I compiled a large subset of the code you supplied in gcc 4.0.1 and found the following issues:
- In the Task constructor, you attempt to convert a const pointer to a non-const pointer - that's a no-no.
- In TaskQueue.h, you effectively have two forward declarations of MessageHandler (one in TaskQueue.h, one from #including Tasks.h) - that's not allowed, so remove the one in TaskQueue.h - you always #include Tasks.h, so you know you'll have the forward declaration from there.
- Again, in TaskQueue::setMessageHandler, you are converting a const pointer to a non-const pointer
- You forward declared MessageHandler in TaskQueue.h - therefore, you do not know what methods MessageHandler has, so you can't call them in the header (as you've done in TaskQueue::doSomething). You can only call them after you've got a complete declaration of MessageHandler (i.e. in a TaskQueue.C, after you've #included MessageHandler.h)
- You use '&this' in the MessageHandler constructor - this will give a MessageHandler**, as 'this' is a MessageHandler*
- Your Task class isn't terminated with a semi-colon. This *can* cause torrents of incomprehensible error messages...
Fix them and I suspect your compilation problems may go away.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You guys are awesome! thanks! Now I finally have a better understanding of the #include structure and forward declarations! Thanks!!!
|
|
|
|
|
Hi All,
I'm trying to create a new dialog in my .rc resource file and then create a C++ object using it. As far as I can tell, I'm doing it the same way that other dialogs have been implemented in this large legacy VC++ version 2.0 project, but I get
error C2065: 'WMM_DOOR_CONTROLS' : undeclared identifier
upon compiling the file that tries to create the object, from the following line:
WMMAuxIOSelectDial AuxIOCtrl (this, WMM_DOOR_CONTROLS);
As far as I can tell, the only place this identifier is declared is with the resource in the resource file; that is the only place the other dialogs' ids are found.
Obviously, there is a lot I don't know. Is there some kind of initial build step that I need to run to process the .rc file so that the identifier will be found in a generated file?
This line is in a file that hasn't had any other dialogs yet. Is there something else that needs to be added?
Do I need a .dlg file, as well, for this resource?
This is non-MFC, using SDK calls only.
I've tried a lot of small stuff with which I don't want to belabor this post, and I've done a lot of web searching, however I'm hoping there's something easy that I don't know about that I can try, and I haven't thoroughly searched all the MSDN and usenet posts, but I have put in about twelve hours of banging my head against this and I'll continue to search while awaiting any replies.
Much thanks for any help you can give me.
Here is my resource declaration:
---------------------
WMM_DOOR_CONTROLS DIALOG DISCARDABLE 200, 10, 162, 138
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Door Controls"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",-1,"Static",SS_BLACKFRAME | WS_GROUP,10,9,141,97
PUSHBUTTON "&Cancel",IDCANCEL,66,115,30,14
PUSHBUTTON "Door 1",WMM_IDB_SEL_RELAY1,20,18,122,14
PUSHBUTTON "Door 2",WMM_IDB_SEL_RELAY2,20,40,122,14
PUSHBUTTON "Door 3",WMM_IDB_SEL_RELAY3,20,62,122,14
PUSHBUTTON "Door 4",WMM_IDB_SEL_RELAY4,20,83,122,14
END
---------------------
Should I also post my WMMAuxIOSelectDial class code?
Best regards,
|
|
|
|
|
I would expect your dialog identifier WMM_DOOR_CONTROLS DIALOG DISCARDABLE to be declared elsewhere, perhaps in a file resource.h which is #include d by both the .rc resource file and by the .h or .cpp file that uses the identifier. It's likely that its this last one you are missing.
To see what I mean you could use the Visual Studio wizard to create a new dialog based project then search to see where the identifier IDD_DIALOG1 is declared.
|
|
|
|
|
Hi Jonathan,
Thanks for your reply,
I searched *.* and *.h in my entire project, and the resource identifiers that compile successfully are not found. I have a set of files that builds, and I continually delete all object files and build those others successfully.
Could there be some other intermediary generated files that the build process is using in which the declarations have been satisfied, and the resource.h file that I need not checked out from my version control system and I never needed it because I had those intermediary files? This seems like a bit of a stretch.
I seem to have some resource files that have other names, such as w_resrc.h, but
I searched *.* and *.h and didn't find the working identifiers anywhere.
How in the world can those others be getting built successfully?
I'm using a really old, legacy compiler, and it can be regarded as me just writing the .rc file in a text editor. I use the VC++6.0 IDE to help me with this, but, as I say the other resource IDs all compile, and *they* are not declared anywhere else that I can reasonably see.
Best regards,
|
|
|
|
|
In my initialization,
WMMAuxIOSelectDial AuxIOCtrl (this, WMM_DOOR_CONTROLS);
WMM_DOOR_CONTROLS just had to be in quotes:
WMMAuxIOSelectDial AuxIOCtrl (this, "WMM_DOOR_CONTROLS");
Good one, eh? That was two days I didn't need to spend...
|
|
|
|
|
Glad to hear you got it sorted.
|
|
|
|
|
Sorry, I'm new in MFC...
I know that I can access CMyAppDoc within CMyAppView using GetDocument() function in a SDI Application. How can I do the inverse? that's access CMyAppView within CMyAppDoc?
Thank you masters!
|
|
|
|
|
I think the idea is that you don't need to. For instance if you are viewing a split document e.g. page 1 and page 7, when you ask for the view which one do you want?
You are meant to update the data your document contains e.g. a text or drawing then from the document call UpdateAllViews to have the view (or views) redraw/paint your document so you see the changes.
Also if the View knows about the document and the document the view it can get complicated with circular references.
|
|
|
|
|
You can use CDocument::GetFirstViewPosition and CDocument::GetNextView to iterate through all the views that are attached to a document.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
See CView Access From Anywhere[^] and questions on the bottom of page.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I would also point you at UpdateAllViews member function of the CDocument class.
As has been said, the whole point is that CDocument has no clue whatsoever about the views. This lets you replace / add different views, and only change one area of your code.
This is a GoodThing(tm).
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
I have upgraded a project written in VC++ 7.1 version using the .net 2005 wizard. After fixing few code related issues, I have got the following errors while building
error LNK2001: unresolved external symbol DllCanUnloadNow
error LNK2001: unresolved external symbol DllGetClassObject
I have declared this in the .def file as
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
I would really appreciate for showing me the right way to resolve this please. Thanks in advance.
SoftwareDeveloper(.NET)
|
|
|
|
|
did you switch a dll from being a com DLL to a managed DLL?
a programmer traped in a thugs body
|
|
|
|
|
Few libraries actually was written in vc 6 and using those with that..but it has been upgraded to vc 7 ..
Thanks
SoftwareDeveloper(.NET)
|
|
|
|
|
Finaly I could resolve the issue. I have done the following steps to resolve the issue.
1) Have set "Multi-Threaded Debug(/MTD" in all the projects under workspace. this thing was correct already but mentioning here for future reference.
2) In the Resources-->Preprocessor Definitions , I have set "_DEBUG,_MT,DLL". I believe this part , corrected the issue. previously it was having only "_DEBUG".
Thanks,..
SoftwareDeveloper(.NET)
|
|
|
|
|
Hello,
I am using dialog boxes and I need to capture window message when the window/dialog was displayed
I tried WM_SHOWWINDOW but the help says:
WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.
I can not fint the proper message.Can you give me a hind?
Thank you very much.
|
|
|
|
|
daavena wrote: displayed
What do you mean by 'displayed' - created, shown, redrawn?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
when I click on the button I need:
show window/dialog with message "Loading profile it can take several minutes" inside
and than when the window is shown(is visible) I need to run the function - but only once.
|
|
|
|
|
There's no window message that you only get when the window is shown the first time.
Instead, catch WM_SHOWWINDOW. Maintain a flag that tells you if your message has been shown. You can use this flag to tell you whether you should show your message or not - something like:
void CMyWindow::OnShowWindow(BOOL bShow, UINT nStatus)
{
if (bShow && !m_bShownMyMessage)
{
m_bShownMyMessage = TRUE;
}
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thaks for reply,
WM_SHOWWINDOW
WPARAM wParam
LPARAM lParam;
Parameters
wParam
Specifies whether a window is being shown. If wParam is TRUE, the window is being shown. If wParam is FALSE, the window is being hidden.
lParam is still 0
when I capture WM_SHOWWINDOW so wParam is always 1 -the window is being shown.
My function always runs first. Then I see the window.
This function takes a time - 10sec, that is reason why I need to see the window first.
WM_SHOWWINDOW message is called only once. I think it is not possible to do that.
|
|
|
|
|
WM_WINDOWPOSCHANGING?
Or you could even could WM_PAINT - that was when the window was actually shown to people!
So it depends on what you mean...
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks for reply.
I need message when window/dialog has been shown - I need to see the window first and then run my function(only once).
|
|
|
|
|
Please consider the following code fragment written using C++ and MFC.
void<br />
GraphWindow::OnPaint()<br />
{<br />
CPaintDC dc(this);<br />
dc.TextOut( 50, 50, TEXT("A Parabola"), 11 );<br />
<br />
dc.SetWindowOrg( -cx/2, -cy/2 );<br />
<br />
CPen pen(PS_SOLID, 2, RGB(255, 0, 0) );<br />
CPen *pOldPen = dc.SelectObject( &pen );<br />
<br />
dc.MoveTo( -10, 100 );<br />
for( int i = -10; i<=10; i++ )<br />
dc.LineTo( i, (i*i) );<br />
<br />
dc.SelectObject( pOldPen );<br />
}<br />
This routine is suppose to graph the curve y = x^2. However, it graphs the function y = -x^2 because the windows orientation is that an increasing y value, moves down in the window. If I change the call to LineTo to the following, it works:
dc.LineTo( i, -(i*i) );
I believe that there is a call that will change the window orientation such that an increasing y value moves up rather than down. However, I have been unable to find the call. I am hoping that somebody can tell me what it is.
Thanks
Bob
|
|
|
|
|
|