|
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
|
|
|
|
|
VB6 programming language entirely may develop COM ,but also simple and quickly. The resource really is not a problem to a programmer , the network is so large , and takes a little time then you 'll gain a lot of infomation.
thank u
|
|
|
|
|
I'm programming a little software with MATLAB. I would like create a heading "help". I suppose that I must include an activeX but I don't know it.
Any help will be appreciate.
thanks
fredf
|
|
|
|
|
What is the best way to get an IStream interface pointer on an existing file? I am using Visual C++ 6.0.
Man Learns from History that he never learns from History
|
|
|
|
|
AFAIK, there is no known implementation for files. I implemented it myself, which is pretty straight forward.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I found the SHCreateStreamOnFile function. Was wondering if there was somthing in the STG group of functions that I could use.
Man Learns from History that he never learns from History
|
|
|
|
|
Hey, thanks for the function. I haven't seen it before, and certainly not in the STG headers.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I have one module in Labview and other one in MFC ,how i could integrate MFC with Labview.
|
|
|
|
|
i have used [in,out] in my COM method but when i call my method from ASP it gives error "Type mismatch: methodname" . i have also used CInt() for my int variables , but now it shows nothin when i respons.write my variable.
e.g
In COM
power([in]int num,[in] int pNum,[in,out] int *res)
In ASP , i calling it
myObj.power num1,num2,CInt(num3) 'this gets nothin in num3
if i go like that
myObj.power num1,num2,num3 'gives error Type Mis-match:power
aby idea abt this????
|
|
|
|
|
Ok, just making sure here:
The reason you make it [in,out] is because you provide some information and expect possible different information back, right ?
If not, if all you want is to return a value, you should use [out] only, althought for int values it shouldnt make much of a difference. If you return only 1 value, i suggest you use [out, retval], in which case, you can assign to a variable like: var = myObj.power(num1, num2).
If you use CInt(num3), ASP actually creates a new, invisible, variable to store the conversion and your returned value isnt accessible, even if it is actually returned somewhere.
what you might also need is the equivalent of addressof(var), or &var in your script engine. so you might have to do something like myObj.power num1, num2, addressof(num3). I'm not sure exactly if this is a requirement but i expose it just in case.
by the way, which scripting language are you using ? VBScript or JavaScript ?
|
|
|
|
|
Yes , u r right, i want to provide some info to method and get processed info from method. i have used [out,retval] , it works fine but i want to get multiple variables out of method that's y using [in,out]. i m using VB Script. well is there any addressof(var) operator exists in VB script. if so do tell me or any equivalent function to do this.
|
|
|
|
|
Hmmmmm, VBScript...
Ok, do you declare your variables before using them ?
Dim num3 as Integer
myObj.power 2, 3, num3
this should theoreticly work. Reason should be, if you dont declare your variable, the variable is defined as type Variant which is not what myObj.power expects.
|
|
|
|
|
hi
If u want to return a value back to asp from an interface method, that variable shud b of type VARIANT type. There is no other go. So the IDL shuld be [in, out] VARIANT *pOut1, [in, out] VARIANT *pOut2, ..., ... for all the variables u need to return a value back to asp. This way u can have any number of in-out parameters for an interface method.
rgds.. mil10
|
|
|
|
|