|
While I agree that the db member should be in the doc and not in the view, there's nothing programatically wrong with what you've been doing. IntelliSense cannot show you the members of CTrain1View since your pView is of type CView*, but casting it to CTrain1View* should work:
POSITION pos = pDoc->GetFirstViewPosition();
while (pos!= NULL)
{
CTrain1View* pView = (CTrain1View*)(pDoc->GetNextView(pos));
ASSERT_VALID(pView);
pView->db.MyFunc(arg from view2);
}
But of course, hard-coding a type cast like this is error prone. You could make it a little nicer by checking the type before the cast:
CView* pView = pDoc->GetNextView(pos);
ASSERT_VALID(pView);
if (pView->IsKindOf(CRUNTIME_CLASS(CTrain1View)))
((CTrain1View*)pView)->db.MyFunc(arg from view2);
Still, putting it in the doc is the right thing to do.
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"
|
|
|
|
|
when I run an MDI application and keep clicking down a non-client
area of a window, all other window look dead, which means they
don't draw anything on their client area. This is critical when
I develop a timer based application because all the timer message
are also blocked by keeping down my mouse cursor on a non-client
area of a window.
I want to avoid this. I want to make all windows run although I
keep clicking down the caption bar of a window.
Does anybody know a solution for this problem?
|
|
|
|
|
I am working on a multiple document MFC program and am having a little trouble getting the standard save dialog to work properly. This is the problematic code:
static char BASED_CODE szFilter[] = "Quizbowl Team (*.qbt)|*.qbt|All Files
(*.*)|*.*||";
CFileDialog m_File(TRUE, NULL, NULL, OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT, szFilter, this);
m_File.m_ofn.lpstrTitle = "Open Quizbowl Team";
if(m_File.DoModal() == IDOK)
{
...
((CMainFrame*)GetParent())->SwitchToForm(IDD_TEAMBLD_ROSTER);
...
}
What happens is that as soon as m_File.DoModal() is executed, all of the items in DoDataExchange no longer work. Any help would be appreciated.
|
|
|
|
|
bjenning wrote:
all of the items in DoDataExchange no longer work
Why? Did you call UpdateData(FALSE) somewhere in your program?
|
|
|
|
|
Nope, no UpdateData(FALSE) (no UpdateData(TRUE) in the problem function either). The problem that I am having is when it enters the next dialog. None of the sounds or pictures show up. This is also the case for each of the other dialogs in the project.
|
|
|
|
|
Maybe I'm just being stupid and missing something simple. Do you know of any good example code I could look at to make sure I'm using the CFileDialog class correctly? Thanks for your help.
|
|
|
|
|
Your code looks correct! That's why I guess your problem is somewhere else. I even use
same type of code in my script article.
void CScriptDemoDlg::OnBtnBrowse()
{
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
_T("Script Files (*.js; *.vbs)|*.js;*.vbs|Text Files (*.txt)|*.txt|All Files (*.*)|*.*||"));
if (dlg.DoModal() == IDOK)
{
}
}
As my daughter would say, "... Whatever!"
|
|
|
|
|
I'm using CFormView in my program, and in one of my handlers, I open a new view and attempt to close the current. I call DestroyWindow() to kill the window. When I run it, the new form opens and the old one ends up behind it, but doesn't close. Everything inside the form turns to white, but the frame around it stays and can be repositioned as it normally does. It's as if the form itself has closed, but it has left the frame behind.
Has anyone seen this? I've also tried posting a WM_CLOSE message, but that does nothing at all. Can someone please help?
|
|
|
|
|
Are you destroying the view, or its frame?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I guess it's the View. How can i destroy the Frame?
|
|
|
|
|
GetParentFrame()->DestroyWindow();
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Ahhh...excellent. Thank you very much.
|
|
|
|
|
Hi there,
I want to write a database program with ADO which it don't needed to install new components in the system for running …
In a word, it must run on Win98 or later …
I wanna know, what's ADO version on Win98 Arabic in default …
I want to know, does Access 97 support Farsi text in the records ???
Thanks in advance.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I suspect you'll need to install MDAC regardless.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
Hello Christian
That's it ... I don't want to install any components like that ...
I just want to use ADO !!!!!!!!
MY PROGRAM MUST WORK ON WIN98 OR LATER !!!
Can i do it ????
I mean without installing MSDAC.
Could u tell what's ADO version in Win98 ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
OK, I'll wave my magic wand and install MDAC on every W98 machine on the planet. Done.
You can't do it, I can't help you or change that. You'll need MDAC. End of story.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Hi Christian,
hmmm, yes i think so ...
At least i have to update ODBC and OLEDB drivers ...
And i can do it only by MSDAC !!!
thanks for reply !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a server and a client app. I want to send some data from server to client without a request from client. How could the client get the data from server with only a event ?
I know I can get if the server use PostMessage function, but only using a wparam (16 bits) and lparam (32 bits).
Thanks,
Cristiano.
|
|
|
|
|
|
Hi. My problem is this:
I create a window using CreateWindowEx(). Then I create other windows[tool windows, document window etc...] All these are in non-MFC. The problem is that, if the user clicks on one of the tool windows, the mother window and all others lose focus[The title bars of those windows become gray]. And similarly if any window is clicked all others lose focus. I hear you saying "so what?". Here is the problem: When I start a DialogBox() only the spawning window is blocked, other windows are not. But I want them all blocked until the DialogBox returns.
I tried an MDI program generated by Visual C++ 6.0's wizard. What I want is exactly that(all windows titles are always highlighted!) but in a non-MFC way.
I tried different combinations of OVERLAPPED, CHILD, POPUP etc. but couldnt get it right. Can anybody help me?
Thanks
Oztan
PS: By the way I think being highlighted is my problem that is why I am talking about it. Actually I dont care which windows are highlighted and which are not, I just want the DialogBox() to block them all.
|
|
|
|
|
I guess one way you may do this is:
1. Disable (or Hide) all child popup window (or dialog #32770) that existed. To do that, you
may call EnumChildWindows.
BOOL CALLBACK gfnEnumChildProc(HWND hWnd, LPARAM lParam)
{
TCHAR szClass[CLASSNAME_LEN];
::GetClassName(hWnd, szClass, sizeof(szClass)/sizeof(TCHAR));
DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE);
DWORD dwExStyle = ::GetWindowLong(hWnd, GWL_EXSTYLE);
if (_tcsicmp(szClass, _T("#32770")) == 0)
{
}
if (dwExStyle & WS_EX_TOOLWINDOW)
{
}
}
2. I just re-read your post and I think you could get away with it by creating your dialog inside
of your main window. or why is this not an option?
|
|
|
|
|
Hmm, your answer is more tricky than I expected.
"I think you could get away with it by creating your dialog inside
of your main window"
Ok. Here is the situation.
I have the main window.
Main window creates two toolwindows. [One is for document, other is for interfacing with user]
The interface tool starts a DialogBox. I want this dialog box to pause everything [stop user interaction between main window and the documetn toolwindow] But while the dialogbox is running I can still use the other tool and the main window! Only the dialog that spawned this dialog is paused.
I hope the problem is clearer now. I believe I can solve it with proper ownership and window styles but I just can't figure out which is the correct one.
Thanks
Oztan
|
|
|
|
|
Yes, that's what I meant! Is there any reason why you can't create (start) this dialog
from the main window instead from the interface? Your interface is modeless and how you
create the DialogBox (which is modal) will affect only its parent. Can you post some code,
how you create your 'DialogBox' (constructor) before you call DoModal()?
As my daughter would say, "... Whatever!"
|
|
|
|
|
I need to know how I can retrieve data from my database if its stored as as bytes.
So far to get strings out I have been doing a _bstr_t cast to the value received from rs->fields->getItem->Value . However somewhere I read about
rs->fields->getItem->Value.iVal
and
rs->fields->getItem->Value.bVal
but cannot find any info on it.
Thanks for your help,
ns
|
|
|
|
|
__variant_t derives from VARIANT. iVal, bVal, fltVal and others are defined in VARIANT stuct.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|