|
Hello, everybody.
I've got the ActiveX that runs in IE (look at http://www.sochi.ru/confa/stone/defaulte.asp if interested).
Now if I even upload a newer version of ActiveX, IE doesn't detect that and runs an old version from its cache. How can I enable IE to automatically detect and nownload new versions?
|
|
|
|
|
Hi, I'm a begginner with activeX, but I'm not so bad whit MFC. For now I have a good book to learn ActiveX, but I'm unable to insert any of them in a CView...
So the first step was to learn: ActiveX, make you're own and know how it work
but I'm searching: ActiveX --> the next step how to create it in you're MFC document/view application dynamicaly
by the way my activeX is a control, so It must be displayed
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
Hi to Myself,
it look like anybody is able to answer me so I will (because I've find) so
To create a ActiveX in a CView (just to create it to make it work properly... maybe later)
First add a CWnd member in you'r class
class MyView : public CView
{
CWnd m_ActiveXControl;
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE_MAP()
};
then in the create function you must create you'r activeX control. The CWnd is the wrapper for you'r active X so you do that way :
BOOL CTestViewAsAContainerView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL Ok;
dwStyle |= WS_CLIPCHILDREN;
Ok = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
Ok &= m_ControlWrapper.CreateControl("MYACTIVEX.MyActiveXCtrl.1",
"",
WS_VISIBLE,
CRect(0,0,100,100),
this,
5000,
NULL,
FALSE,
NULL);
return Ok;
}
then the on_size to size if
void CTestViewAsAContainerView::OnSize(UINT nType, int cx, int cy)
{
CRect r;
CView::OnSize(nType, cx, cy);
GetClientRect(&r);
if(!r.IsRectEmpty())
{
m_ControlWrapper.MoveWindow(&r);
}
}
so that it's
thanks to myself
hehehehe,
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
Hi
I have developed some GUI controls using ATL/COM for Windows CE. (eg Enhanced Edit control).
Each control has an IDispatch interface for properties (Eg IEnhancedEdit).
It also has a corresponding dispinterface for Events. (eg _IEnhancedEditEvents)
I also have some interfaces derived from IUnknown, but they are in the background as far as users are concerned.
My customers will use this control under VB.
My question is:
How do I go about adding new properties, methods, events without the user having to recreate the control from scratch. That is how can I upgrade existing controls with minimum user angst?
My understanding is that there exists an 'interface contract', that once specified, cannot be broken.
What are my options?
TIA
Andrew McGrath
lost, somewhere in Germany....
|
|
|
|
|
Yes there is a contract specified by the COM rules that once you publish an interface it can't change (or at least are not supposed to). If you need to upgrade, add new feaures (bugs);) then you need to create another interface and publish it.
IInterfaceOne : IUnknown
IInterfaceTwo : IInterfaceOne
|
|
|
|
|
The basic rule of COM says, In COM, once you "publish" an interface contract by shipping a component, the contract is immutable—it cannot be changed in any way. You can not add. You can not delete. You can not modify.
But, when you open Microsoft Word 97/98 and Microsoft Word 2000 's .OLB files, you will see that for extending the interfaces, they have added methods to the old interfaces. For example, in MS Word 2000 they have added methods in Application interface, and all the other interfaces. Why So? I feel the right approach is to add new interface if you want to extend an interface. Can somebody tell me its' reason??
|
|
|
|
|
I have been reading through Essential COM by Don Box and I found the Win API calls CoGetTreatAsClass and CoTreatAsClass which effectively allow you to add to the original interface by in fact using a second newer interface.
I am not sure if this is what has occurred with the MS Office OLBs but it appears to be a way to achieve the equivalent.
Andrew McGrath
lost, somewhere in Germany....
|
|
|
|
|
Your information was useful. Thanks.
I read Don Box as well. Can you tell me from where can I get more details about class emulation, and how to implement it?
|
|
|
|
|
Hi,
I am developing activeX control in VC++.
My control is built with usage of two other OCX files so I pack three OCX files and INF file in one single CAB file.
It is being placed on the web page with CODEBASE tag and class id of my control.
It works fine but I need to get USER_LOGON to verify user's permissions to access database (this is INTRANET application)
to get user login I am using VBScript:
<%
full_user_id = Request.ServerVariables ("LOGON_USER")
Response.Write full_user_id
i=InStrRev(full_user_id,"\",-1,vbTextCompare)
if i>0 then
user_login = Right(full_user_id,len(full_user_id)-i)
else
user_login = full_user_id
end if
%>
and i get the proper string in 'user_login'
the question is - how can I pass this user_login variable to my C++ code ?
i would guess by setting :
<param name="web_user_name" value="<%" response.write="" user_login="" %="" />>
Am I on the right track ? Does anyone know how to pass USER_LOGON variable from the html page to activex control's code (VC++) ?
thank you
|
|
|
|
|
How do I change the initial size of the AX(COleControl) in the VC++ (or VB) resource editor when it's first time dropped onto the form/dialog?
GetViewExtent or GetNaturalExtent doesn't seem to be called...
|
|
|
|
|
First client creates an instance of a remote COM object via CoCreateInstanceEx, then calls one of its method remotely. In that method, assume Checker(), some information of the client is checked to see if he has the right to access things on Server further. If OK, the Checker() will create an instance of another COM object named CoreServer, and transfer the pointer to one of its Interface back to Client. How can I finish the procedure with DCOM library? I think there maybe 3 ways for the Checker() to create and transfer:
1.CoCreateInstance
2.CoCreateInstanceEX
3.Moniker
but no way seems work
please help me, thanks.
|
|
|
|
|
Hi,
I'm a VB programmer who is trying to convert an old C console application to a C++ ATL COM DLL for use with a VB GUI.
My code basically allows the client to set a filename and then call a function which launches a private function in a seperate thread and returns immediately.
My private function then trundles along, raising events to inform the client of it's progress along the way.
All sounds good so far, unfortunately my code doesn't work, all my properties, methods, variables and so on were created by wizards.
Here is my implementation file (Asynch.cpp):
#include "stdafx.h"
#include "AsynchEg.h"
#include "Asynch.h"
// Required for _beginthread and _endthread - do not remove
#include "process.h"
#include "comdef.h"
STDMETHODIMP CAsynch::RequestNewThread()
{
// Begin a new thread and start the _NewThread function
_beginthread(_NewThread, 0, (void*)(this));
return S_OK;
}
void CAsynch::_NewThread(void* pCaller)
{
FILE *file;
BSTR wfilename;
char nfilename[256];
LPSTR filename;
// Cast the passed void pointer to a CAsynch object
CAsynch* pAsynch = (CAsynch*) pCaller;
// Convert the FileName property to a character array for use in fopen
pAsynch->get_FileName(&wfilename);
WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, wfilename, -1, nfilename, sizeof nfilename
, NULL, NULL);
filename = nfilename;
// Open the file
if((file = fopen(filename, "rb")) == 0)
{
// TODO: Raise error
}
else
{
// Close the file
fclose(file);
// Tell the calling object to raise it's ThreadDone event
pAsynch->Fire_ThreadDone();
}
// End this thread
_endthread();
}
// Returns the FileName property
STDMETHODIMP CAsynch::get_FileName(BSTR *pVal)
{
// Populate the pointer with the private variable
*pVal = m_FileName;
return S_OK;
}
// Sets the FileName property
STDMETHODIMP CAsynch::put_FileName(BSTR newVal)
{
// Copy the new value to the private variable
_bstr_t NewBSTR;
NewBSTR.Assign(newVal);
m_FileName = NewBSTR.copy();
return S_OK;
}
If I run my VB exe then I get a memory exception.
If I run the C++ end in debug then I get an access violation on the Invoke line of the Fire_ThreadDone function.
If I run VB in debug mode my code works and my event is raised.
What is going on?
If you need a copy of my projects (VC++6 and VB6) then mail me and I'll send you a copy.
Also, can anyone tell me how to raise run time errors to my VB client?
Any consttuctive criticism / advice is greatly appreciated.
Best Regards,
Rob Brown
|
|
|
|
|
I'm a VB programmer who is trying to convert an old C console application to a C++ ATL COM DLL for use with a VB GUI.
Good luck, you'll need
I've done async multithreaded programming in VB, and believe me: it's ugly, and for seasoned C++ COM programmers. MS says: "VB clients are monothreaded."
Well, you'll face 2 main problems, and I would start learning this topics to acomplish this:
- Building a message loop.
- Synchronizing Win32 objects: Events
- marshalling interface pointers between threads
If you fail to use them, your code will hang, or your code will cause a GPF.
Tip: You'll need another thread that creates the object and stay forever in a message pump.
Furor fit laesa saepius patientia
|
|
|
|
|
I've created an ATL COM - dll - MFC Supported with the AppWizard and I added a function that return a CString.
Now I want access to this function from another application to do it I type the next code.
In the ATL COM
...
__declspec(dllexport) CString GetEncodedText(CString p_sPlainText);
...
In the other application
...
hDLL = AfxLoadLibrary("BabMD5.dll");
if (hDLL != NULL) {
typedef CString (CALLBACK *ENCODETEXT)(CString);
ENCODETEXT p_encodeText = (ENCODETEXT)GetProcAddress( hDLL, _T("GetEncodedText"));
if ( p_encodeText != NULL) { // -> NEVER GET HERE
strEncoded = (*p_encodeText)( strPlain );
}
AfxFreeLibrary( hDLL);
}
...
Anybody knows what's happen? Why I can't get the function?
Thanks in advance
|
|
|
|
|
If your DLL is COM this is not the way to do it. Think COM not WIN32.
You need to create an instance then call the method.
CMyObject MyObj;
CoCreateInstance(__uuidof(myobj), .... )
BSTR bstrText
HRESULT hr = MyObj->GetEncodedText(&bsrText);
Notice also that you need a BSTR not CString. Since you are using ATL I'd also loose the MFC support, it doesn't get you anything but more overhead.
|
|
|
|
|
Hi,
While trying to create an object from the client ( remotely) i get the "Access denied" error. I have made sure that the security setting are correct by giving myself full control, that didn't help.
This used to work until i modified the dcomcnfg setting to run application on local computer as well as the remote one ( basically i checked both boxes, after restoring original setting hell the Access denied error started appearing.
any ideas??
* i know i have access to the remote machine as i have access to files on it through explorer.
Alii
|
|
|
|
|
Register the Server.exe and its proxy.dll (if available) on the client machine too. Then you can delete those two files from the client machine. It maybe work.
|
|
|
|
|
Salam,
Actually we've faced such problem before, and everytime we do somthing to solve this problem, and at the end, we don't document what we have found. But the last time we solved this problem, we made a decesion that we have to document this DCOM Access Denied problem thorouly. I have a Word Document (.DOC) which has the complete steps to configure the source and the destination machines which containes the DCOM component.
I'll try to attach this document to this site soon after I refine it . Please, keep track within the coming two days to find this document.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
The article has been posted:
http://www.codeproject.com/useritems/dcomcnfg.asp
Enjoy it,
ShadiK.
Shadi Al-Kahwaji.
|
|
|
|
|
Hello,
Can somebody give me the advantages/disadvantages of using VB to develop COM component instead of using ATL to do the same. Any links to such comparisons are also appreciated.
Ganesh.M.Ramaswamy
|
|
|
|
|
Advantages:
Any idiot can code VB COM components.
Disadvantages:
Only idiots code VB COM components.
Furor fit laesa saepius patientia
|
|
|
|
|
nice one, daniel.
Sorry ganesh I do not have any links to pass on. As it must be obvious to you, in VB you don't really get a taste of what is COM. In VC++/ATL you get to meddle around with the inner working's of COM and get a real feel of how complicated COM actually is.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
Ease of development v's tighter (better;) ) code.
|
|
|
|
|
Hi All,
I am developing an application which uses SQL Server CE as the database, from which I need to synchronize the data to the SQL Server on the server machine. When I tried to synchronize the data using the emulator, it worked perfectly. But, when I tried the same application on my iPAQ pocket PC, I got an error, "DLL for the class not found". When I debugged, the CoCreateInstance() method fails and returns the HRESULT with the error code corresponding to this error message. When I checked the CLSID on the registry, an entry was there in the registry and the corresponding DLL was there in the /Windows directory . Could any one help me to come out of this problem. Any help on this highly appreciated.
This is the line of code I wrote:
hr = CoCreateInstance(CLSID_RemoteDataAccess, NULL, CLSCTX_INPROC_SERVER, IID_ISSCERDA, (LPVOID *)&m_pRda);
Jabir
|
|
|
|
|
hello
i have this com function (using ATL):
STDMETHODIMP Cmanager::iniGetString(BSTR sSectionName, BSTR sKeyName, BSTR sFileName, BSTR *sRetVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
char sTemp[MAX_PATH];
memset(sTemp, '\0', MAX_PATH);
GetPrivateProfileString (_bstr_t(sSectionName), _bstr_t(sKeyName), "none", sTemp, MAX_PATH, _bstr_t(sFileName));
sRetVal = SysAllocString ((OLECHAR *)sTemp);
return S_OK;
}
the sRetVal return nothing.
how can i return sTemp?
|
|
|
|
|