|
Hello,
I wrote a program who is not UI dependent. I have all my program logic in a class and I raise some events for any potential frontend.
I can then create a console application or a Windows form application using the same program logic.
The frontend just run a thread using the run() function of my main class (UI independent) which do all the job.
This main class also creates internally several threads performing various tasks in parallel. Since all this threads are just pure computation I have no problems.
But I recently wanted to create forms in some of these internal threads running in parallel and I have been unsuccessful for far
What happens is that forms get created but are not responsive at all and the internal threads get stuck. How can I create these forms and make them run independently in each thread ?
Here is schema:
Frontend (Console or Form, main thread)
|
|
Main class (running in a thread)
| | | | |
| | | | |
Child threads (computation)
x x x x x <-- child threads can not work with forms
x x x x x <-- how to call functions in those forms ?
Child threads forms
Any idea ?
R. LOPES
Just programmer.
|
|
|
|
|
|
Hello,
I understood I have to use invoke from threads to call methods in controls.
But what about creating forms from threads ?
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
|
Hi,
My goal is to have several forms running independently. Each form has its own thread doing a specific computation.
One example could be to have several forms embedding the webbrowser control and automatically crawling a different website. All will run in parrallel.
Any idea ?
R. LOPES
Just programmer.
|
|
|
|
|
|
Hello,
I would like to know if it is possible to use the webbrowser control just to navigate a webpage and then traverse its DOM, without creating a form and even in a console application ?
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
Lookup a sample called WalkAll in MSDN.
|
|
|
|
|
Hello Stephane,
Ok but WalkAll uses only the MSHTML component. I'm trying to use the WebBrowser control because it adds a lot of navigation stuff I would like not to take care of.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
UI --> iexplore.exe | web ocx
no UI --> walkall
Both have the DOM and the IWebBrowser interface (shdocvw) to play with.
|
|
|
|
|
Hello,
Ok then. So what is the DLL I'm supposed to use ?
Shdoccvw or mshtml ? Or both ?
And what happens without any UI when a NewWindow event is trigerred ?
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
GriffonRL wrote:
Ok then. So what is the DLL I'm supposed to use ?
Shdoccvw or mshtml ? Or both ?
the primary dll is shdocvw which provides the url navigation.
then, if you query interface and request the IHTMLDocument interface (if you want to play with the DOM), mshtml.dll is automatically loaded.
GriffonRL wrote:
I'm supposed to use ?
You are using COM interfaces. Why should you bother about the DLLs themselves?
GriffonRL wrote:
And what happens without any UI when a NewWindow event is trigerred ?
An event is what you make of it. The UI less sample in walk all does not register itself for events, so it will never receive them.
If you want those events, you've got to add a look up on the COM server IConnectionPointContainer interface waiting for you. (there is sample code for that in Codeproject, MSDN, ...).
|
|
|
|
|
Hello,
I think I am missing something
I used to use the webbrowser control (shdocvw) for simpler programs because I understood mshtml was only the HTML parser/Javascript interpreter/DOM builder and I wanted to keep the UI.
I know how to walk the DOM using the mshtml interfaces. But I don't know what kind of object I have to create from shdocvw to provide me with url navigation without the UI mess.
I tried several things like creating WebBrowser,IWebBrowserApp,IWebBrowser2 interfaces but I get errors when calling the Navigate2 method (some COM exception) !
Forgive my ignorance but I am currently stuck and lost with all the interfaces/classes from shdocvw .
Any help, advice or link to relevant articles are welcome. Also for examples using the IConnectionPointContainer you are talking about.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
Hi there, I need a helping hand.
I have an unmanaged interface written in c++:
struct IUnmanaged
{
~IUnmanaged () {};
void func1 ( int ) = 0;
void func2 ( int ) = 0;
};
And I have an unmanaged class derrived from the interface:
class CUnmanaged : public IUnmanaged
{
void func1 ( int );
void func2 ( int );
};
Now I would pass the interface as a function parameter to
my managed COM object wich is written in C#:
HRESULT hr = S_OK;
CUnmanaged myUnmanagedClass;
// do all the COM stuff to get myManagedComObject ...
myManagedComObject->PassUnmanagedInterface ( & myUnmanagedInterface );
And now my question:
How do I have to declare the above IUnmanaged interface in
C# ???
Please Please Help Me ,
Thanks
|
|
|
|
|
Does anybody know how to get the context menu of a file or a directory ?
I want to put the menus in my app.
Thank you !
|
|
|
|
|
Are you trying to write shell extensions for explorer, in which case there is a sample available in the Interop section under Technology Samples in Framework sdk. If its for use inside your application, there is a menu control available which you can use it to create context menus.
Cheers
Kannan
|
|
|
|
|
have a look in the registry eg for HTML files took in HKCR\htmlfile and then look in the shell folders - this is what the system uses to build its menus
also you will have to look in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts for some other actions
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Hi folks - got a slight problem with getting a leave event to fire when selecting a property grid - hope someone can help...
On a usercontrol, code a leave_event for a richtextbox to show a messagebox when fired and place a propertygrid control on the form.
Bind the propertygrid to another control using SelectedObject property (a separate textbox or whatever) and when you try to leave the richtextbox, the event will not fire if focus is placed in the propertygrid. The event only fires when you select something else (ie the separate textbox).
Trouble is, if you create the exact same scenario directly on a form rather than on a usercontrol everything works and fires as expected - any ideas?
Regards
Martin.
|
|
|
|
|
Hi all,
I've one dataset that contains only one table that have
this field:
ID CODE VERSION
1 1000 1
2 1000 2
3 1001 1
I want if it is possible filtering this dataset (better
with DataView object) by code. Code must be unique for
the version. Thi dataset filtered is the input for my
combobox control that must contains this value:
1000
1001
Is it possible ?
Thanks for answer.
|
|
|
|
|
- Add a DataView component;
- Set its table to the table in your dataset;
- Set the RowFilter property to 'VERSION = 1', without the quotes;
- Bind the combobox to the data view;
- Sit back and bask in the glory of solving your problem
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Thanks for your answer.
The problem is that I can't set the RowFilter property to 'VERSION = 1', because I must filter this property with the major version for that code.
Is it possible ?
|
|
|
|
|
VERSION = '1' OR VERSION LIKE '1.%'
If VERSION is a string then I think that should work.
Paul
If you need me, me and Neil'll be hanging out with the Dream King - Tori Amos, Tear in Your Hand
|
|
|
|
|
Sure it's possible:
string majorVersion = GetMajorVersion();
this.dataView.RowFilter = "VERSION = " + majorVersion;
All you need is a function that will get the major version for the current assembly; off the top of my head I can't remember how you do that, but I'm sure a quick question here will provide the answer.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi!
I have a structure defined in my old unmanaged class, which is a output parameter of one of my methods. I want to create a managed C++ class which "wrappes" my old one.... the question is:
Which Marshall Type Conversion must I use in order to pass the information of this structure to my managed class and viceversa?
CODE
------------------------------------------------------------------------------
void Extract( Feature* *MyFeature);
------------------------------------------------------------------------------
Feature is the structure which is really the output of my method...
Thanks in advance!!!
|
|
|
|
|
That would depend. Is the struct a POD type, or does it have member functions? If you could give an example of the "structure" of the struct, this would be easier to figure out.
Cheers
|
|
|
|