|
got it.. i havent been able to import the api properly.
how do i import kernel32.dll in my com dll if i wanna use gettickcount??
pls help
thnks
nikhil
|
|
|
|
|
I think you can use the LoadLibrary and make a call to GetTickCount function using the GetProcAddress
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Hello,
I am using MFC - ActiveX control in C# based windows application.
I am not able to debug the control with the C# application while it is possible with the MFC applcation.
Is it possible to do so if yes then HOW.
Thanks.
Byee..
Gajesh
Pune(India
|
|
|
|
|
Is that DCOM is implemented through Microsoft Transaction Server. If not so then how it is implemented.
|
|
|
|
|
DCOM stands for Distributed COM, and refers to the ability to call COM objects running on another machine. DCOM is implemented over DCE-compatible Remote Procedure Calls [RPCs]. CoCreateInstance calls from the client are translated into a message that's sent over the network, which is received by the server computer's RPC subsystem, the RpcSs service. In modern versions of Windows, this service runs in a SvcHost.exe process. The RPC subsystem locates a process to serve that class, starting one if necessary, and calls the process on the client's behalf. I'm not sure if the system then hands the network connection over to the server process so that future calls don't have to go through the RPC subsystem. The exact network protocol used, below the RPC protocol, is dependent on the configuration and on which network protocols the system has installed. On Windows XP and Server 2003 machines, only connection-oriented protocols such as TCP are enabled by default; earlier versions could use UDP if the call security didn't require a connection.
MS Transaction Server was a way of setting up different contexts for objects, to allow them to interact without knowing about one another. It offered transaction support, object pooling and just-in-time activation. You had to program a little differently for MTS than for COM. In Windows 2000, MTS was incorporated into the regular COM APIs and was renamed COM+. With MTS and COM+, it's possible to have a COM component implemented as a DLL but still run outside the creating process, using a surrogate process (dllhost.exe). To communicate between processes running on the same system, COM uses a special form of RPC called Local RPC.
DCOM predates MTS by a couple of years.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello world!!!
I created a UPnP device which works as a control point. It succeeded but now I'm facing a great problem. I'm trying to register the device with the host in order to be published on the network. But the IUPnPRegistrar::RegisterRunningDevice method doesn't work. The return value of this is an E_FAIL which is a non-specified error value. Thus I think the DLL in which I wrote the device control object is bad. So I need a help from anyone who have already registered a UPnP device or anyone who know very well how to process.
Thanks for the help.
|
|
|
|
|
My ActiveX project has some problem, It's Can't Add Method and Property. It's hint Error adding a(n) method to the associated class.I'm use vc6+sp6.
tell me why ,thank you.
msn:Flashcutreg@hotmail.com
|
|
|
|
|
* Make sure all relevant files are not read-only
* close VC6, delete the .ncb and .clw (if any), then try again
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
Hi,
I want to add content to a view derived from MFC's CHtmlView from a thread.
The following code is a stripped back version of the code executed by the
thread.
CMyHTMLView::AddHTML()
{
HRESULT hr = CoInitialize( NULL );
ASSERT( SUCCEEDED( hr ) );
string shtml( "Hello World" );
try
{
CComQIPtr< IHTMLDocument2 > pHtmlDoc( GetHtmlDocument() );
if ( pHtmlDoc )
{
CComQIPtr< IHTMLElement > pBodyElement;
HRESULT hr = pHtmlDoc->get_body( &pBodyElement );
if ( SUCCEEDED( hr ) )
hr = pBodyElement->insertAdjacentHTML( _bstr_t(L"beforeEnd"), _bstr_t( shtml.c_str() ) );
ASSERT( SUCCEEDED( hr ) );
}
}
catch( _com_error e )
{
REPORT_COM_ERROR(e);
}
catch(...)
{
}
CoUninitialize();
}
If the contents of shtml is small as shown above it works fine. However when
shtml is a few K of HTML the call to insertAdjacentHTML() throws an
exception which is caught in catch(...). The HTML is valid and the same code
works fine when it isn't in a thread. In the real code, shtml is on the
heap or maybe the stack?
Any clues about what I'm doing wrong?
Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
|
|
|
|
|
It could be something to do with thread-local data, a lot of MFC uses it. I've had problems trying to manipulate objects from threads - usually you have to do the work in the thread that created the object, but presumably this takes away the point of what you're trying to do.
It won't matter if shtml is on the stack or heap, but you should check if insertAdjacentHTML completes when the function returns or maybe it takes the data, returns and then some other thread processes it. Some of the html stuff has other threads to do work. Have you tried putting a sleep in after the insert to give it time to complete?
|
|
|
|
|
Hi Keith,
Thanks for the reply. I got the following reply on an MS Newgroup, which explains things.
You cannot simply pass COM interface pointers to a worker thread - you
need to marshal them. See
http://support.microsoft.com/?kbid=150777
MSHTML is a single-threaded component. If you don't marshal the
pointers - in violation of COM rules - you'll likely get random crashes.
If you do marshal, then any call you make in the worker thread though
such a pointer gets marshalled back to the main thread, executed there,
and any results marshalled back to the worker. Essentially, the worker
thread isn't doing any work, it spends all its time waiting for the main
thread to serve its calls.
Bottom line: it's pointless to perform DHTML manipulations from a worker
thread. You add pure overhead, without gaining anything at all.
I was already working on implementation that built the HTML in a thead and
added it to a queue for the app thread to display. My main problem was
getting the main thread to be a bit more responsive when large chunks of
HTML are in play. After a few different implementations, I've now got
something I'm quite happy with.
Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
|
|
|
|
|
If you are using the use the interfaces in a different thread than the one creating the control, you need to marshal it to this thread (CoMarshalInterThreadInterfaceInStream and CoGetInterfaceAndReleaseStream, which probably were made to win the WIN 32 API lyrics award)
chopping strings usually isn't a symptom of violating apartment boundaries, but MSHTML ctrl has a few message loop interacitons that make that possible.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
I'm trying to register a dll on a Win2003 server, but an getting the message "DllRegisterServer in ...filename... failed. Return code was 0x8007007e". This error supposedly means a module is missing. I think all the DLLs are there - it's a standard atl dll.
I can register the dll fine on my development pc and on another Win2003 server, just this one I can't. I tried loading up the registry entries manual, but I just get an error when I try to use createobject.
Any ideas why I can do it on one server and not another?
Thanks
|
|
|
|
|
Use a dependency viewer, like "Depends" which comes with MSVC6), to view the dependencies of the COM DLL. It will highlight missing DLLs.
Steve
|
|
|
|
|
Done that, there aren't any missing. I'd get a LoadModule failure if a dll was missing.
|
|
|
|
|
Have found the problem now - atl.dll was not registered!
|
|
|
|
|
Hi,
I'm trying to paste clipboard content in an outlook message window (new mail/reply) from an outlook addin (when a button is pushed)
I'm using VC++ 6, and the addin is based on several good articles from codeproject.
I was able to create a button in the message window, but I didn't found a way to paste content in this window through the Office API.
So I used SPY++ to get the structure of an Outlook message window and sent a WM_PASTE event to the body control handle. (Using Active window, FindWindowEx and SendMessage)
This works fine for text and rich text emails ('RichText20' window class), but I can't make it work for HTML mails (Window class is 'Internet Explorer_Server').
Since WM_PASTE event was not working, I managed to get an IHTMLDocument2 pointer on this control and tried to use execCommand( _T( "Paste" ) , ...) but nothing happens. On the contrary, when I use execCommand( _T( "SelectAll"), ... ), it works.
I'm running out of ideas on this, so i'm looking for hints.
Basically , I only want to insert text/links at the cursor position.
I think that if I can get an IWebBrowser2 pointer for this control, I should by able to send the event using execWB (I already did it in IE)
How Internet Server_Explorer handles Ctrl-C events ? Is it using another control ?
Do you know a better way to do this ?
Thanks
--
Nicolas
|
|
|
|
|
Hi again,
I found the solution.
I use Outlook::_Application to get the active inspector
I'm then able to get the editor type and the HTML editor in a clean way.
An interface query on the html editor gives an IHTMLDocument.
Insertion is done using get Selection and IHtmlTxtRange. (see http://starkravingfinkle.org/blog/2005/01/)
--
Nicolas
|
|
|
|
|
I heard Mac OS suports COM. Is that true? Do unix ,linux or QNX support COM or COM is just a binary standard on windows?
|
|
|
|
|
Hi,
I have developed a MFC ActiveX control and embeded it in IE. The control is working fine but when another instance of IE is opened using Ctrl+N, I am getting ASSERT exception in debug mode and in Release mode IE crashes.
Note that if the second instance is opened without using Ctrl+N (i.e by using explorer icon) no exception arrises.
what could be wrong. your support is highly appreciated.
Thanks
Muhammad Azam
|
|
|
|
|
You've obviously got a problem with your control when more than one instance of it is created. This is probably a threading issue since IIRC Internet Explorer creates a new thread for each browser window. If your control is marked apartment-threaded (which it is, by default), then the second instance of your control will be running on a different thread from the first.
When a second instance is opened by using the icon, a new IEXPLORE.EXE process is created. This gives a whole new address space, so the problem does not occur.
It might help diagnose the problem if you post the file and line number on which the ASSERT occurs.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks a Lot Mike, your answer has given me a new dimension to think. first of all i need to know 2 things
1. what is
Mike Dimmick wrote: IIRC Internet Explorer
and what it does?
2. how co i know whether my control is
Mike Dimmick wrote: marked apartment-threaded
and is the problem due to the fact that you wrote:
Mike Dimmick wrote: your control is marked apartment-threaded (which it is, by default), then the second instance of your control will be running on a different thread from the first.
yes the line where i am getting the Assert is, when i try to access Frame window ( that i have created in my control) using AfxGetApp()->m_pMainFrame or AfxGetMainWnd() .
thanks once again for your response
Muhammad Azam
|
|
|
|
|
This is the first time I've worked with an OCX in C and I'm having trouble getting it to run. I'm trying to use a barcode control[^]. This is not a visual application, there's no gui, I'm using it to print barcodes.
I used the class wizard to import it, it created an ezbarx32.h/cpp. I seem to be able to successfully create it using
COleException tvExerror;
_DBarcode Barcode;
if (!(Barcode.CreateDispatch("EZBARX32.BarcodeCtrl.2", &tvExerror)))
{
char tvBuf[10];
itoa(tvExerror.m_sc, tvBuf, 10);
throw CEMException(CString("CreateDispatch() failed! - ") + tvBuf);
}
but as soon as I try to call a method
Barcode.SetBarcodeType(22);
I get an un-handled exception. Debuging into it I find that this call in the libraries
SCODE sc = m_lpDispatch->Invoke(dwDispID, IID_NULL, 0, wFlags,
&dispparams, pvarResult, &excepInfo, &nArgErr);
returns 0x8000ffff in sc which causes the error checking code after it to report an exception.
Anyone know what I might be missing? I know the control works, it's used in some programs in other languages without any problems.
|
|
|
|
|
can somebody pls explain what this piece of code means??
"Data" is used as a datatype throughout the idl file but isnt it an object...?? and why typedef the uuid? im a novice programmer pls help
<br />
typedef [uuid(----- ----- ------------ ---------), version(1.0)]<br />
enum {<br />
None_o = 0,<br />
Endpoint_o = 1,<br />
Midpoint_o = 2,<br />
Nearest_o = 3,<br />
Perpendicular_o = 4,<br />
Intersection_o = 5,<br />
Tangent_o = 6,<br />
Quadrant_o = 7,<br />
Node_o = 8,<br />
User_o = 9<br />
} Data;<br />
im inserting activex controls in a com. this a part of the idl generated from the ocx.
-- modified at 6:32 Wednesday 28th June, 2006
|
|
|
|
|