|
hi ;
yes i understood you..and you are right there is no other choice and i have to make numerical integraiton.Well since this problem will be yielded outputs from Vb environment according to the user inputs i have to make those numerical calcualtions in Vb environment ..i wsih i could show those function but how maybe i will take the picutre of them from my web cam and show you maybe i can explain it better...you know i know i can apply some numerical techniques to some simple functions but i had never experinced with such hard function so it challenges me any way ..well please correct me where i am wrong, if i use Runge Kutta, one of numerical integration technique,to solve dS/dx which has initial S at x=0 (lower bound) (S initial is known) by selecting step size h =0.1,to the final value of x=10 (upper bound) i get 100 S values....now i want to use this values in another integration (P=int(S,x)) at this time to obtain another P value which depends on those S values
so at the end i have S1 S2 .....S100 (100 S values) and x1 x2 ....(incrementing with h =0.1) as 0 0.1 0.2 0.3......10 (100 x values)
how can make nurmical integration with above values to obtain final P value...
i hope you understand me .i can really understand you clearly...i hope i will solve this problem with your valuable help..
and if you want i can send you a picture of functions taken by web cam this can help you to understand my question well ...
last quesiton does it seems that i cane make those calculations with Vb ?
thanks in advance..
|
|
|
|
|
i think i understand u little.. but still i would like to have some snapshots and clear picture from beginning.. that would help me to understand better..
|
|
|
|
|
hi
i wanted to add this
as i looked from the numerical integration book while
x=[x1 x2 x3 ..etc]
and
S=[S1 S2 S3 .....]
matlab can take integration with trapz(x,S) does it give accurate results
|
|
|
|
|
trapz gives the numerical result using trapezoidal method.. in your case. if s are functions of x.. it will be give you a range of values.. is this what you are looking for??
exmaple
x = [0:pi/100:pi] what is essentially ( 0,pi/100,2pi/100,.....pi)
y = sin(x)
trapz(x,y) integrate y wrt x ang gives u a single value..but if y itself is aset of numbers.. i think output itself will be a set og umbers.. i think u can check this with a small example..
Are you trying to evaluate some double integration kind of thing???
|
|
|
|
|
yes excatly what you mentioned is what i wanto explain ..but this step will be the final step to obtain single value after integration y (in my case S) w.r.t x (in my case FF) and that value will be the P value which i want to get.
But before following such approach i must get S values from that long, complex dS/dFF derivation..i have sent you equn i hope you will better understand..
angle phi (FF) in snapshot is defined as 0
|
|
|
|
|
I am trying to enable and disable a network adapter (not release and renew). It seems the only way to do this is through the shell object. I have been grinding on this problem for over a week. Currently I am stuck trying to apply a 'verb' to an contextmenu object.
Here are two relevent code snippets:
bool FoundOne = false;<br />
bool ContextMenuLoop = true;<br />
CString MenuItemName;<br />
CMenu MyMenu;<br />
MyMenu.CreatePopupMenu();<br />
MENUITEMINFO MenuItemInfo;<br />
ZeroMemory(&MenuItemInfo, sizeof(MenuItemInfo));<br />
MenuItemInfo.cbSize = sizeof(MenuItemInfo);<br />
MenuItemInfo.fMask = MIIM_ID | MIIM_TYPE;<br />
<br />
char Buff[50];<br />
ZeroMemory(Buff, sizeof(Buff));<br />
MenuItemInfo.cch =49;<br />
MenuItemInfo.dwTypeData = Buff;<br />
MenuItemInfo.fType = MFT_STRING;<br />
<br />
<br />
<br />
int Offset = (int)ContextMenu->QueryContextMenu(MyMenu, 0, 1, 30000, CMF_EXPLORE);<br />
unsigned int J;<br />
<br />
for (J = 0; J < MyMenu.GetMenuItemCount(); J++)<br />
{<br />
int T;<br />
T = MyMenu.GetMenuItemID(J);<br />
if (T > 0)<br />
{<br />
MyMenu.GetMenuString(T, MenuItemName, MF_BYCOMMAND);<br />
MyMenu.GetMenuItemInfo(T, &MenuItemInfo);<br />
if (DISABLE_VERB == MenuItemName)<br />
{<br />
FoundOne = true;<br />
break;<br />
}<br />
}<br />
}
At this point I have the context menu object, and actually found the DISABLE_VERB. I also MenuItemInfo for this particular menu item. So far so good...
if (true == FoundOne)<br />
{<br />
HRESULT Hr = NULL;<br />
<br />
CMINVOKECOMMANDINFO Cmd;<br />
ZeroMemory(&Cmd, sizeof(Cmd));<br />
Cmd.cbSize = sizeof(CMINVOKECOMMANDINFO);<br />
Cmd.lpVerb = MAKEINTRESOURCE(MenuItemInfo.wID);<br />
<br />
Hr = ContextMenu->InvokeCommand(&Cmd);<br />
int L = GetLastError();<br />
<br />
<br />
Sleep(100);<br />
<br />
Cmd.lpVerb = ENABLE_VERB;<br />
}
The line in bold is the key line. Its where I set my verb. If I use the DISABLE_VERB, which I just found, it gives me an invalid parameter error (80030057). I set the verb directly, such like Cmd.lpVerb = DISABLE_VERB; when I get this error. I have no idea why since I searched for it and found it.
Next I tried using the wID (as it is done in this code snippet) and while it accepted the parameter, it did the wrong thing (It tried to bridge network connections). I thought the index might be off by +/- 1, but that didn't help.
Can anyone tell me what I am doing wrong?
|
|
|
|
|
- I have developed a simple SDI application which has the ability to draw a rectangle in the client area. (For this i am using a dialog box to get the values from the user and i am using the view pointer to draw the diagram)
- Now i am trying to write a wrapper which is a COM interface to call the draw function in the view of SDI application. But i failed to get the right view handle.
- Could any one suggest any method to get the expected behaviour?
|
|
|
|
|
I found this Question on Google Groups.
hello, <br />
I've created an ATL project and inserted sipmple COM object into it <br />
implementing connection points - at this stage firing the events works fine. <br />
After that i made "class CDialog1 : public CAxDialogImpl<CDialog1>" and <br />
included its .h file in the .cpp file of the COM object class . Than I've <br />
made (with DoModal) a dialog in the COM object base class and it works fine <br />
but how can i throw the events implemented in the base COM object from the <br />
dialog or how can i made conection from the dialog to the base class. <br />
The problems are <br />
1)i can't include the .h file of the base COM object class into the dialog <br />
.h file because they get nested (i've already included the dialog .h file in <br />
the base COM object .cpp - this is needed to create the dialog there) <br />
2)i can't use, lets say CHAIN_MSG_MAP(CMyBase) in the dialog .h file <br />
because CMyBase is not defined at this stage! <br />
<br />
<br />
please help, <br />
miro
And this answer..
Define an interface abstract class in the dialog header and let your dialog <br />
call into it (it is initialized with a pointer to that interface class <br />
before <br />
DoModal). Implement this abstract interface class on your COM object <br />
and pass your this pointer to the dialog before issuing DoModal. Voila! <br />
Your dialog fires notifications without knowing about your COM class <br />
a bit! <br />
<br />
<br />
BTW, an interface class looks like a COM interface, but doesn't need to <br />
derive from IUnknown: <br />
<br />
<br />
class IMyCppInterface <br />
{ <br />
public: <br />
virtual void MyInterfaceMethod(CAnotherClass &rMyClassArg) = 0; <br />
<br />
<br />
<br />
}; <br />
<br />
<br />
As you see, you are not limited with COM types altogether...
--
Can anyone explain to me what the answer means...???
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
If I was to answer the original question I would have asked for more information since I cannot understand why the header file for the COM object cannot be included in the header file of the dialog. The reason given is that "they get nested", which is a common problem solved with preprocessor directives, e.g.
#ifndef MYFILE_INCLUDED<br />
#define MYFILE_INCLUDED<br />
<br />
<br />
#endif
However, the answer suggests that another header file is created, declaring an abstract base class from which the COM object should be derived. The dialog should have a member variable that is a pointer to the newly declared abstract class which sould be set by a call prior to calling DoModal() from the COM object.
The abstract class has a virtual function, implemented by the COM object, that the dialog object calls when it wants to fire the COM event. This is how the dialog can call the COM object without including its header file.
N.B. this is not how I would have solved the problem, but this is what the answer suggests and that was what you asked for...
Hope this helps
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanks a lot for your explanation.
You have said in the end that this is not how you would solve the problem. So how in your would you exactly solve the problem? Would you please explain it!
Thanks...
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
As I stated in my previous post I would have the person who asked the original question to elaborate on the subject since as I understood the problem there is a more intuitive solution with preprocessor directives.
If the preprocessor directive solution is, for some strange reason, not applicable I would have used messages since the COM object already is, or could be developed to be, multithreaded.
In the original question a second problem is described briefly about how he/she was unable to use a message based solution. I don't know whether this is due to incompetence, poor design or something else since there's simply not enough information in the post.
Perhaps a solution like this[^] would do the trick.
LazyKancha wrote: So how in your would you exactly solve the problem?
As you might have guessed by now I cannot suggest a solution to the problem since I don't have enough information and since you are not the original poster I cannot get more information. What I meant was the suggested solution to be somewhat far-fetched since there is an obvious solution that is simpler and if that one isn't applicable there could be more to it than creating a abstract base class.
It was also a hint to you that there could be more to it than meets the eye and if you're having a problem you should post a question regarding your own problem. There is a possibility that the person that replied to the original post has misunderstood the question. There's also a possibility that you have misunderstood the question and hence cannot understand the answer. Even I may have misunderstood the original question and that's why I think it's important to be able to ask questions back to the person that sent the originial question.
However, I suspect that I would have tried to make the COM object class declaration visible to the dialog class since it would the simplest thing to do. But this requires some trade-offs such as the call has to be made from the same thread that created the COM server, i.e. it cannot be called from a worker thread inside the dialog class.
Hope this helps
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Ok.. Let me explain my situation.
I have a COM component which exposes some methods and also implements Connection points. Now, this component contains a dialog derived from the CAxDialogImpl. There are buttons on this dialog. This dialog is displayed through a method in the COM component. I want to relay the button click event on the dialog to the client using the component.
Lets say that the Component exposes a Method .. umm DisplayMyMessage(). This method.. has the Cdlg.DoModal() code. When the user clicks on a buton on the Dialog, the client must be notified of the click event.
Can you help me out.......???
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
At first, I suggest you try to add a function to your dialog class that takes a pointer to the COM server as argument and let the dialog class save it as a member variable.
Use that member variable to call the Fire_ButtonClicked event.
This would be the simplest solution I ment earlier.
This may not work as you desire since you'll be stuck inside the COM server's DisplayMyMessage() routine, or rather the local message loop of DoModal(), and the COM library may complain about this when you try to fire the event.
If this is the case I suggest you start a worker thread from DisplayMyMessage() and pop up the dialog from that thread instead. To be able to fire events from a secondary thread inside a COM server you can use Micheal Lindig's solution[^] which I've used several times with great success. His solution lets you forget about what thread you're firing events from and will take care of the marshalling for you "automatically".
The down-side is a slight performance draw-back since the interface has to be unmarshalled and queried for every call, but it's usually managable and will work (if implemented correctly ).
Hope this helps
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanks a lot. Will try the Michael solution.
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Hello,
How to "catch" doble click on ANY lnk file, but before any windows message (for example, no CD in CD drive,...)?
I mean, how to do it if lnk file point to CD drive and no disk in drive?
And:
How to take the same if lnk file is internet shorcut?
Thank you.
|
|
|
|
|
|
When I used ATL to build a COM, It's named ATLObj.dll.
With a event of OnLButtonDblClk.Code like this:
BEGIN_MSG_MAP(CATLDiceObj)
CHAIN_MSG_MAP(CComControl<catldiceobj>)
DEFAULT_REFLECTION_HANDLER()
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
END_MSG_MAP()
But when I added this Control into a ATL Dialog ,The "OnLButtonDblClk" event function is not responded and added into MFC Dialog is working well.
Can you tell me the reason why it can not respond the OnLButtonDblClk event?
Thanks in advance!
|
|
|
|
|
Make it look like this:
BEGIN_MSG_MAP(CATLDiceObj)
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
DEFAULT_REFLECTION_HANDLER()
CHAIN_MSG_MAP(CComControl)
END_MSG_MAP()
Steve
|
|
|
|
|
But It can not pass to compile project.
Error is like that:
e:\atlocx\atldiceobj.h(89) : error C2955: 'CComControl' : use of class template requires template argument list
d:\microsoft visual studio\vc98\atl\include\atlctl.h(1371) : see declaration of 'CComControl'
e:\atlocx\atldiceobj.h(89) : error C2955: 'CComControl' : use of class template requires template argument list
d:\microsoft visual studio\vc98\atl\include\atlctl.h(1371) : see declaration of 'CComControl'
e:\atlocx\atldiceobj.h(89) : error C2352: 'ATL::CComControl<t,winbase>::ProcessWindowMessage' : illegal call of non-static member function
d:\microsoft visual studio\vc98\atl\include\atlctl.h(1365) : see declaration of 'ProcessWindowMessage'
|
|
|
|
|
I just re-ordered what you had already - If it compiled before why not now?
Steve
|
|
|
|
|
Sorry, I have make a mistake,so it can't compile success, and now it's ok.
But I am sorry to ask you again,it is still unable to respond to the event of OnLButtonDblClk.
|
|
|
|
|
I need to develop a COM component, which fire events.
In COM there is a method named M1 and an event named F1, M1 fires the event F1.
M1()
{
Fire_F1();
}
There will be two applications app1 and app2.
App2 will advise to the event F1 in the COM.
Now when app1 gets the interface of COM and calls M1, app2 should catch the event.
i.e app1->COM->app2.
I mean to establish communication between app1 and app2 thru COM.
I tried with atl dll, but I am not able to succeed.
Some one please help me.
|
|
|
|
|
Hello kk_mfc,
If I understood your specifications correctly, it's quite straightforward actually. Your COM Server must meet the following criteria :
1. It must be an EXE Server.
2. The COM component must be a SINGLETON.
3. The Class Factory of your COM Component must be registered with the REGCLS_MULTIPLEUSE flag (this is already the case by default).
I wrote an experimental COM EXE Server based on your specs. It works well. If you need it, email me directly :
bio_lim_2004@yahoo.com
and I'll send a copy to you.
Best Regards,
Bio.
|
|
|
|
|
Hi,
I randomly get a first chance exception when my application call CoUninitialize(). I dont get it all of the time and the code isnt always the same. I have seen codes 0x800706B5 and 0x80010108. It doesnt appear to cause any problems but it worries me that there may be some underlying issue.
My app is built with MSVC6.0 and I call CoInitializeEx(NULL,COINIT_MULTITHREADED) to intitialise COM
Any suggestions?
TIA
Tony
|
|
|
|
|
These error codes are RPC_S_UNKNOWN_IF and RPC_E_DISCONNECTED respectively. If you're just seeing them in the debugger's output window, and they're being handled - you don't get an unhandled exception message box - I wouldn't worry about them. IIRC the RPC layer which underlies COM does use exceptions to report problems, rather than returning error codes.
It probably just means that you're using DCOM and the target machine either isn't responding, isn't running the same OS as the client, or disappears while you have a reference to an object. I think you might also get RPC_E_DISCONNECTED if the process hosting an out-of-process object crashes or otherwise terminates while you've still got a reference open.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|