|
New to COM Events wrote:
Anyway, everything seemed to go smoothly until I ran it and got a Run-Time Check Failure #0 that says the value of ESP was not properly saved across the function call, usually indicating a function pointer declared with a different calling convention than the function.
It's only one reason, the second is the mismatching of account and types of parameters.
Can you show the IDL description of "OnEvent" method?
With best wishes,
Vita
|
|
|
|
|
Hey Vita, here is what th IDL for the events looks like.
[
object,
uuid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"),
helpstring("IEvents Interface")
]
__interface IEvents
{
[id(1), helpstring("method Event")] HRESULT Event([in] int i1, [in] int i2, [in] BSTR bstrMessage);
};
Thanks alot for the reply. I haven't figured this out yet.
|
|
|
|
|
IMHO, this interface doesn't derived from IDispatch, therefore the IDispEventSimpleImpl is inapplicable.
With best wishes,
Vita
|
|
|
|
|
Well, It needs to be derived from IDispatch because it needs to be used in VB as well as C++. Otherwise, sure...there's easier/simpler ways to do it.
Thanks anyway.
|
|
|
|
|
I have a function that "clicks" a link in a document. Basically it finds and 'a' tag and gets the href from it. Then it calls IHTMLDocument2::get_parentWindow and retrieves an IHTMLWindow2 pointer and then calls IHTMLWindow2::navigate passing the url it got from the href. Everything works great in IE 5.5 and 6, but it sometimes opens a new IE window in IE 5.0. And I can't figure out why it's opening new windows sometimes and not other (it's always consistant by the way).
Any ideas?
|
|
|
|
|
The problem is caused by different pages defining different default "target frames" for links. In an HTML document you can define a default target frame which can be one of these (there are others I can't remember right now and haven't listed):
_self: load new page in same window
_blank: load new page in new window
_top: load new page in the top frame window
All you have to do to get constant behavior is use the lpszTargetFrameName variable in the navigate or navigate2 function, like this:
<br />
navigate(sURL, 0, "_self");<br />
This will cause the new page to be loaded in the same window.
Hope that helps!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
hey Alexander, Thanks for the reply. Unfortunately, IHTMLDocument::navigate and IHTMLWindow::navigate don't support specifying the target frame. They only take the URL as a parameter. Also, they don't have a navigate2 function. IWebBrowser does. I think I might have something else going on here though, so I'll just have to look at it some more. Any other suggestions would be great though. Thanks.
|
|
|
|
|
You quite right, I must have misread your original post. You still might check the pages for the default frame, though I think I agree with you that there is probably something else going on. When you say it opens a new window, do you mean a new IExplorer window?
Sorry for the mistake, I'll see if I can figure anything else out.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
Right, It opens a new Internet Explorer window. I haven't been able to check yet, but it's possible that I'm getting a different href than I think. In that case, I could possibly be passing a javascript call into navigate that might be opening a new window...but it's so weird that it's only doing this on IE 5.0 and not on later versions. hmmm...I'll keep looking. Thanks for your help.
|
|
|
|
|
Hi,
I'm new to COM programming and in need of a little help. I'm trying to test some DirectX Filters which are COM objects and have done the following:
I took a DirectX interface called IAMTVTuner and renamed it IAMTest. I want to see if it will still work under it's new name because I am going to end up doing some funky things with it. The problem I think is that the GUID is still associated with IAMTVTuner. I'm not sure how to either: associate the GUID with the IAMTest OR give the IAMTest a new GUID.
Is the association of GUIDs with COM objects and interfaces done in .idl files? I tried running Midl.exe on a file that I changed but I get errors. I'm not even sure if I'm on the right track.
Thanks
|
|
|
|
|
I want to use my interface pointer in new thread and this component is written by pure C++ not using ATL or MFC,my codes as below:
const CLSID clsid={0x7D519042,0x1645,0x4a8c,{0xBD,0xE0,0x0F,0x4A,0x44,0xFC,0x38,0xC4}};
const IID iid1={0x7D519040,0x1645,0x4a8c,{0xBD,0xE0,0x0F,0x4A,0x44,0xFC,0x38,0xC4}};
HRESULT hr=CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
if(FAILED(hr))
{
MessageBox("CoInitialize Failed");
CoUninitialize();
return;
}
ISimpleInterface* ptr1=NULL;
hr=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,iid1,(void**)&ptr1);
if(FAILED(hr))
{
HLOCAL buf=NULL;
BOOL fOK=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
|FORMAT_MESSAGE_ALLOCATE_BUFFER,0,hr,
MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
(LPTSTR) &buf,0,0);
if(NULL!=buf)
{
MessageBox((LPCTSTR)LocalLock(buf));
LocalFree(buf);
}
return ;
}
hr=CoMarshalInterThreadInterfaceInStream(iid1,ptr1,&pStream);
if(S_OK != hr)
{
ptr1->Release();
HLOCAL buf=NULL;
BOOL fOK=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|
FORMAT_MESSAGE_ALLOCATE_BUFFER,0,hr,
MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
(LPTSTR)&buf,0,0);//Error:Interface not registered
if(NULL!=buf)
{
MessageBox((LPCTSTR)LocalLock(buf));
LocalFree(buf);
}
return ;
}
DWORD dwThreadId=0;
CreateThread(0,0,ThreadFun,0,0,&dwThreadId);
hr=ptr1->Sum();
if(FAILED(hr))
{
ptr1->Release();
MessageBox("DoSimpleMsgBox Failure");
return ;
}
ptr1->Release();
CoUninitialize();
How to modify that error,Using functiong of RpcServerRegisterIf2 to Register??? I don't know what to do next,please help me,thanks a lot
|
|
|
|
|
After much research I believe the function CreateObjrefMoniker will solve my problem.
When I look in objbase.h I find this is missing so my project will not compile.
How can I use this function.
Using Visual C++ 6.0 SP5 and MFC
Sara
|
|
|
|
|
I'm trying to print an HTML file using AxWebBrowser.ExecWB in a C# app but it gives a run time error "Trying to revoke a drop target that has not been registered". Does anyone have any suggestions?
axWebBrowser1.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PRINT);
object o = "";
SHDocVw.OLECMDID Print = SHDocVw.OLECMDID.OLECMDID_PRINT;
SHDocVw.OLECMDEXECOPT PromptUser = SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER;
axWebBrowser1.ExecWB(Print, DontPromptUser, ref o, ref o);
Thanks.
|
|
|
|
|
Hi All,
It seems when using attributed COM object in VC7, defaultvalue parameters do not work correctly in late-binding environment.
Asseme I have a method:
[id(1), helpstring("method AA")] HRESULT AA([in, defaultvalue("1")] LONG abc);
In VBScript, I can call it as:
Object.AA 1
but can't use shorter syntax:
Object.AA
If the same method is declated in non-attrbited library (i.e. separate IDL and H file), all works fine. Also, all works fine when early-binding is used in VB6.
I tried to add optional attribute to method, oleautomation and nonextensible to class, but all of this does not help.
Of course, it's possible to forget attributes and write old-style separate IDL/H objects, but it does not seem to be graceful solution.
Regards,
Alex
|
|
|
|
|
I need someone to help me understand temp files created for Word documents. I have visited the link http://support.microsoft.com/support/kb/articles/Q211/6/32.asp
and I have a broad understanding that the ~WRO temp files are Ole Object files. I am using the DSO framer OCX from Msft that can open Active documents. I am tweaking the DSO framer such that Word docs are opened as read-only when viewed in the DSO Framer. I have automated keyboard and menu events such that the document is read-only and content cannot be copy-pasted and so forth. However in the TMP folder I see this ~WRO tmp file that any user can access and copy content from, even though the DSO framer shows the file as read only. I need to program the DSO framer such that this temp file cannot be accessed or is hidden.
I would also like to mention that my version of the DSO framer is not required to allow users to modify displayed documents or save them.
How can I (by automating Word or by modifying my OLE code) transfer data to the local server without creating this ~WRO tmp file ?
I will really appreciate help on this.
Thanks,
Vishal More
|
|
|
|
|
Hello everyone,
I was wondering if it would be a good idea for a thread starter to indicate in his first post, wether his problem was solved, by editing the said post and appending "<-- solved" and the end of the post subject.
Just think it would be nice, and would allow for 2 things:
1) avoid replying to someone that doesnt need an answer anymore. Of course this doesnt mean that you can't add new comments to a solved problem.
2) we could see if what someone suggested did solve the problem and therefore, it could answer someone else having a similar problem.
What do you think guys ?
DarkByte
|
|
|
|
|
i have two module one in Labview and other one in VC++,so how i could integrate them.
piks
|
|
|
|
|
|
I want to use the pointer of an Interface in the other thread,so I have Marshalled my interface in the main thread,my codes as below:
HRESULT hr=CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
if(FAILED(hr))
{
MessageBox("CoInitialize Failed");
CoUninitialize();
return;
}
const CLSID clsid={0x7D519042,0x1645,0x4a8c,{0xBD,0xE0,0x0F,0x4A,0x44,0xFC,0x38,0xC4}};
ISimpleInterface* ptr1=NULL;
hr=CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,iid1,(void**)&ptr1);
if(hr)
{
MessageBox("CoCreateInstance ISimpleInterface Failure");
return ;
}
hr=CoMarshalInterThreadInterfaceInStream(iid1,ptr1,&pStream);//Failure:
if(S_OK != hr)
{
ptr1->Release();
MessageBox("CoMarshalInterThreadInterfaceInStream Failure");
return ;
}
DWORD dwThreadId=0;
CreateThread(0,0,ThreadFun,0,0,&dwThreadId);
hr=ptr1->Sum();
if(FAILED(hr))
{
ptr1->Release();
MessageBox("DoSimpleMsgBox Failure");
return ;
}
ptr1->Release();
CoUninitialize();
I have looked up the error code,it interprets that I don't registered the UI,now how do I register it?
thanks a lot
|
|
|
|
|
Hello,
I am trying to instantiate an ActiveX object. However, I am having some problems with threading. When I try to instantiate it without any threading statements, as follows:
public static void Main(String[] args) {
Application.Run(new SetupCreator());
}
public SetupCreator() {
ESRI.MapObjects2.Core.AxMap map1 = new ESRI.MapObjects2.Core.AxMap();
/*....*/
this.Controls.Add(map1);
}
I get the exception: "Could not instantiate ActiveX control '9bd6a64b-ce75-11d1-af04-204c4f4f5020' because the current thread is not in a single-threaded apartment." So, I did some research, and added the line
[STAThread
to just before main. With that there, I get "There is no source code available for the current location". I found another approach, which adds the line:
Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
and getting rid of the STAThread line. Now, with this in place, I get "Failed to set the specified COM apartment state." So, I am a little lost as to what to do. Any suggestions?
|
|
|
|
|
I have a need to implement a scheduler to automate running our COM+ application. Before I started building my own, I thought I would check if anyone has already created an app that they are willing to share.
Thanks,
Kevin
|
|
|
|
|
I forgot to mention that each COM+ application needs to start in it's own thread.
Kevin
|
|
|
|
|
Hi, I'm a vb6 programmer and want to learn COM programming. My previouse experience is working vb6 and database (such as access or sql server). I want to learn COM by using vb6 programming language. I would like to ask you two questions:
1. Is it possible to learning COM with vb6 programming language? I don't like to use c++, I prefer vb6 because it is easier.
2. Are there any resource to learn COM programming from the beginner?
Please give a comment or suggestion to me
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi ,
U can learn COM programming using VB6 itself. but to understand COM in depth , u need to learn it in C++ . VB hides lot of details from u.
There is something called ActiveX DLL and ActiveX projects in VB6. if u create an ACtiveX DLL or ActiveX EXE project, and write a VB6 class module,
ur one ur way to create a COM object. One can invoke the classes u created in VB6 from C++ or Delphi.
To understand COM in VB , Try to learn what implements keyword does. Try to
read as much as possible. Then there are things like
Automation and IDispatch interface
Dual interface
Explore what is the difference between
Dim x as new ADODB.Command
and
Dim x as object
set x = CreateObject("ADODB.Command")
if u want to create COM objects for ASP which should run at the session scope , ur out of luck with VB. But , if u learn all about implements keyword , writing aDdins etc , u will have good overview of COM.
There is a book by Apress by the name VC++ for VB Programmers . Try to read it .
Hope this helps
Praseed Pai
www.praseedpai.com
|
|
|
|
|
Thank you very much for your idea. I'm fimilar with VB6 but very difficult to learn c++. I used to learn c++ but it seem that it is a very difficult programming than vb6. What I want to do is working with COM programming more deeply with vb6. Thank you very much for your advices!!
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|