|
Thanks for the reply but my question remain unanswer.
The COM component is third party's so I donot have control on what defined in IDL or whatever technology they used.
I need to pass one argument in IDispatch's Invoke method as below . This is sample code from c# client. I want to pass structure which has byte array and string etc in c++ using IDispatch. How usually people pass structure as single argument in IDispatch's Invoke method()
public class BLOB {
/// <remarks/>
public string contentType;
public System.Byte[] binaryData;
public string ID;
public string URL;
}
|
|
|
|
|
Thomas_Mathews wrote: The COM component is third party's so I donot have control on what defined in IDL or whatever technology they used
OK, but you should have a definition of the interface somewhere - that's the point of COM - you share interface definitions.
Thomas_Mathews wrote: This is sample code from c# client
Do you have a sample of the IDispatch::Invoke call in C#?
|
|
|
|
|
A) There is a webservice and I am writing a client in c++ to invoke that webservice using IDispatch. I have taken the sample for c++ client from codeproject and below is the link
http://www.codeproject.com/KB/COM/xysoapclient.aspx?
fid=13980&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=516139[^]
This is structure we pass in c# for calling method
[System.Xml.Serialization.XmlTypeAttribute]
public class BLOB {
/// <remarks/>
public string contentType;
[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
public System.Byte[] binaryData;
public string ID;
public string URL;
}
B) Regarding writing a client in c# for webservice is pretty straight forward. In C# it is pass complex data in single argument.
OR
If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party.
struct tag{
char str[100];
void *p;
char str1[300];
}
modified on Tuesday, January 20, 2009 2:25 AM
|
|
|
|
|
Firstly - you implied you had a C# client for your COM server, not for some web-service. This would appear to be incorrect...
Thomas_Mathews wrote: I am writing a client in c++ to invoke that webservice using IDispatch
Yeah...don't think that's going to work - the CP article you reference doesn't use IDispatch to call web-services, and really, IDispatch isn't for calling web services.
Thomas_Mathews wrote: This is structure we pass in c# for calling method
[System.Xml.Serialization.XmlTypeAttribute]
public class BLOB {
/// <remarks>
public string contentType;
[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
public System.Byte[] binaryData;
public string ID;
public string URL;
}
The "[System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] " gives it away - this structure is sent to the web-service by serializing the structure contents as a chunk of XML. That implies to me that the web-service is probably using SOAP - maybe you could use something like gSOAP[^] to write your C++ client? Do you have a WSDL file that defines the web-service interface?
Thomas_Mathews wrote: If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party.
struct tag{
char str[100];
void *p;
char str1[300];
}
Strikes me that this is a completely separate problem from the one above - the only connection is "I have a method call that I wish to serialize between a client and a remote (to some extent) server".
Now. This third-party COM server. It must define its interface somewhere. There must be something that tells you what methods it will understand on its IDispatch interface. If you don't have an IDL file, you ought to have a type library (it's usually embedded in the server somehow). Maybe you could try generating an interface to the COM server using #import [^], specifying the COM server DLL or EXE as the thing you're importing?
Also - you cannot send a struct as a parameter to an IDispatch method. Your C# web-service client manages it by converting the struct instance to an XML string which is in a format that both the client and web-service understand to mean the same thing. That means that the web-service can convert the XML string it receives into a struct instance that contains the same data that the client sent. Now, IDispatch does not have this capability. You could layer an XML serializer on top and send an XML string to the COM server as a BSTR. Would it do what you want? Probably not. But that's the thing - you have still not given sufficient detail that we can understand your problem.
|
|
|
|
|
Hi all,
I have made a dialog based application using vc2008....
I have made a worker thread inside that application and that worker thread is calling various other global functions....
But my problem is whenever the task is running and i click the dialog box anywhere on dialog box it starts displaying not responding...
I am not getting how to remove this problem....
can anybody help me in this.....
|
|
|
|
|
When are you starting your thread ? When clicking a button or something ? Can you post some code of the part where you start your thread ?
How is your main thread interacting with the second thread, are you waiting for it to finish or something ?
|
|
|
|
|
Hi,
1.
for good GUI responsiveness you should organize your code such that an event handler (such as a Button click handler) never takes longer than say 30 milliseconds. This implies:
- long computations must be delegated to a thread, backgroundworker, or something similar;
- Thread.Sleep(), Thread.Join() and all kinds of blocking calls are forbidden unless there is a timeout
of only a few tens of milliseconds.
- networking and most I/O are to be avoided (a simple file access to a local file would be OK).
2.
All GUI Controls must be operated on only by the thread that created them, most likely the main thread. Whenever another thread/backgroundworker tries to touch a Control (without Control.Invoke) strange things are bound to happen, most typical would be a total GUI freeze.
3.
The Windows Task Manager interrogates all applications periodically; if it doesn't get a response in a short time (typically because the app failed to observe the above two points), it will report the app as "Not responding" and add such notice to the main window's title.
modified on Monday, January 19, 2009 8:43 AM
|
|
|
|
|
Hi all,
i have an value in terms of seconds like 5400 seconds. (here 1 hour and 30 minute)
how can get value from it in terms of hour and minute.
please help me for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Dividing by 3600 gives you the number of hours (the result will be 1.5). If you round the result down, you get the number of hours (1). If you take the modulo (%), you will end up with 0.5 and you multiply it by 60 to have the number of minutes.
|
|
|
|
|
int seconds = whatever;
int minutes = (seconds / 60) % 60;
int hour = seconds / 3600;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
And see here[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
We have developed an application(Form View) which covers complete desktop and hides it. There are few button controls on the form view. On clicking these buttons, another processes were invoked(using shell-execute).
The problem here is when we ciclk on button(say, button1) another application(dialog based) is invoked and show's the dialog on top of above application(Form View), and again on clicking another button(say buton2) invokes another application(dialog based) and the second click event hides the first application(invoked thru button1) to back of application(Form View).
How can we restrict the application's to be shown on top of application(Form View).
The application(Form View)has styles: WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP;
|
|
|
|
|
What was wrong with the answers you got to this question almost exactly one week ago?
I know I replied with a rambling essay on how screen savers get called to park themselves on a parent window, by passing a window handle as a parameter.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thnx for the reply Iain. I know that I have posted the question before. I couldn't find the post so posted agin.
Can you please refer that link.
|
|
|
|
|
It's easy to find your own posts - click on your name in the forum - that'll take you to your profile page. Then click on 'Messages Posted' - that'll take you to a list of messages you have posted, in which you could find your previous questions.
Re-posting a question you've already had answers to will not get the same answers again - more likely you'll get abuse for a) re-posting and b) appearing (at lest) to be an ingrate.
|
|
|
|
|
Haven't you received your replies by email? The link to your post can be found there.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
Thank you chandra for the link
|
|
|
|
|
i have a proble regarding visual c++ with msaccess.Friends please send me any simple way to access data from msaccess and how to add data to the table and update as well as...
i hope sombody will send me.For those i tell thanks..
|
|
|
|
|
|
If you are using MFC, check out the CDatabase and CRecordset classes. You may also want to read up on what a DSN is, although one is not required.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
I'v a dialog based program with a RichEdit control in it and a few buttons to format the text within it. Now what I wanna do is to be notified whenever the caret positon changes through the lines. (and update the sate of some radio buttons accordingly).
Thank you masters!
|
|
|
|
|
My thinking...
"Golly, what a dumb question. Just look at the edit control, and see what messages it sends back. Probably EN_UPDATE or such."
"Hmm, OK, it's not that... Lets fire up a normal edit and look".
"Hmm, just CTL_COLOREDIT coming back"
lots of other thoughts, but in the end, I found:
EN_SELCHANGE
The EN_SELCHANGE message notifies a rich edit control's parent window that the current selection has changed. A
rich edit control sends this notification message in the form of a WM_NOTIFY message.
To receive EN_SELCHANGE notifications, specify ENM_SELCHANGE in the mask sent with the EM_SETEVENTMASK message.
Note, when there is no selection (that is, the caret is displayed) we have, in fact, the empty selection. Thus,
when the caret position changes (for example, clicking a mouse, typing, or pressing an arrow key), an EN_SELCHANGE
message is sent.
I hope that works for you. Just note that you have to turn notifications on.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|