|
Ted Ferenc wrote:
whereas a single threaded app could be waiting for some input/event whilst trying to process the data.
umm, don't you mean a multi-threaded app?
A single thread will cycle through the processing algorithm and not return until complete. The multi-threaded app can process the data AND recieve messages from the user.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
What as I was trying to say was on a single CPU machine, multithreaded, the CPU usage will probably be 100% but if only one thread is used it could end up waiting for some event therefore it will not use 100% CPU time, but there is an overhead of course. But if multithreaded the likelyhood is that one thread may be waiting but another should be processing.
I fink my grammer was not correct, sorry
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
how can I capture the content of a fullscreen directx window.
I have absolutely no idea how this could be done.
thanks
widi
-
|
|
|
|
|
Is it "your" window? Then I believe it should be as simple as GetDC for the display surface and blit it to a bitmap.
|
|
|
|
|
No, it could be any (I guess mostly) fullscreen-game-windows.
-
|
|
|
|
|
|
Hy.
I'm trying to create a program that needs plugins. My problem is that i found quite a few methods of creating plugins, and i don't know wich method to use (wich one is better).
Anyway, here's what i need to be able to do:
- plugins must be able to access a list of data from the main program (for modifying it)
- plugins can show their own dialogs when executed
- i'd like to implement a Plugin Config system like Winamp3 has (there's a tree with each plugin as a treenode, and when you select one of them, the right side shows the plugin's config dialog)
- plugins should be able to add new commands to the main menu and toolbar of the application that loads them.
- also, the user should be able to select wich plugins not to load
So, if anybody has a good ideea on how can i make this all, please help me.
|
|
|
|
|
I have written a plugin system for a game launcher, and it works very fine and very similar to the one in Winamp2. The exe loads all .dll files in the plugin directory using LoadLibrary() . Of yourse you can make it selectable which files should be loaded.
In order to access data from the main program I have an exported function in my DLL that accepts a pointer parameter, here's an example:
extern "C" __declspec(dllexport) void _stdcall OnJoinServer(const hlla_SERVER* server)
Before you can user any exported functions I find their address in the DLL using GetProcAddress()
To bring up a configuration dialog I export e function in my DLL called OnConfigure ; the exe calls this function if the user clicks on "Configure" in the main app. Inside the OnConfigure function in the DLL I simply open the configuration dialog using DoModal() .
When my app finishes I close all handles to the plugins (dlls) with FreeLibrary()
regards
Greg
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Well, i've found a system that does the loading/unloading for me (look at http://www.codeproject.com/dll/plug-in.asp).
My problem is that if i create MFC Extension DLLs, the LoadLibray and FreeLibrary functions don't work. So, i didn't find any way yet to use MFC classes in my DLLs.
I need some help with this part, as this i think is the most important one (as my DLLs will use MFC classes)
For the shared memory part (the list of data that plugins have to work with) i think i can send a pointer to that data (each plugin has a function that asks for that pointer), if anybody has a better ideea, please tell me.
For the Winamp like configuration i suppose that's not that extremly important, so i could leave it for a latter time (or leave it out completely from the project), so for now each plugin shows its own dialog with configurations.
|
|
|
|
|
LoadLibrary and FreeLibrary work like a charm for me in MFC Extension DLLs
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Then i'll have to look over it again, maybe i made some mistake.
Anyhow, i'll get back with more info (i'll have to make some tests).
Thanx anyway.
-----------------------------------
Ok, i looked it over, it didn't load the dlls as i made a mistake when i declared them, now i can load MFC extension DLLs too.
Thanx.
|
|
|
|
|
Im in the process of developing an application that requires a imilar plugin architecture. However, unlike the last response, I have chosen COM as a way of handling such things. I have not solved, or identified all of the problems associated with doing it this way, but heres the basis for my design.
- Component Categories in COM would allow my applicaiton to load any registered component on the system thats fits into my architecture.
- Using a simple, but efficiently designed interface that will allow my app to identify, and understand each component. This interface would be common across every "plugin".
- an IConfig interface could handle executing the plugins configuration, but the implementation would be specific to each plugin.
- The main applicaiton contains the list of useable and loaded plugins. It could then easily generate a tree view that lists each plugin as a node along with access to the IConfig interface.
- Almost every plugin will be presented as an child window in an MDI application.
- My applicaiton would require multiple intances of each plugin.
- I have not solved the problem of presented a common data source to each of the plugins, but im also new to COM and have a shipment of books from Amazon heading my way.
Ryan Baillargeon
|
|
|
|
|
Just remember if you allocate memory from your DLL you have to free it from your DLL. One way to get around this is to pass a function pointer to your DLL for allocating memory.
Todd Smith
|
|
|
|
|
I'm about start a new MFC project and I have fallen at the first fence! I can't decide what type of project to create.
The project will record data (from an instrument on the RS232 port) and display the data as a graph. When it is complete the user will be able to store the data as a file, and view those files at a later date. Also, they can load other files in and overlay them with the existing data.
I think I need an SDI project because I need to open files and I want the File menu, but then how can I overlay one file over another or display data 'real time'? I've only ever used the view class to display data from a file.
Or could I use a Dialog project and add my own menu, 'Open' 'Save' but that sounds messy and I don't know where to start. Any ideas / advice?
Thanks,
Ali
|
|
|
|
|
Alison Pentland wrote:
but then how can I overlay one file over another or display data 'real time'?
Sounds like SDI/multiple views or SDI/single view with a non-modal dialog for the graph.
You probably have to overwrite the open file part of your document class with your own code.
If you have ONE set of Data, shown in different ways in different views -> SDI
If you have many unrelated data sets (like documents in MS-Word) -> MDI
Just my 2c
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
jhwurmbach wrote:
Sounds like SDI/multiple views or SDI/single view with a non-modal dialog for the graph.
Thanks for answering. Yes, I have only written one app before, but it was similar and I used a modeless dialog box when the data was being recorded and displayed the files using the 'CView' class later.
The difference with this app is that they need to be able to overlay old data while they record new data, so that they can look at trends while they happen. I guess I could do this in a modeless dialog box by adding a button called 'Overlay' then calling my own File Open code.
But I still will not be able to overlay stored files together using the Doc/View architecture because you can only have one file per view can't you?
Or have I got that wrong?
Thanks,
Ali
|
|
|
|
|
Alison Pentland wrote:
The difference with this app is that they need to be able to overlay old data while they record new data
That would mean that your 'data source class' adds new data items to the CDocument -derived class and this generates UpdateAllViews() , possibly with a specific (arbitrary) Number as a Hint on witch your Views redraw itself.
Or your View update themself in fixed intervals (using a timer). Either way, Data is only to be held in the Document, and views (and non-modal dialogs) show it.
As with overlaying different files:
You would have to do the loading yourself, that is true.
But you can overwrite the OnFileOpen() -code in the Application class to allow for opening more files with one Document.
Your views have then only to iterate over the vector of loaded graphs and display all of them one after another.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
I'd go either SDI w/ modless dialogs for graphs as stated above, or go dialog-based with modless dialogs for the graphs.
If you don't have a data storage/retrieval class yet, check out my article, CDataFile[^]. I do a lot of what you're talking about.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
OK, I see you are both recommending the same thing, but what do I do about overlaying stored files in Doc/View? You get a new View for each Document don't you. Any ideas? (Sorry if I'm being stupid here).
Nitron wrote:
If you don't have a data storage/retrieval class yet, check out my article, CDataFile[^]. I do a lot of what you're talking about.
Thanks for this, I will definetly give it a look All help gratefully received!
Ali
|
|
|
|
|
I'm not too familiar with the DOC/View archetecture, but you can handle multiple files within a std::vector, and control how many views you want. I keep track of multiple files using:
std::vector<CDataFile>m_vFiles
Good luck.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi,
I'm changing my MainFrame's Title when I open a new view.But when I close this view Title is setting back to previous like when my application was opened for the first time.can anybody give me the suggetion to change the Title which does not changes even any view is opened or closed.this is very urgent.
thanks in advace
rgds
Thomas
ThomasKennedyBose
|
|
|
|
|
As far as I know you can't set a title for the whole runtime. But you could try to handle WM_SETTEXT and there don't let it set your caption. If this doesn't work you should set your title even when a window get's closed.
|
|
|
|
|
Ya.............u r right......v have to set the caption even the new window gets closed.Thanks a lot.
ThomasKennedyBose
|
|
|
|
|
Will YourMainframe.SetWindowText("Test") not work?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Perhaps you read over it, but he mentioned that the title of his mainframe is set back after closing a view. Thus his problem should not be a problem of SetWindowText.
|
|
|
|