|
Casting the return of GetDlgItem is a *bad* idea if you have the option of setting up a member variable that is of the correct type to start with. I would recommend that anyone using VC++ learn how to insert message handlers/variables without using the class wizard, because eventually you'll need to know how it is done, but once you know how to do it, there is no reason not to let the Class Wizard do the donkey work for you, in the same way that I believe anyone should write their own string class/array class/linked list class, but should still use CString/vector/list at the end of the day for most applications.
It can also be useful to call UpdateData without ever calling UpdataData(false), when we want to know values, for example this is how the radio button groups work, but do not want to change anything that needs to be sent back 'up the line'.
Christian
#include "std_disclaimer.h"
|
|
|
|
|
Hi all,
this may be a stupid mistake, but i got the following when using TransparentBlt:
error LNK2001: unresolved external symbol __imp__TransparentBlt@44
I tried including windows.h, wingdi.h, and using gdi32.lib (and combination of them).
Can anyone point out my stupidity?
|
|
|
|
|
You should link your project with Msimg32.lib.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Thank you very much.
|
|
|
|
|
After adding the decoding files of the eldos sound engine, i get following error :
fatal error C1010 : Unsuspected (or something End of file while seeking the directive for the precompiled header
and if i click on it i get to the end of the file ( } ).
What causes this error ? How can i fix it. I saw it work in another project but i dont know how to fix, so please help me.
|
|
|
|
|
Add this line into added .cpp files
/#include "stdafx.h"
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Thank you so much !!!
now it works just perfectly.
|
|
|
|
|
While including stxafx works, I prefer to set the project to automatic inclusion of standard headers, so that anything that doesn't include stdafx will still compile without it.
Christian
#include "std_disclaimer.h"
|
|
|
|
|
Hi, I have a three-way splitter window defined like this in my SDI application:
if (!m_wndSplitter1.CreateStatic (this, 1, 2) || !m_wndSplitter1.CreateView (0, 0,
RUNTIME_CLASS (CScrollView), CSize (dataviewwidth, 0 ), pContext) ||
!m_wndSplitter2.CreateStatic (&m_wndSplitter1, 2, 1,
WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol (0, 1)) ||
!m_wndSplitter2.CreateView (0, 0,
RUNTIME_CLASS (CGraphView), CSize (0, graphviewheight), pContext) ||
!m_wndSplitter2.CreateView (1, 0,
RUNTIME_CLASS (COutputView), CSize (1, 0), pContext))
return FALSE;
That is with two different views (CGraphView, COutputView) in the second splitter window. I try to add serialization
to my software but when I try the New or open command the app is crashing.
When myDocument::OnNewDocument is invoked i get an assertion error in the function
void AFXAPI AfxHookWindowCreate(CWnd* pWnd) (ASSERT(pWnd->m_hWnd == NULL); )
This is does not occur when the document is created at start. If I have the same views in the second
splitter window there is no problem. Also if I destroy the second view in the second splitter window with
pView->DestroyWindow() in the myDocument::Serialize(CArchive& ar) function I can Invoke the save command
without crashes (although the destroyed view might lock). It seems like there is a problem updating the second
view if it already has been created.
Does anyone have an idea how to solve this problem I would be more than happy!
/Ingemar
|
|
|
|
|
So the code that calls CSplitterWnd::CreateStatic is in OnNewDocument?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
No, I was a little unclear in my description of the problem. I have the code for the splitter windows in
CMainFrame::OnCreateClient. When I try to reuse the document (new or open document command) it cant
recreate the splitter windows and the app crashes. It seems like a function InitialUpdateFrame is not working
then. I hope this made it clearer.
/Ingemar
|
|
|
|
|
It seems that your OnNewDocument method creates some windows. An object of CWnd-derived class can be mapped to zero or one HWND. The ASSERT you're experiencing is caused by calling CWnd::Create[Ex] (the call may be indirect) on CWnd-derived object that already is a legitimate window.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I solved the problem. I had a pushbutton in one of my views that wasn't destroyd with it. This caused the crash.
/Ingemar
|
|
|
|
|
i have an SDI app with two views. i want all print actions to go to one view and not the other (one is a file explorer and the other is a file preview - i only want to print the preview). how do i do this?
i've tried re-routing the ID_PRINT* messages from the no-print CView to the doc, setting the active view, the posting the message to the main window (AfxGetMainWnd), the yes-print view, the frame wnd, etc.. no luck.
there must be a way to do this...
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Disclaimer: I'm in the middle of very long compile - can't really test this, so treat the solution with care
On a frame window level, override the OnCmdMsg virtual function. Implementation should check for ID_PRINT* messages and forward them directly to 'printing' view by calling its OnCmdMsg. Otherwise, call CFrameWnd::OnCmdMsg.
You can't play with OnCmdMsg on document level - this will cause recursion, stack overflow and crash.
Hope this helps
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I am creating an text editor application for a Windows CE device HPC Jornada handheld. I already have the main toolbar at the top of the dialog but I want to add an aditional toolbar at the bottom. I have created the toolbar using MFC and include all the buttons in the class wizard. I cannot get the toolbar to display though - any ideas/help would be greatly appreciated.
Claire
|
|
|
|
|
Maybe, if you post some of the code you use to create the toolbar...
I don't know with MFC, but if you use plain API calls, the toolbar works quite different on CE and Win32...
BTW, isn't it a CommandBar you are using???
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Can anyone tell me how to disable the maximize/minimizebox and the ability to resize from a CFormview object? In other words make the formview look like a regular dialog. I tried to set the settings in my resource to fixed size but the formview still allows me to resize...
|
|
|
|
|
Your should override CChildFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) method. Within this method
set the lpMMI->ptMaxTrackSize and lpMMI->ptMaxTrackSize to size your want your form to be.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Can't I disable or hide the minimize or maximize boxes ??? I tried to remove it from the style in the PreCreateWindow method, but they still appear...
|
|
|
|
|
Try it again
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
The code above works - the frame window appeared without MAXIMIZE & MINIMIZE buttons.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
Indeed you're right I think I was mixing things together with too much trial and error
Thanks
|
|
|
|
|
Are there any way to change the commended lines colour? Thanks
|
|
|
|
|
Sure !
Check it here : Tools Menu ->Options-> Format(Page)->Colors->Comment.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
How can I make fucntion pointers to member functions of a class??? The function pointer is ALSO a member of the same class, but I get this error:
//header file
void (*funcPtr1) ();
void chooseCharacter();
//cpp
funcPtr1 = chooseCharacter;
the error:
error C2440: '=' : cannot convert from 'void (__thiscall StoryLine::*)(void)' to 'void (__cdecl *)(void)'
please it's urgent!!!
|
|
|
|