|
Hi,
I have a custom window,where i had painted caption,border..
It is fine.But if i keep on resizing.my windows goes crasy.
There is no resource leak in my application.
Can any one help me?
Regards
Neha
|
|
|
|
|
Neha wrote:
my windows goes crasy.
How, what happen ?
Max.
|
|
|
|
|
Hi guys,
I need an opinion regarding a problem I have. I'm an university student working for a company in New Zealand, developing an MFC application which communicates, through a serial port, to an external device. The application will then subsequently retrieve data, stores it in a document object, and update all views currently opened.
There could be many views of the data, involving various line plots.
I've written the first version of this application last year, and we found that the lineplot drawing can be very intensive, the User Interface becomes very slow to respond to user clicks, etc. I've looked at maximising the drawing calculations, but there's simply not much I can do to improve it further.
The boss surely enough doesn't like this ^^ He wants some improvement made.
At the moment, I'm thinking of creating a UI thread for each separate view. That is, everytime user wnats to open a new, say line plot, a new UI thread will be spawned off and in turn a new frame and view will be created to display the data.
The problem comes about because data will be continually updated, so the thread must have access to the actual document object, and the mainframe menu must continually be adjusted to account for the different view. For example, when the view is a line plot, certain toolbars must appear, which can be quite different from when a table is displayed.
I've been looking all over the net and MSDN for information, but it seems that there is a great reluctance to tackle the multithreaded SingleDocument-Multiple View approach. Nasty, they say =P.
I was wondering if nybody can give me some pointers to creating a multithreaded SD/MV framework.
Thank you very muc h. I would greatly appreciate any help anybody can give me.
|
|
|
|
|
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".
|
|
|
|
|