|
Okay,
No replies.. either nobody have any idea, or my post is just plain silly.
REgardless, I've been corresponding with Michal Mecinski, the author of a really good article about MSDI applications, which can be found at http://www.codeguru.com/doc_view/msdi.html[^].
This is what he's got to say about my problem:
Hello,
I've been searching the MSDN for some info and din't find much about multithreaded doc/view applications. The only solution I found was to go trough the MFC source code and experiment with various solutions.
The application you described sounds more complicated to me. I guess the whole document and view classes would have to be completely rewritten.
But I have a different idea. You may create a worker thread for each view, that draws the line plot on a bitmap in memory. The view would need to send a message to the working thread whenever the data is updated. You can copy the data for each thread or let the threads access the data in the document directly (using a semaphore of course). The working thread should actually have two bitmaps - one being displayed in the view (simple BitBlt) and one being drawn by the worker thread. After the plot is drawn you switch the bitmaps and post a message to the view to redraw itself. I think this is much simpler than using multiple UI threads. I used such solution once in an application that was drawing fractals and it worked perfectly. I hope this might help.
Regards,
Michal Mecinski
Any comments, folks?
Two Rivers!
|
|
|
|
|
Hello all,
I've got a .dll project that's an ATL Composite object, and am using MFC. When I build the dll to work w/ MFC in a Static library, everything works fine when I run it. When I build the dll to work w/ MFC in a Shared Library, my resources aren't found & things don't work when I run it. (AfxGetResourceHandle() returns NULL, various assertions, dialogs not created, etc). Can anyone shed a little light on the matter? How can I fix it so that I can build it against the shared MFC library & have things working ?
Thanks!
Wes
CPUA - # 0xd00d
Sonork ID 100.14017 wtheronjones
|
|
|
|
|
Hi,
Did you ever figure this out? I just ran into this problem... It started happening out of nowhere, and I'm not sure what I changed to get this to fail...
Cheers,
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
hello @all,
i have an mfc program and an access database. i connected them with odbc.
how can i make the following sql statement in my mfc programm?
'select distinct xy from mytable'
thank you very much.
mfc
|
|
|
|
|
Use CRecordset Open() member function.
|
|
|
|
|
thanks for reply, but it does not work. somewhere i make a mistake.
i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox:
Now i tried this:
<br />
CMyDatabase db;<br />
db.Open( CRecordset::dynaset,<br />
_T( "Select distinct xy from mytable" ) );<br />
<br />
db.MoveFirst();<br />
while(!db.IsEOF())<br />
{<br />
m_ctrlCombo.AddString(db.m_xy);<br />
db.MoveNext();<br />
}<br />
db.Close();<br />
UpdateData(false);<br />
i get the error, when i want to use this funktion. the error:
error with the call of a data record
thanks
mfc
|
|
|
|
|
you can use some SQL tools(such SQL Server's Query Analyzer) which can chech you SQL statement, go, if you SQL statement is right that you can see the result for you query.
My English is not good, but I can try my best for your problem.
hi
|
|
|
|
|
In my MFC dialog program, the main dialog is a property sheet, with various property pages. When the dialog is open, I want my program to do something special when the user presses (and releases) the space bar. Currently, I'm catching the WM_KEYUP message in my property sheet's PreTranslateMsg function, and returning true if the key is space (the OnKeyUp function doesn't work for some reason). Unfortunately, pressing space also activates the currently selected button, which I definitely don't want. How do I get around that?
Thanks!
|
|
|
|
|
I would say, you should override the OnKeyDown() function instead.
Within that function, check the nChar parameter, and if it is the keyboard button, do your thing, then exit without calling the base class implementation. Or call the baseclass implementation, but change the value of nChar to somnething else that wouldn't be a problem for you.
Get back to us on that, please.
Two Rivers!
|
|
|
|
|
I wasn't able to get my OnKeyUp/Down functions working (in the sheet OR page), so I'm just catching the WM_KEYUP/DOWN in PreTranslateMsg in the sheet.
I finally got it working, by returning true (that function) if the key was pressed down, and by performing the action when the key was released. I thought I tried that before, but oh well
Thanks for the reply!
|
|
|
|
|
I am not using MFC stuff at all. How would overriding OnKeyDown() work? Thanks for the answer.
Thanks
Sean
|
|
|
|
|
Well, you check the parameter passed to this function, and if it's a "whatever you want" you don't call the base class implementation, isntead call whatever you need.
I thoguh it would be pretty obvious"? After all, it's the point (and power) of C++ operator overloading.
|
|
|
|
|
I have a toolbar and am adding text labels to the buttons. The problem is that the toolbar is not sizing itself properly and the toolbar is still the size of a regular toolbar. How do I tell the toolbar to size properly?
-- Steve
|
|
|
|
|
Are you sending TB_AUTOSIZE to cause resizing of the toolbar, or sending TB_SETBUTTONSIZE before adding buttons? Also, are you using Win32, MFC, or WTL, and do you mean sizing verically (text below images) or horizontally (next to images)?
|
|
|
|
|
I'm using MFC and I need to resize the toolbar vertically. I am trying to create Internet Explorer-like buttons. I didn't have a problem in Win32, but MFC doesn't resize the toolbar automatically.
-- Steve
|
|
|
|
|
So did you try sending the messages mentioned in my last post?
|
|
|
|
|
Try:
m_wndToolBar.SetSizes (TOOLBAR_BUTTON_SIZE, TOOLBAR_BUTTON_IMAGE_SIZE);
|
|
|
|
|
Thanks. One more question, how do I check toolbar buttons when using CToolBar instead of CToolBarCtrl? It doesn't have a CheckButton() function.
-- Steve
|
|
|
|
|
You can always get the underlying CToolbarCtrl and call its member functions.
|
|
|
|
|
Is there a way i can check the items without mixing classes?
-- Steve
|
|
|
|
|
Err..
Have you actually read the MSDN docs?
Get it, it's worth it, or go on the net to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfcnotes_tn031.asp
Anyway, you won't be mixing classes. Here's a quote from those documentations:
CToolBar::GetToolBarCtrl, a member function new to MFC 4.0, allows you to take advantage of the Windows common control's support for toolbar customization and additional functionality. CToolBar member functions give you most of the functionality of the Windows common controls; however, when you call GetToolBarCtrl, you can give your toolbars even more of the characteristics of Windows 95 toolbars. When you call GetToolBarCtrl, it will return a reference to a CToolBarCtrl object. See CToolBarCtrl for more information about designing toolbars using Windows common controls. For more general information about common controls, seeCommon Controls in the Windows 95 SDK Programmer’s Reference.
Hope that helps. Essentially, there's no harm, as CToolBar are made from (or using) the CToolBarCtrl .
I suggest you go to the docs... you'll learn a heck lot more.
|
|
|
|
|
The link is out of date. I found the page with Google by enter "TN031 Control Bars".
|
|
|
|
|
Hi,
I need to know how to create an SDI within a MFC DLL so that another MFC Application can open it. Has anyone ever done something like this?
Thanks,
Melanie
|
|
|
|
|
I recommend a dialog box. Here are some useful articles on MFC DLLs.
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
Kuphryn
|
|
|
|
|
I have written 2 articles that cover this. One just does what you want, the other if a big extension of it:
Doc/View from dll[^]
Plug-In Architecture[^]
The first covers your immediate problem. The seconds allows future expansion to yuo application as well.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|