|
I'm looking ways to do a variation on Doc/View that would accommodate the video editor app i'm writing. I want it to be SDI in the sense that only one document can be open at a time, but I want it to be MDI in the sense that there can be many different views opened (onto the same doc, of course) at once.
There would be a window (floating toolbar, probably) with a series of video frames and the user could double click a frame to open a full-sized window into the area where the MDI windows would normally go.
I guess this would be a SDMV (Single Doc, Multi View) app, instead of an MDI or SDI app.
Has anyone here done anything like this before?
I've looked around on this and that other code site, but didn't find anything the fit.
-c
|
|
|
|
|
I have just such a solution. Give me a week to clean up the code and make a test application showing how to use it.
|
|
|
|
|
I think you should start with an MDI application, then override ID_FILE_OPEN and ID_FILE_NEW or something like that to allow only one document. The details of how that is done is somewhat determined by how you want the file to be specified that you will allow open.
I am not entirely sure of how well that will work, but I think it could work well.
|
|
|
|
|
I seem to have a problem getting radio buttons to enable, pending the state of another button...The radio buttons, are drawn with a default style of BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED...When I send a BM_SETSTYLE message to the buttons with SendDlgItemMessage() The button does not enable. Does anyone know why this happens, and what can be done about it using only win32? If you would like to see the code, or need more information let me know...thanks in advance...
|
|
|
|
|
I just noticed a strange problem with my app. I'm not able to step into >some< of the MFC library source files while debugging. So far, the problem occurs with CWinApp and CMDIFrameWnd but does not occur with the container classes. Debugging everything else seems to be working just fine!
I've verified that I don't have any unusual settings in my debug build configuration.
Any suggestions???
|
|
|
|
|
I ran across the following article on MSDN:
Article ID: Q121556
There is a section titled "Missed breakpoints when more than one copy of DLL on your hard disk" that made me remember that I had two copies of the debug MFC dll's on my system.
I removed the duplicate files and all is well.
I guess the OS was loading the duplicate DLL's, which were in the same dir as my .exe, and the IDE was waiting for the WINNT\system32 MFC files to run. The system MFC DLL's would of course never load because the duplicates were found first and the IDE's debug information probably only targets the system DLL's.
|
|
|
|
|
I added new browser control to my project and now i'm getting this error, regardless if I remove it now.
error C2011: 'CWebBrowser2' : 'class' type redefinition
\webbrowser2.h(9) : error C2011: 'CWebBrowser2' : 'class' type redefinition
\ProfileView.cpp(537) : error C2039: 'ControlDownload' : is not a member of 'CWebBrowser2'
\webbrowser2.h(9) : see declaration of 'CWebBrowser2'
|
|
|
|
|
Hi all,
i am looking for ppl who are experts in Rational Rose Application, specially who know how to work with Rose Automation...
any1 who can refer me even to Rational Rose forum will be appreciated.
please email me at
ynir@legacy2web.com
or at
n_yaron@netvision.net.il
tnx a lot
|
|
|
|
|
I want to use API for displaying the Choose Folder Dialog as we find in the
installation of s/w packages. It should be possible to select the drive from a drivelist. On selection the directories in that drive will be displayed in a directory list and the selected directory should be visible in a text box
Note My intension is not to use The function SHBrowseForFolder
Thanks in advance
santhosh J
|
|
|
|
|
I would like to disable a row (with checkbox) in list control. This makes the user cannot check the checkbox. Any hints on this? Thanks all!
|
|
|
|
|
You can draw the row in grey text to simulate disabling it. See my tutorial on custom draw if you need directions on using custom draw.
As for disabling the checkbox, I think you can do it by handling LVN_ITEMCHANGING, and if the item's state icon (which is how the checkboxes are implemented internally) is about to change, you disallow the change.
You may also need to handle LVN_KEYDOWN and watch for the space bar, because that will also change the state of a checkbox.
|
|
|
|
|
Hello,
I would like to limit access to the MS Access database that my app uses. Ideally, it would not be accessible at all from outside the app. My app will provide means to initialize and copy the database with the copy being accessible. Is there a way to do this either on the MS Access side or the VC++ side?
Thanks.
Paul Ebert
|
|
|
|
|
Hi,
The good news: There is a comprehensive security setup document suite inside the help files of Access. It is relatively easy to read.
The bad news (for me): I could not get it to work reliably and usually couldn't get the options that I wanted. I gave up eventually.
My advice: download the miniSQL server version from vstudio in MSDN. It's called MSDE.
Here's a link to a Jet vs MSDE debate: http://msdn.microsoft.com/library/default.asp?URL=/library/backgrnd/html/msdeforvs.htm&RLD=462.
Here's a link to the MSDE itself: http://msdn.microsoft.com/library/default.asp?URL=/library/backgrnd/html/msdeforvs.htm
Hope this helps.
Kind regards,
Al.
VBer who wants to go back to, but will have to learn again, C++. I'll carry on using VB for the front-end; so when I get proficient at C++/STL can I jump straight to ATL and avoid the MFC?
|
|
|
|
|
When is it appropriate to use the "special" data types defined in the Windows header files such as BOOL, TRUE, and FALSE, & when is it appropriate to use the standard C++ types like bool, true and false? I am programming in MFC, but I see both in code. Anyone who can help end some of this confusion would be appreciated. I understand types like CString, and COLORREF add functionality, but does it matter which one you use with the others I mentioned?
|
|
|
|
|
The SDK is all C APIs, and thus must use BOOL (which is a typedef for int, I believe). They can't use bool because that is a C++ type.
MFC was developed before bool existed in C++, so it uses BOOL. New MFC features use BOOL as well, to maintain consistency.
As for when to use the built-in C++ bool, I myself don't use it much. I'm just used to using BOOL (I started doing Win programming before bool existed). I will use bool's as member variables in classes, or locals in functions. But anytime you pass a flag to an API, use BOOL, because there is no implicit conversion from bool to BOOL (ie, you can't pass a bool for a parameter declared as BOOL). If you do use bool's, you'll have to pepper your code with "bSomeFlag ? TRUE : FALSE" expressions (to explicitly convert from bool to BOOL) which is fugly.
|
|
|
|
|
I do always pass directly a bool to functions expecting a BOOL , never had any problems.
Just the other direction, you must do something like this:
<br />
BOOL b_old = TRUE;<br />
bool b_new = b_old!=0;<br />
|
|
|
|
|
*headscratch* I could've sworn VC complained if you used a bool where a BOOL (or other integral type) was expected. Ah well, my bad.
|
|
|
|
|
Using VC 5, the following code:
BOOL WinBool=TRUE;
bool cppBool=true;
WinBool = cppBool;
cppBool = WinBool;
produces the following:
warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
I think that there are many of us C++ programers that would consider mixing types like that sloppy and we are suspicious of programmers that program like that when it is not necessary.
|
|
|
|
|
My approach is to use bool everywhere remotely possible and to stay as far away from MFC as much as possible . You never know when you might have to port your code or when MS might change their minds on BOOL.
I just use conditional returns like this if a BOOL is required:
if ( true == bState )
{
return TRUE;
}
else
{
return FALSE;
}
when I have to return a BOOL in an overridden function.
I try to never mix BOOL and bool. Even though they serve the same purpose, they are different types and should be treated as such.
|
|
|
|
|
I'm having trouble using Chris's grid in a MFC extension dll. The dll is loaded into an app that isn't mine, and is supposed display a dialog when a method is invoked.
The symptoms are that if I use a custom control resource on my dialog (class=MFCGridCtrl) the dialog fails creation inside Create(). Dunno why, I just don't get a HWND. GetLastError() returns NULL. I can dynamically create the grid after the dialog is created, but then the grid never paints itself. Yes, it is WS_VISIBLE, WS_CHILD, has size, etc. Spy++ "sees" it on the dialog, but I never see it. If I float over a spot where a cell would exist, I can see a tooltip flicker in the upper left corner of the screen. The same code works in my test app, which is not using the extension dll.
I don't have any trouble with the "regular" controls on the dialog, like a CListCtrl.
My setup is pretty funky and I admit up front that the problem may not be the extension dll... One problem is that I am having to link to a non-debug MFC42.dll because the calling app is linked this way. (Although my dll does include debug info.)
Any ideas please?
|
|
|
|
|
I think this problem has been already pointed out in this forum. If I remember well it was a call to AfxGetInsanceHandle() instead of AfxGetResourceHandle() somewhere in the code.
I think it has been fixed in recent updates of the control. Try with a newer version.
|
|
|
|
|
Thanks for the idea. I couldn't find the article you refer to, but I did check and the source I have uses AfxGetInstanceHandle() throughout. (I'm using the source included in the sub-article Tree control and Buttons for MFC Grid control).
However, by reading the comments for Chris's article I found the reported problem with calling Initialise() from PreSubclassWindow(), and the fix. This fix enables me to successfully create the control dynamically during WM_CREATE of the dialog, but not during dialog creation from the resource template. Hmmm.
|
|
|
|
|
Hi Nick,
I found the messages I referred to:
With external resourcefile dialog with Custom Control not loaded [9:24 9 Jul 00]
Anyoune knows differences with custom controls in NT and W98??? [2:00 7 Jul 00]
I don't know if the following could help, however...
A few days ago, I was trying to solve a problem I had with animated cursor resources (they got loaded only when linking to MFC DLLs, but not when linking to static libs), and I had a look in CWinApp::LoadCursor() code discovering the 'undocumented' function AfxFindResourceHandle(), which is used throughout MFC code to load resources.
Its declaration is in AFXWIN.H (line 3920):
// Use AfxFindResourceHandle to find resource in chain of extension DLLs
#ifndef _AFXDLL
#define AfxFindResourceHandle(lpszResource, lpszType) AfxGetResourceHandle()
#else
HINSTANCE AFXAPI AfxFindResourceHandle(LPCTSTR lpszName, LPCTSTR lpszType);
#endif
Here is an excerpt from MSDN ("Extension DLLs"):
"...
Sharing Resources and Classes
Exporting resources is done through a resource list. Each application contains a singly linked list of CDynLinkLibrary objects. When looking for a resource, most of the standard MFC implementations that load resources look first at the current resource module (AfxGetResourceHandle) and if the
resource is not found walk the list of CDynLinkLibrary objects attempting to load the requested resource.
Walking the list has the disadvantages that it is slightly slower and requires managing resource ID ranges. It has the advantage that a client application that links to several extension DLLs can use any DLL-provided resource without having to specify the DLL instance handle. AfxFindResourceHandle is an API used for walking the resource list to look for a given match. It takes the name and type of a resource and returns the resource handle where it was first found (or NULL).
If you wish to not walk the list and only load resources from a specific place, use the functions AfxGetResourceHandle and AfxSetResourceHandle to save the old handle and set the new handle. Be sure to restore the old resource handle before you return to the client application.
..."
---
If you have any idea about my problem, please let me know. I posted a message here, but without much luck. Hope you'll have more...
Paolo.
|
|
|
|
|
I want to override CWinApp::OnFileNew and CWinApp::OnFileOpen, but I don't know how they work.
Does anybody know how they work, or even have some code for overriding them?
Thanks,
Nisse
|
|
|
|
|
Just look at the MFC source code; that is what it is provided for.
As for how to override, the easiest way is to use the ClassWizard to do that.
|
|
|
|