|
/* -------------------------------------------------------------------------
Function: FromBstrToStr
Converts a BSTR to <string> ( not double byte...), well it´s no the
best method, but it seems to be the easiest one, without leaking memory
( well maybe...)
------------------------------------------------------------------------ */
string FromBstrToStr(BSTR TextB)
{
string ret;
_bstr_t bstrConv(TextB, FALSE);
ret = (const char *) bstrConv;
return ret;
}
|
|
|
|
|
I'm hosting the IWebBrowser2 object in a window (based on CWindowImpl). the mouse works perfectly within the browser, as does all navigation, however, I can not type within a textbox on a web page. Do I have to implement IDispach:Invoke and then redirect all keyboard events back to the browser? If so, how?
The relevant section of code for hosting the browser is
class CTest : public CWindowImpl>Ctest<
CTest() {
Create( phWnd, rcClient, _T("Browser"), WS_CHILD | WS_VSCROLL | WS_HSCROLL);
}
HRESULT CTest::DoAddBrowser(CComVariant t_URL) {
CAxWindow wnd(this->m_hWnd);
HRESULT hr = wnd.CreateControl(IDH_DEFAULTPAGE);
if (SUCCEEDED(hr)) {
hr = wnd.QueryControl(IID_IWebBrowser2, reinterpret_cast<void**>(&m_pIWebBrowser));
return m_pIWebBrowser->Navigate2(&t_URL,NULL,NULL,NULL,NULL);
}
return hr;
}
};
Thanks
Angus
|
|
|
|
|
|
I'm trying to create a window by implementing CWindowImpl and I want to remove the title bar from the window. I can do this using the WS_POPUP style using the win32 API, but when applied to CWindowImpl, the window is not visible.
The code below gives me an unusable window.
#include <atlwin.h>
class CWindowTest : public CWindowImpl<cwindowtest>
{
public:
CWindowTest() {
Create(NULL, CWindow::rcDefault, _T("Test"), WS_THICKFRAME|WS_POPUP|WS_VISIBLE);
}
virtual ~CWindowTest(){}
BEGIN_MSG_MAP(CWindowTest)
END_MSG_MAP();
};
Cheers,
Angus
|
|
|
|
|
Found the error!
rcDefault cannot be used with the WS_POPUP style. Yet another wasted few hours...
|
|
|
|
|
Hi !,
I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way...
Can anybody help me ? Thanks a lot,Bye !
Braulio
|
|
|
|
|
****From answer in C++ section****
To clear the whole list:
list.erase( list.begin(), list.end() );
To delete a single item:
// iter is the iterator of the item you want to delete
// iter = list.begin(); // 1st item in list
// iter = &(list.at(iIndex)); //iItem in lsi
list.erase( iter );
Hope this helps
Mike
|
|
|
|
|
Hi !,
I´m new using this STL, now I can add members to a list an iterate though that list, but ... still don´t now how to delete members from it, and free the list in a right way...
Can anybody help me ? Thanks a lot,Bye !
Braulio
|
|
|
|
|
I need some help. I am experiencing an error while attempting to use a function I have imported from a COM inproc DLL. After I import the library I start using it. There is one function that gives me a debug error. It comes out of the i386\chkesp.c file. It says that a ChkESP error has occurred and that it usually happens with an issue with using a function pointer that using a different calling convention that a defined function (I checked and this isn't it. My calling conventions are fine __stdcall). After tracing through the code I find out that it occurs after the COM function completes but before the next line of code exectued in the .tlh file's wrapper functions. Note that if I just click ignore the error everything still works fine. In my app I am using the library in the code looks something like:
ITCPServerPtr tcp = ITCPServerPtr( CLSID_CoTCPPort );
tcp->OpenPort(); //works
bool check = tcp->SetBuffers(newSize); //works
bool check2 = tcp->StartupServer(port);
...
the error happens after the actual COM StartupServer func. executes but before a return happens. Has anyone ever seen anything like this before. If so anyone know how to fix it? I am in the dark.
FYI: When I build release ver. all works and no error pops up.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
i get this when the IDL and the DLL disagree on something. usually a rebuild-all fixes it for me.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
tried that already.. Doesn't do any good. Thanks though.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I was wondering if there is a way to find out when an ActiveX control has actually downloaded.
I need to pass a few parameters from my HTML page to my ActiveX, but I am having timing and synchronizing problems. The problems arise from the fact that a lot of times the method calls are made before the object has fully downloaded.
Is there any method or events that I could use to find out whether an ActiveX has downloaded?
thanks
|
|
|
|
|
I'm writing a ATL DLL Server. Inside the server, I want to define some custom message to handle some scenario. But I dont't know to create a message map to handle this custom message.
Anyone knows about it?
Thanks,
Tony
|
|
|
|
|
I tried to add a new ATL-object to MFC Application
(Microsoft Visual Studio 6.0).
It is a usual process for ATL-Wizard. But I get exe-file only
without proxy/stup dll and without automatic registration.
Does anybody have experience how to make it?
Thanks in advance
ATL-buildman
|
|
|
|
|
It depends of your interface definition file. If you use custom marshalling , the midl compiler will generate three files , which must be compiled in a dll. ( exp : from test.idl will generate test_i.c , test_p.c, and dlldata.c ). If the interface marshaller will be used only under WinNT.3.51 or w95, you should define in the dlldata.c the REGISTER_PROXY_DLL symbol. The generated .dll fully support automatic registration. If you don't want to use custom marshalling, you can use the universal marshaler, by adding oleautomation attribute to your interface ( if your interface use only data types supported by variants).
|
|
|
|
|
I tried to add a new ATL-object to MFC Application
(Microsoft Visual Studio 6.0).
It is a usual process for ATL-Wizard. But I get exe-file only
without proxy/stup dll and without automatic registration.
Does anybody have experience how to make it?
Thanks in advance
ATL-buildman
|
|
|
|
|
Ok, I've got an ATL appwizard with MFC support. Implemented a ActiveX server object (I'm trying to write an ASP extension to interface to some code i've already got working elsewhere).
To test the theories of ATL and COM, I'm trying to make a simple propert that returns the IP address of the client (from Request.ServerVariables("REMOTE_ADDR") ).
Here's the function I'm trying to use:
STDMETHODIMP CMyClass::get_GetIP(BSTR *pVal)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
IRequestDictionary *piRequestDic;
m_piRequest->get_ServerVariables(&piRequestDic);
VARIANT v_Param, v_Value;
_variant_t vt_Param;
vt_Param.Attach(v_Param);
vt_Param.Clear();
vt_Param.ChangeType(VT_BSTR,NULL);
vt_Param.SetString("REMOTE_ADDR");
piRequestDic->get_Item(v_Param,&v_Value);
VariantChangeType(&v_Value,&v_Value,0,VT_BSTR);
*pVal=v_Value.bstrVal;
return S_OK;
}
When I call a simple asp page that creates this object and attempts to read this GetIP property, IIS hangs. I have to use Winnt reskit's KILL.EXE to close it.
I have no idea whats wrong- i've followed my logic through several times and i'm oblivious to the prob.
help appreaciated thanks
jon h
|
|
|
|
|
Hi,
I use Visual C++ 6.0 SP 4 , SQL Server and oledb
I create a class to connect to my database. In my constructor i initialize com library like this :
CoInitialize(NULL);
In my destructor i release com library like this :
CoUninitialize();
If i use this class to execute for exemple an sql query ( store procedure), my functions open, execute, close,... work.
But if i close my application ( OnOK ) , two seconds later i obtain the following acces violation message :
EXCEPTION(c0000005 acces,@40f919) EBP184f0b8 EIP40f919)
ASM 45 fc 8b 08 8b 01 52 ff 50 08 8b e5 5d c3 cc cc cc cc cc cc
EAX:184f618 EBX:dc0110 ECX:383439 EDX:383439 ESI:dc0064 EDI:184f664 ESP:184f0b4
The suspect function is _Release() throw() which is in a Visual C++ include file ( in Include\COMIP.H )
// Releases only if the interface is not null.
// The interface is not set to NULL.
void _Release() throw()
{
if (m_pInterface != NULL) {
m_pInterface->Release();
}
}
But if i comment out CoUninitialize() instruction, my code work without acces violation.
Can anybody help me?
Best regards,
Cheickna
|
|
|
|
|
Hi,
I build a VB activeX dll and viewed the IDL file with OLE/COM viewer.
apparently, everytime I rebuild the DLL the interface IID (GUIDs) change and I have to re-extract IDL and use in VC client. Is this natural/normal for VB to generate new GUID's for interfaces when rebuilt.
TIA.
|
|
|
|
|
Hi All,
I am able to run DCOM successfully between any number of systems if the server is an EXE OR DLL(Not service).But, I am getting problem when I have DCOM server as a service !(It works perfectly when I have both server and client running in my system )!
What could be the problem with DCOM Configuration .
Thanks in advance for the help !
Y.Yamini Devi
|
|
|
|
|
|
I'd like to add a toolbar to my control. I imagine the easiest way to do this is to use some type of quasi-framework to encapsulate the different types of functionality, but I'm having a hard time thinking about how I would accomplish this task.
Given a standard ATL COM object, where do I start looking to create a quasi-framework to enable toolbars?
#include "witty signature.h"
|
|
|
|
|
Question Summary: How do you customize the "tooltips" displayed by Intellisense?
Question Details:
I am trying to customize the "tooltips" that show up as a part of Microsoft's Intellisense "Auto Complete" feature.
For example, while building an ASP page in Visual InterDev, if I type "Request" and a dot (.), an Intellisense window "pops" up and displays the properties and methods that the ASP Request object supports. As I scroll down the list of available methods and properties, an "information" tooltip appears to the right of the drop down list.
I have been able to trace the content of these "information" tooltips back to the type library ASP.tlb. The same "information" string appears in the helpstring attribute. It would seem that this is the source of the text that Intellisense uses. (If this observation is incorrect, please let me know)
When I created a test component, I put my own detailed help "information" string in the helpstring attribute. However, when I do this it does not show up like it does for Microsoft's intrinsic ASP objects. In fact, it does not show up at all.
What am I doing wrong? Why is Microsoft able to do this and I am not? Is there a different IDL attribute to set, or perhaps a different IDL compiler is required?
Thanks in advance for any advice or recommendations. If anyone knows of good documentation of Microsoft's Intellisense, that would be great too.
Sincerely,
Trong Ha
|
|
|
|
|
I have 2 applications one is a explorer view(Application A) and the other application view is derived from list view(Application B).Both are based on Doc-view architecture.
I need to make a COM dll of Application B and the view of Application B will integrated in the list view of the Application A with Splitter window.
How do i handle the MFC derived classes between the two application to create this splitter view ?
Anonymous
|
|
|
|
|
Just a "quick" question on interfacing COM objects which use derived Objects based on MFC.
My understanding of COM is that if you want to stick with the rules, you usually use IDL to define your interface, and you don't pass back Objects based on any particular Library such as MFC or STL etc...
This would require alot of re-writing of my current code, so I was wondering if there is any way to keep a list of Objects derived from MFC classes in the COM DLL and all the Object method definitions and code etc.
What I want to be able to do is Create the COM object and get the required Interface to give me a pointer to the list of objects in the COM dll.
This will require me to include the definitions of the Classes etc in my application as well, but the problem I am facing it the Method Implementation Code.
Currently this is in the COM DLL, but I can't build my Application without linking the COM DLL as a standard DLL (by linking with the COM's .LIB file).
Although I can still use the COM interfaces this way, it means I have to tie the COM object to closely to my application (and defeats the purpose of using COM in the first place)
Is there any way I can instantiate the COM object as normal and pass back a list of MFC derived Objects (with my OWN Classes based on MFC ones) to my application, and then call the member functions of these Objects without linking to the COM's .LIB file?
The only way I've managed to do this, is by linking to the .LIB file, or by having to include the .CPP files for the classes in my application code as well as my COM DLL code, which I don't want to do!
Many thanks!
|
|
|
|