|
hi all
i had make drawing on the dilaogs. now i want that these drawing should be saved in bmp file or the jpeg file tell me how to do that or any other place such as picturebox or any other COM component where i can draw ans save as bmp file.
ddd
|
|
|
|
|
There is an application with hosted Internet Explorer (WebBrowser). I have a problem with customizing
IE preferences. They are to be customized only for an instance of Internet Explorer without affecting
global preferences stored at HKCU\Software\Microsoft\Internet Explorer.
1. I need to specify default page, colors, CSS styles and font size. I use
IDocHostUIHandler::GetOptionKeyPath to specify registry path with custom preferences:
STDMETHODIMP rbDHTMLBridge::GetOptionKeyPath(BSTR __RPC_FAR *pbstrKey, DWORD dw)
{
MessageBox(NULL,"GetOptionKeyPath", "GetOptionKeyPath", MB_OK);
static LPCWSTR lpwszKey = L"Software\\MyApp";
if ((*pbstrKey = (LPOLESTR)CoTaskMemAlloc((wcslen(lpwszKey) + 1) * sizeof(OLECHAR))) != NULL) {
wcscpy(*pbstrKey, lpwszKey);
} else {
return E_INVALIDARG;
}
return S_OK;
}
Function is called by IE and returns S_OK. But it does not affect hosted IE: it uses global
preferences.
Why it didn't work? May be I missed some initialization?
2. I need to remove footer and header of HTML pages printed using hosted IE. It can't be done
by GetOptionKeyPath (Internet Explorer uses global preferences for footer and header in any case).
It can be done by WebBrowser.ExecWB(OLECMDID_PRINT, ...) as described in
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q267240. I copied code from this article into
my application but it didn't work. Footer and header from original page were used on the printed page.
Why it didn't work?
May be the reason is what i have IE6.0 but the highest version of IE in APPLIES TO section of the article is 5.0?
Any help will be appreciated.
|
|
|
|
|
Hello,
I was wondering if it is possible to implement MDI in a MFC based ActiveX control. I was able to implement SDI (using a sample from MSDN), but I faced some difficulties when implementing MDI. Any help would be highly appreciated.
Thanks in advance,
Dennis.
|
|
|
|
|
Hi,
I want to pass the reference(test) of the interface (ITest) define inside the COM DLL (TestCom.dll) in my application function.Example
GetMerchItemType( TestComLib::ITest &test, int Temp)
However I am facing the following error.
error C2653: 'TestComLib' : is not a class or namespace name
error C2061: syntax error : identifier 'ITest'
Can you please help me resolve this error.
Thanks
|
|
|
|
|
Check the spelling.
If you haven't explicitly renamed the namespace it would look something like 'TESTCOMLib'.
--
Roger It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Hi everybody
I got some problems by using an application under Windows NT 4.0, this application uses OPC and it seems it's causing this kind of problem... it says RPC system not initialized... another weird thing is the request of the missing OCX of WinSock "mswinsck.ocx" that should come with the system (I took one on Win2K and registered by my own using REGSVR32... but I'm not sure it's a great idea...). If somebody know anything that may help please tell me!!!
Thanx
TK
|
|
|
|
|
Hi, friends
I tried to build a dll which support COM self-regist using Visual C++ 6.0. I used a API, named LoadTypeLib, to load the dll's typelib:
...
CComPtr<itypelib> pTypeLib;
HRESULT result = LoadTypeLib(module,&pTypeLib);
...
The variable "module" is the DLL's full path name. For example, I use "D:\\temp\\test\\test.dll". But, the return value "result" always is 0x80029c4a (TYPE_E_CANTLOADLIBRARY). If I use "D:\\temp\\test\\test.tlb" as the value of "module", this function should return 0x00000000(S_OK).
I have import "test.tlb" into the resource of test.dll. So I don't know how to resolve this problem.
Thanks a lot!
smalldemon
|
|
|
|
|
Hello smallbluedemon,
1. Make sure that you have set the resource type to be "TYPELIB" and have also set the resource ID to be 1.
2. Try out the following function to load your resource-embedded type library binary :
HRESULT MyLoadTypeLibrary(ITypeLib** ppITypeLibReceiver)
{
TCHAR szFileName[_MAX_PATH];
memset (szFileName, 0, sizeof(szFileName));
GetModuleFileName
(
(HMODULE)NULL,
(LPTSTR)szFileName,
(DWORD)sizeof(szFileName)
);
// Need to concatenate a \1 to the end of the filename
// because we are acquiring the type library which is
// embedded as the 1st resource of type TYPELIB.
strcat (szFileName, "\\1");
return LoadTypeLib((const OLECHAR FAR*)_bstr_t(szFileName), ppITypeLibReceiver);
}
Use it in your code this way :
int main(int argc, char* argv[])
{
CComPtr<ITypeLib> pTypeLib;
MyLoadTypeLibrary(&pTypeLib);
return 0;
}
Pls let me know how things go
Best Regards,
Bio.
|
|
|
|
|
Hello, Bio.
Thank you very much!
By your suggestion, I found my mistakes. In my resource header file "resource.h", I set following macro:
#define IDR_TYPELIB 199
But, I forgot to add this to file name. I add your statement:
........
GetModuleFileName(hInstance, ansiPath, MAX_PATH);
strcat(ansiPath,"\\199");
MultiByteToWideChar(CP_ACP, 0, ansiPath, strlen(ansiPath) + 1,module, MAX_PATH);
.......
Problem resolved !
Thank you again. Thank you very much!
Your sincerely
Remy (smallbluedemon)
|
|
|
|
|
Hello Remy,
That's great ! You are most welcome, Remy.
Best Regards,
Bio.
|
|
|
|
|
Hi Friends
I want to control the word doc at window form using C#
i am using a button to generate a table programmatically , when user insert a new table .
A aero should be shown to the previous table to the new one and all done programmatically on insertion of new table ..
Please let me know about the solution
|
|
|
|
|
I recently developed a .Net 2003 Windows Application that posts xml documents to a URL using XMLHTTP methods (required by vendor). I have not found any reference of XMLHTTP for the Net platform, but did find out that the methods are exposed through the MSXML library, so I added in my project a reference to the Interop msxml2 dll and used the methods. The application runs very well on my Visual Studio 2003 IDE, but when I moved the dll's to the server, it gives me the following exception:
System.Runtime.InteropServices.COMException (0x800C0008): The download of the specified resource has failed. at MSXML2.XMLHTTPClass.send(Object varBody) at ttHTTPWebclient.ttHttpWebClient.SendHttpRequest(String st
I don't know much about COM and have no idea what this error means. Could not find info about it on the net either, so I decided to try this forum.
Here is my code:
Public Function SendHttpRequest(ByVal strServiceURL As String, ByVal xmlMessage As String, Optional ByVal Mode As String = "msg") As String
Dim strResponse As String
Dim xmlhttp As New MSXML2.XMLHTTP
Dim xmlDocRQ As New MSXML2.DOMDocument
Dim xmlDocRS As New MSXML2.DOMDocument
Dim xmlLenght As Integer
Dim root As MSXML2.DOMNodeType
Try
'///////////////////////////////////////////////////////////////////
'// Createthe HHTP Post quote request //
'///////////////////////////////////////////////////////////////////
'Initialize Dom Variables
xmlLenght = xmlMessage.Length
xmlDocRQ.async = False
xmlDocRQ.loadXML(xmlMessage) 'Load xml Msg vendor request into a DOM
xmlhttp.open("post", strServiceURL, False, "ESPTest1", "4zz8ygh7mkka")
xmlhttp.setRequestHeader("Content-type", "text/xml; charset=utf-8")
xmlhttp.setRequestHeader("Content-length", xmlLenght)
'///////////////////////////////////////////////////////////////////
'// Send the Post request and get the response from the vendor //
'///////////////////////////////////////////////////////////////////
xmlhttp.send(xmlDocRQ)
xmlDocRS = xmlhttp.responseXML
strResponse = xmlDocRS.xml
'///////////////////////////////////////////////////////////////////
'// Return response to the calling method //
'///////////////////////////////////////////////////////////////////
Return strResponse
Catch ex As Exception
Dim strex As String
strex = ex.ToString()
Return strex
End Try
Any help will be greatly appreciated. I can not use normal POST messages because the authentication (userid/Password) can not be part of either the URL (query string) or the actual xml message being posted, per vendor requirement (owner of the page I am posting to) .
Regards,
Ivan
|
|
|
|
|
Hi friend
I want to complete knowledge of Remoting.
I have worked on .net .But i dont abt Remoting.
So Remoting related topic(online) which much helpfull for me.
Plz guide me how and easily i have learned,
On Intenet where are much Remoting related sample available.
Thanks
Friendsssss
Ashish
|
|
|
|
|
hello,
I am a newbie when working with COMs and dlls. I have written an application in VC++, and wanted to add one more functionality in the form of a function. Now this is additonal functionality is actually done by a VB team in the form of a .dll made in VB 6.
How can I import the function from that .dll to use in my application? Is there any tutorial available which addresses this issue?
Please let me know.
Thanks
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
I've a program written on Delphi whith implemented Automation interface. This program is not register itself in Running Object Table in the runtime. How can I connect to the running instance of this program's automation interface from my C++ client?
Thanks.
|
|
|
|
|
There is a activex written using MFC and COM .
The main class inherits
CComObjectRootEx
IDispatchImpl
CComCoClass
IObjectSafetyImpl
Now 2threads are created inside this class in the constructor.
When IE is refreshed/reloaded, I loss the pointer of the process and
threads are not deallocated.
So what I did is, made thread ID's as static in the class and
deallocate them in the constructor before creating new threads.
When I WaitforSingleObject() I always get time out(258).
so I call TerminateThread().
I know this is wrong way.
Now this method is leaving lot of leaks.
Please suggest me a remedy so that I can trap the refresh ask my thread
to exit gracefully.
Thanks a lot in advance.
-Tenali-
|
|
|
|
|
Hello.
I know how to send longs, ints, booleans, (basic types) between a COM component and a client using VARIANT.
However, how do I send a user defined object using VARIANTs as well?
Is it possible?
Could you post please a small source code example?
THANK YOU
Dario
|
|
|
|
|
I have written a COM service using ATL 7.0 and VS 2003 which contains one COM Class. The class uses a number of member variables, some of which are CComBSTRs. Clients can use the get/put methods on these strings. The strings are processing parameters for calls to the calculation operation in the COM object. The string variables are changed to alter the output each time the object is called. Sometimes, the result of the get function is not what was sent to the put function.
Server Code:
<br />
CComBSTR m_bstrTheString;<br />
<br />
m_bstrTheString = SysAllocString(L"Testing");<br />
<br />
[propget, helpstring("property m_bstrTheString")] HRESULT m_bstrTheString([out, retval] BSTR* pVal);<br />
[propput, helpstring("property m_bstrTheString")] HRESULT m_bstrTheString([in] BSTR newVal);<br />
<br />
STDMETHOD(get_m_bstrTheString)(BSTR* pVal);<br />
STDMETHOD(put_m_bstrTheString)(BSTR newVal);<br />
<br />
STDMETHODIMP CMyClass::get_m_bstrTheString(BSTR* pVal)<br />
{<br />
*pVal = m_bstrTheString;<br />
return S_OK;<br />
}<br />
<br />
STDMETHODIMP CHunter::put_m_bstrTheString(BSTR newVal)<br />
{<br />
size_t s = ::SysStringLen(m_bstrTheString);<br />
if(s > 0)<br />
::SysFreeString(m_bstrTheString);<br />
m_bstrTheString= ::SysAllocString(newVal);<br />
return S_OK;<br />
}<br />
In the client code(simplified):
<br />
BSTR bstrIn;<br />
BSTR bstrOut;<br />
<br />
HRESULT hr = CoInitialize(NULL);<br />
CT2CW szIn(argv[3]);<br />
bstrIn = ::SysAllocString(szIn);<br />
if(bstrIn == NULL)<br />
return E_OUTOFMEMORY;<br />
MyService::IMyPtr pMine(__uuidof(MyService::CMy));<br />
hr = pHunter->put_m_bstrTheString(bstrIn);<br />
hr = pHunter->get_m_bstrTheString(&bstrOut);<br />
My question is: Is this a good way to go about this. I am having the problem of the string sometimes being overwritten by other variables of the same type when performing operations on them.
Thanks in advance for any help.
Rob
|
|
|
|
|
http://msdn.microsoft.com/library/en-us/vclib/html/_atl_CComBSTR.3a3a.Copy.asp?frame=true[^]
CComBSTR does all the SysAllocString stuff for you.
Try this instead:
<br />
CComBSTR m_bstrTheString;<br />
<br />
m_bstrTheString = L"Testing";
<br />
[propget, helpstring("property m_bstrTheString")] HRESULT m_bstrTheString([out, retval] BSTR* pVal);<br />
[propput, helpstring("property m_bstrTheString")] HRESULT m_bstrTheString([in] BSTR newVal);<br />
<br />
STDMETHOD(get_m_bstrTheString)(BSTR* pVal);<br />
STDMETHOD(put_m_bstrTheString)(BSTR newVal);<br />
<br />
STDMETHODIMP CMyClass::get_m_bstrTheString(BSTR* pVal)<br />
{<br />
*pVal = m_bstrTheString.Copy();<br />
return S_OK;<br />
}<br />
<br />
STDMETHODIMP CHunter::put_m_bstrTheString(BSTR newVal)<br />
{<br />
m_bstrTheString= newVal;<br />
return S_OK;<br />
}<br />
|
|
|
|
|
Gerald,
Thanks a metric tonne for the info. It seems to have solved the issues and greatly simplifies the code.
Cheers.
Rob
|
|
|
|
|
How to detect ActiveX on IE when it begins run using BHO?
exactly, I want to know CLSID of ActiveX.
How to catch it?
help me.
and thanks.
|
|
|
|
|
Hi, I have an activeX object ( no GUI ) that I want to use in my MFC project. The problem is I can't seem to capture the messages fired by the activeX. It works fine in the control container, in Visual Basic, .NET but I can't seem to get it to work in VC6.0. What I did to test it, was create a simple dialog based application, added the component through the Add to project/components and controls, used class wizard to add a variable, and also added a handler for the OnMessage. I than created a simple button to invoke a method that fires a message. The message is not retrieved by the OnMessage handler. What could be the problem?
When I debug the ActiveX itself, I see it entering the Fire_OnMessage function but nConnections = 0??? Why is this, how do I have to instantiate the ActiveX object to make it work?
HRESULT Fire_OnMessage(BSTR bstrResult)
{
CComVariant varResult;
T* pT = static_cast<t*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
|
|
|
|
|
Does anybody have a template project or information on how to create an ActiveX EXE (out of process) server in Visual c++? All of the templates included with the compiler either create an in-process ActiveX or an out of process COM object that is not an ActiveX object.
Thanks in advance,
Dave
-- modified at 15:17 Tuesday 28th February, 2006
|
|
|
|
|
I think this is a question of terminology.
"ActiveX EXE" in the VB programmer's world usually mean an "out-of-process COM server with automation interface" in the C++ programmer's world.
My suggestion is this, given that I've understood you correctly:
run the ordinary MFC AppWizard and create an SDI application and have the document support automation.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanks, Roger.
Your suggestion was helpful, thanks for clearing that up. I did as you suggested and solved my problem.
Dave.
|
|
|
|