|
The Message for loosing input-focus is WM_KILLFOCUS.
The stupid thing is that the User can click a Toolbar-button without your View loosing focus. That is a Bug, not a feature, and I have not found a way to circumvent it.
The easiest thing is to have all Tollbarbutton handler who are supposed to take the focus away from a certain view do this by hand. Then (and only then - within the toolbar button handler) your views are getting their WM_KILLFOCUS.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi all,
I've created new add in using the dev studio add in wizard.
i have only 1 command method there that does this:
STDMETHODIMP CCommands::My567CommandMethod()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CWinApp* pApp = AfxGetApp();
ATLASSERT(NULL != pApp);
if (NULL == pApp)
{
return E_FAIL;
}
CString szWorkspace;
POSITION posdt = pApp->GetFirstDocTemplatePosition();
while (NULL != posdt)
{
CDocTemplate* pdt = pApp->GetNextDocTemplate(posdt);
if (0 == strcmp("CProjectWorkspaceDocTemplate",
pdt->GetRuntimeClass()->m_lpszClassName))
{
POSITION posdoc = pdt->GetFirstDocPosition();
if (NULL == posdoc) break;
CDocument* pdoc = pdt->GetNextDoc(posdoc);
if (NULL == pdoc) break;
szWorkspace = pdoc->GetPathName();
if (0 == szWorkspace.GetLength()) break;
}
}
if(szWorkspace.IsEmpty())
{
return E_FAIL;
}
return S_OK;
}
the code above, just want to find the *.dsw file name.
i took it from the project "restore class view" appeared here in code project.....
in debug mode the value of POSITION posdt is null, therefor it doesn't find the file. when i tried to debug the project "restore class view"
it did had a value and did returned the proper dsw file.....
can any1 help me here???
thanks
p.s - here is a link to the "restore class view" project
http://www.codeproject.com/macro/restoreclassviewaddin.asp
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi everybody,
I am newbie in matlab C++. I am facing some problems during my work. I followed the Matlab manual in the mathworks website and wrote the code like this: --->>
mwArray A = 5;
int i, j = A;
for (i=0; i < j; i++)
cout << "Counting: " << i << endl;
after compiling, the visual C++ studio shows
d:\others\im\me.cpp(29) : error C2440: 'initializing' : cannot convert from 'class mwArray' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
there is another problem:
i wrote in MATLAB C++
mArray x;
mArray X1;
X1 = x(1,colon());
max1=max(X1);
mwArray X2;
X2 =x(2,colon());
max2=max(X2);
max3=max(max1,max2);
after compiling,
D:\others\im\me.cpp(99) : warning C4003: not enough actual parameters for macro 'max'
D:\others\im\me.cpp(99) : error C2059: syntax error : ')'
D:\others\im\me.cpp(103) : warning C4003: not enough actual parameters for macro 'max'
D:\others\im\me.cpp(103) : error C2059: syntax error : ')'
D:\others\im\me.cpp(105) : error C2440: '?' : cannot convert from 'class mwArray' to 'bool'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
D:\others\im\me.cpp(105) : fatal error C1903: unable to recover from previous error(s); stopping compilation
I would like to know how I can solve the above-mentioned problems. Thank you for your guidance.
I am using MATLAB 6.1 , MS Visual C++ 6.0 , Window 2000
vincent sim
|
|
|
|
|
I think this one of those cryptic error codes.
cannot convert from 'class mwArray' <br />
to 'int'
Means that it could not find a declaration for the conversion of mwArray so it chokes on the first operation that you do on it. Either you have an outdated version of the libraries, the include file is incorrect or missing, or there is no way to converst an mwArray into an integer.
The second problem looks like the macro max , which is a preprocessor directive and will go first will replace the occurances of max before it gets to it. Therefore you will have to put
#undef max
before it.
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
how to load an image using kodak imgedit activex control ...
i ma getting error while loading it ... any help????
|
|
|
|
|
|
actually i tried to load using the set image function but its showing some assertion failure ..can u please ehlp me out on how to go about it
|
|
|
|
|
I'm working on an MDI application using MFC in VC6.0. The application should run in Win98 or higher.
I need my application to notice and respond if the user changes their desktop display settings, changing the resolution or bit depth. I tried WM_DEVMODECHANGE but that seems to something different. I looked for WM_DISPLAYCHANGE but I couldn't find a way to add that using the wizards.
How do I get my MDI to receive notification of display changes?
|
|
|
|
|
Sometimes the user might move the dialog box around screen till it is partly outside the desktop. And you might want to bring the dialog box back into full view. There might also be a a situation where you did the development on a higher resolution and on your machine it comes up nice and full, but the final user might be using a lower screen resolution and thus part of the dialog will be out of the screen. Again you'd really want to make sure the dialog box is fully visible. Well, believe it or not, this can be accomplished with just one line of code.
SendMessage(DM_REPOSITION);
Smooth eh? Remember that this message only works for top level dialog boxes and will not work for child dialogs.
u can also check for GetSystemmetrix
|
|
|
|
|
|
hi ,
i have a dialog bases application in which repainting the application is very much necessary .... does anybody has any idea about the following and how to implement them:
1)SetRedraw
2)ReDrawWindow
3)Setting the parameters CS_VREDRAW and CS_HREDRAW in the WNDCLASS , so the window takes care about the repainting in the subsequent WM_PAINT message.
Please help me in this regard .... iam kinda lost
Thanking you
Satadru
|
|
|
|
|
Invalidate(TRUE) or RedrawWindow(). See MSDN for details.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
How to use CFileDialog to have a preview function?
I use this method:
class CFilePrevDialog : public CFileDialog
CFilePrevDialog::CFilePrevDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG_PREV);
}
-----
CString strFileDlg = "Jpg Files (*.Jpg)|*.Jpg|";
CFilePrevDialog dlg(TRUE, "Jpg", NULL,
OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT,
strFileDlg, NULL );
dlg.DoModal();
-----------------------
But i found what display is still the standard open filedialog...
who can give a advise to use it,not too hard...
Best Regards...
|
|
|
|
|
|
Hi all,
how can i get the *.dsw (workspace file) from the interfaces exposed by the add in????
please help
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
The simple answer is: you can't.
But you can get project paths and names and try to deduce the workspace path from them (perhaps even use CFileFind).
What do you need it for?
Maybe there is a different solution to your problem.
btw: I've written a thin wrapper library for DevStudio 6.0 interfaces. Maybe you'll find it useful. It is part of the following project: http://www.codeproject.com/macro/SmartReplace.asp
|
|
|
|
|
thanks for reply,
i found a code to get the dsw, it appears in one of the add ins here is code project (in the project http://www.codeproject.com/macro/restoreclassviewaddin2.asp?target=restore%7Cclass%7Cview#xxxx )
here is the code:
CString CCommands::GetWorkspacePath()
{
CWinApp* pApp = AfxGetApp();
CString szWorkspace;
POSITION posdt = pApp->GetFirstDocTemplatePosition();
while (NULL != posdt)
{
CDocTemplate* pdt = pApp->GetNextDocTemplate(posdt);
if (0 == strcmp("CProjectWorkspaceDocTemplate",
pdt->GetRuntimeClass()->m_lpszClassName))
{
POSITION posdoc = pdt->GetFirstDocPosition();
if (NULL == posdoc) break;
CDocument* pdoc = pdt->GetNextDoc(posdoc);
if (NULL == pdoc) break;
szWorkspace = pdoc->GetPathName();
if (0 == szWorkspace.GetLength()) break;
}
}
return szWorkspace;
}
the problem is this code doesn't work for me !!!
the line
POSITION posdt = pApp->GetFirstDocTemplatePosition();
returns null for posdt
i've debug the project restoreclassviewaddin2, and there it works! it returns the full path for the dsw...
can any1 help me here???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
I'm new to COM tech. My few COM experiences are just a few OLE Automation samples in MFC. But now I have a Project that will require me calling an object mtd across machine boundary.
Can I achieve this in MFC 7.0? If yes how?
Thanks in advance!
What would life be without programmers and salesmen?
|
|
|
|
|
Kene wrote:
DCOM/COM+ without ATL?
Why without ATL ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
Why without ATL ?
My first taste of VC++ some years back was with MFC. I was particular thrilled about the wizards. Since then, I've been used to doing things in MFC style.
You can still help me out by giving me steps I can take to achieve results (either in MFC or ATL).
Surely any advise or help will be appreciated
What would life be without programmers and salesmen?
|
|
|
|
|
Kene wrote:
Since then, I've been used to doing things in MFC style.
As has been pointed out ( and this is where I was headed ), VC7 has a new version of ATL, and there's no reason you can't use it with MFC.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
MFC7 and ATL7 are best buddies nowadays. At least the source code is hinting it (MFC and ATL shares a lot of code)
--
Intellectualize my blackness[^]
|
|
|
|
|
Does somebody has an idea how it is possible to change button color. I am wondering it does not have such a property.
Raima
|
|
|
|
|
I think 'WM_CTLCOLOR' is helpful to you.
|
|
|
|
|