|
I'm assuming you are using MFC.
First, you need to derive a view class off of CFormView (through the Dialog editor or ClassWizard).
If so, in your app class (usually InitInstance), you need to set that new CFormView derived class in the code where your CSingleDocTemplate* object is being created. You will see it is using CMyAppView, change if to your CFormView derived class created earlier. (Be sure to include the view's header file.)
|
|
|
|
|
Hi guys - this is my first ever posting here so I'll start with an introduction. I'm Wilhelm Svenselius, I go by the nickname of "W2k" (not related to the operating system) and I enjoy C++ programming using Visual C++ .NET (7.0) as a hobby.
I've now put together my first MFC app worthy of distributing (as in, publishing for download on my personal website) - but I quickly realized that unlike the good old days of writing console apps that run in text-only mode, there are quite a few DLL's I need to include if I want people without the full range of MFC dependencies installed to be able to use my program.
Obviously, my installer will need to include at least a few of these DLL's. I looked at my EXE in Dependency Walker and there were a massive amount of system DLL's referenced, no way can I determine which (may) need to be updated on any potential target user's system for my app to work. MFC70.DLL and MSVCRT70.DLL are apparently not sufficient.
In my search for answers I found the pages
MSDN: Redistributing Microsoft Visual C++ 6.0 Applications and MSKB: Vcredist.exe Installs the Latest Run-Time Components for Visual C++ (Q259403). Neither is what I need; both are aimed at Visual C++ 6.0, the DLL's for which will clearly not do when I'm using Visual C++ 7.0.
However, a utility which automatically installs all the latest runtimes like the one found in the KB article, except for VS7.0, would rock. Sadly, I haven't been able to find one.
I have tried various installers: InstallShield is payware and it has funky copy protection which messes up my floppy drive, so I can't use that. NSIS is excellent but it can't figure out what DLL's I need to include on its own. Visual Studio.NET has a built in Setup Wizard which includes all the neccessary DLL's automatically, but the installer generated by that is massively ugly and I'd rather not use it. Anyone know how to use those .MSM "Merge Modules"? They seem to hold the files I need to include but I can't figure out how to open them. I have been strongly recommended against merely copying DLLs out of my windows\system32 folder.
My question all put together into one sentence (for those of you who can't be bothered to read all the above, or seek clarification):
How can I determine what DLL's to redistribute with my MFC application, and where can I get them?
Thank you for any help you might be able to provide.
[ PlanetCPP ][ home of the n00blist ]
|
|
|
|
|
Gee guys, thank you for all the help. I found a solution at last:
There is a file in the Visual Studio.NET root folder called "redist.txt" which contains a comprehensive list of what DLL's I must include.
Hope this helps others who might have the same problem as me.
[ PlanetCPP ][ home of the n00blist ]
|
|
|
|
|
Before I write my own....I need something to auto-magically cleanup resources such as HMODULE, new'd data, GDI objects, etc. Is there a template lib that can handle all these different data types?
For instance, for an HMODULE I need it to call FreeLibrary, for regular new'd memory I need to call delete pData or delete [] pArray.
I've looked through STL, ATL and WTL but they don't seem to have anything that does the trick.
I want to be able to write something like
AutoThingy<hmodule> hLib = LoadLibrary("some.dll");
or
AutoSomething<char*> pData = new char[123];
and not have to worry about the call to FreeLibrary or delete [] before I exit the function.
Todd Smith
|
|
|
|
|
|
Does that class make a distinction between a HGDIOBJ and a HMODULE and a pointer allocated with new , because all three of these types of objects need to be deleted in different manners?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Well, you instruct it how the delete semantics goes for your
kind of resource, via a destructor-policy (that is a template
parameter which takes a class that sole purpose is to implement
a Destroy(T) member function.
Now you can write things like this:
template <>
inline void CAutoDestructor<HANDLE>::Destroy(HANDLE hFile)
{
_ASSERTE(hFile != INVALID_HANDLE_VALUE);
::CloseHandle(hFile);
hFile = INVALID_HANDLE_VALUE;
}
typedef CAutoPtr<HANDLE, CAutoDestructor<HANDLE>, INVALID_HANDLE_VALUE> CFileHandle;
or something like:
template <>
inline void CAutoDestructor<HINSTANCE>::Destroy(HINSTANCE hLibrary)
{
_ASSERTE(hInstance != 0);
::FreeLibrary(hInstance);
hInstance = 0;
}
typedef CAutoPtr<HINSTANCE, CAutoDestructor<HINSTANCE>, 0> CLibraryHandle;
I seem to recall that boost has got a similar design, which
you might be interested in. Please check it also there.
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
Looks interesting, Thanks!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have a CEdit derived class, which has to do the following
1. Whenever user types something, it highlights the text.
2. Remove the highlight, when the user presses Enter key.
The problem is:
I am not able to get a keydown or WM_CHAR message for the Enter key. The Edit box is on a dialog. So (1) works, but the edit box does not know that (2) happened.
Any suggestions?
Thanks
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Try setting the "Want return" property on the edit control (in the resource editor). If that doesn't work, you may need to override your dialog's OnOK() handler and invoke a method on your CEdit derived control.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks for the reply.
I am doing it in OnOK now. But, I was trying to find a better solution, where the Edit box is completely independent in implementation of this highlight stuff.
The ES_WANTRETURN works only for multiline Edit controls, whereas mine is a single line one
Thanks again
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
CWnd::OnSysChar
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Thank you for your help, but this does not work either.
I just tried it... and I receive no calls on this, when I use this in my CEdit derived class.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
What you CAN do, is to detect the loss of focus. This covers a return character, as well as mouse moves and etc. (You probably want to remove the highlight if the user clicks in another control, don't you?)
Try using this:
CWnd::OnKillFocus
afx_msg void OnKillFocus( CWnd* pNewWnd );
Parameters
pNewWnd
Specifies a pointer to the window that receives the input focus (may be NULL or may be temporary).
Remarks
The framework calls this member function immediately before losing the input focus.
If the CWnd object is displaying a caret, the caret should be destroyed at this point.
Note This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.
CWnd Overview | Class Members | Hierarchy Chart
See Also CWnd::SetFocus,WM_KILLFOCUS
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
|
|
|
|
|
The situation is different.
I have a window that has a dialogbar that contains this editbox.
When Enter key is pressed, there is no focus change. and the ENTER can be seen only in the parent window derived from CFrameWnd.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
Try handling the WM_GETDLGCODE windows message.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
I implemented the PreTranslateMessage and handled the WM_KEYDOWN as Matt Gullet suggested and it works great. I had done that before I saw your post and did not try this.
Anyway, Thank you for the help
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Just overide PreTranslateMessage and look for a WM_KEYDOWN message with a wParam of VK_RETURN. You will also have to check the status of the alt/control/shift keys (if needed).
|
|
|
|
|
works like a charm.
Thank you very much
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I created an edit control in Win32 as following:
hwndEdit = CreateWindow( TEXT("edit"), tcLabel,
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL ,
cxChar + 100, cyChar * (2 * i ) /* * (1 + 2 * i) */, 20 * cxChar + 100,
cyChar * (1.25), hwndDlg, (HMENU) i,
((LPCREATESTRUCT) lParam)->hInstance, NULL)
However, the following catch inside my dialog's WM_COMMAND catch statement, no longer works after creating my edit box :
if (HIWORD(wParam) == EN_CHANGE ||
HIWORD(wParam) == CBN_SELCHANGE)
When I click inside the text boxes, a couple of messages are generated, but they don't correspond to "EN_CHANGE". How would I find out what those messages are within VC btw? Any idea what this problem maybe?
thanks
|
|
|
|
|
When you click in the edit control, Windows will send a WM_SETFOCUS to your dialog to indicate that the focus has changed. The EN_CHANGE notification is sent when the text inside the control changes. A CBN_CHANGE notification is not sent for an edit control.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
You must to Write into the edit for the message EN_CANGE will be cached...;)
Best Reagards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm trying to create TAb views like in the Vusial Studio Work space browser or in the Output window, but my project always crashes. Has someone experience on how to program this?
Thanks
|
|
|
|
|
When a file is saved using CArchive, is it then posible to read the file in an application created for Linux??
|
|
|
|