|
How to get message string for HRESULTs I got from URLDownloadToFile() and other URL Monikers functions?
8 is error
C is FACILITY_INTERNET
5 is some error code.
I need smth like FormatMessage() API.
I tried FormatMessage() from modules "wininet.dll" and "urlmon.dll" (for codes 0x800C0005 and 5) but that does not work:
// hr == 0x800C0005
FormatMessage (FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
GetModuleHandle("wininet.dll"), hr & 0xFFFF, 0, (LPTSTR) &msg, 0, NULL);
InternetGetLastResponse() does not return anything too.
BTW, I found the following explanations is MSDN:
The server or proxy was not found (Error=800C0005)
The protocol is not known and no pluggable protocols have been entered that match. (Error=800C000D)
What are other codes (I experienced 0x800C0007, 0x800C0008)?
|
|
|
|
|
BTW2, using IErrorInfo with GetErrorInfo() COM function does not return any error too.
|
|
|
|
|
Don't know how to translate automatically to strings, but for the URLMon error messages, you can look into the UrlMon.h header (in Platform SDK), where the codes are somehow described
e.g.
0x800C0005L - INET_E_RESOURCE_NOT_FOUND
0x800C0007L - INET_E_DATA_NOT_AVAILABLE
0x800C0008L - INET_E_DOWNLOAD_FAILURE
...
for detailed description you can then search for the descriptive code in MSDN (or google)
|
|
|
|
|
hi to every one hope every one ll b fine and enjoying the real world of
prog
i m looking for any one who can help me regarding to com i want to give
visual
look n feel to my control using ICON .ico the only thing i know about
that is using IPicture interface but how i dont know so help me i m
v.gr8 n pesonaly thankful to u
looking for ur coperation
regards
sommerbwn
sommerbwn
|
|
|
|
|
the IPicture interface and the methods OleLoadPicture are quite good described in the MSDN documentation :P
|
|
|
|
|
there is very god example in msdn over IPicture Interface,
search for LOadPic.exe in MSDN
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello,
I have written an outlook addin which retrieves the recipeint exchange address intead og SMTP mail id. Pls. can u help me get the SMTP address using vc++. Pls help with some sample code.
Thanks and regards,
Sujatha Raj
Sujatha.raj@india.rsystems.com
|
|
|
|
|
I have declared a linked list(requirement is like that) which contains another list. Now i wanted to pass that linked across DCOM. For communication i am using connection point. Please help me out in this or provide any alternate solution.
|
|
|
|
|
Hi
That is not possible, you can only pass arrays or more simpler types through DCOM. Please read MSDN about 'IDL', or a good COM book.
see ya kurt
Fast Prototyping
|
|
|
|
|
Plz anybody can tell me how to fire an event from within a thread since the threads method is static.
AKshay(CMMSoft)
|
|
|
|
|
Pass a pointer to the event's target to the thread function.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I don't undersatnd.Plz tell me in more detail.
|
|
|
|
|
Hello Akshay,
Event firing in a COM server is a very tricky process. This is especially true if your COM server is based on the apartment-threaded-model.
You must be able to obtain the event handling functions of your object's client application. This can be a complicated process involving going through the connection point clients of your COM object. From there, you can obtain the event handling functions of your Com object's events. Firing an event is simply invoking these event handling functions (of your client).
If you are using the apartment-threaded-model, you also will not be able to fire these events directly from within your thread. These event handling functions must be marshalled to your thread.
I really do not wish to disappoint you, Akshay, but event firing from within a thread (separate from the thread in which your COM object is created) is simply -NOT- a trivail or simple task.
I hope to write an article on this topic in the near future. I'll keep you posted on this. Meantime, I'll try to search for some good book references that can help you along.
Best Regards,
Bio.
|
|
|
|
|
Hi, I just need to fire a single event.Plz tell me how to do it in case of single threaded model.
|
|
|
|
|
Hello Akshay,
I'm preparing to write an article on event firing and event handling in threads. Please be patient with me on this However, for now, I -can- recommend to you some pointers and a reference to a good book on this subject.
The book's name is :
The Essense of COM with ActiveX (A Programmer's Workbook).
The author is David S. Platt.
Get a latest edition of this book. It is excellent. It presents COM subjects as a series of tutorials which are simple to follow.
Some pointers on event firing :
1. Events are essentially "outgoing" interfaces. They are methods of an interface which is not implemented by the COM Object itself but rather, by the -client- of the COM Object.
2. COM Objects which implement events must expose 2 additional interfaces from their COM object :
2.1 Connection Point Container.
2.2 Connection Point.
Please read up more on this in MSDN or in David Platt's book.
3. If you intend to fire your events inside a separate thread, you must marshall your client's event handler functions to this separate thread.
Hope the above helps, Akshay,
Bio.
|
|
|
|
|
Hello all,
I am working on an editor that automatically applies some formatting as the user types. Among these operations are syntax highlighting and character string insertions. I am currently using the ITextRange interface to apply syntax highlighting since it has been suggested elsewhere that this is the key to maintaining undo/redo ability in this context. Unfortunately I am not having any luck preserving the undo buffer in any useful state! Does anyone have any experience with this? Is it a matter of grouping operations with the (TextDoc) Begin/EndEditCollection functions? So far they have not yielded their secrets to me either
Any advice would be greatly appreciated!
Thanks,
Jon
|
|
|
|
|
In a vc++ project, I have a dialog box with a grid (m_flexGrid) and a
remote data control (m_rdc). In OnInitDialog, I set up m_rdc and then
try to set it to m_flexGrid with:
<br />
LPUNKNOWN rdcunk = m_rdc.GetControlUnknown();<br />
LPDISPATCH rdcdisp = NULL;<br />
HRESULT hr;<br />
hr = rdcunk->QueryInterface(IID_IDispatch, (void**)&rdcdisp);<br />
if (SUCCEEDED(hr)) {<br />
m_flexGrid.put_DataSource(rdcdisp);<br />
<br />
... ...<br />
<br />
}<br />
The put_DataSource give me a "Type mismatch" error. If I set up the
datasource property for grid in design time, everything works just fine.
Any suggestions?
|
|
|
|
|
how to write code using vb 6.0 to bar code reader from serial port?
|
|
|
|
|
Hi,
I am very much interested to learn what is COM. And how to create my own components using Visual Basic.
Rajesh.J
mail to:rajesh.nathan@rediffmail.com
|
|
|
|
|
If you want to know COM then there are many excellent tutorial about COM in Code Project site.
You can check out my weblog on COM for some good URL i have posted-
http://lovecom.blogspot.com[^]
But this is all about C++ implementation of COM specification
-------------------------
Have a great day ahead!
Regards,
Sohail Kadiwala
(My COM Blog - http://lovecom.blogspot.com)
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I am trying to develop an IE plugin that
a- Show its Icon on the toolbar
b- Interact with IE and record every site the user goes to.
Any ideas?
P.S. Dont be concerned, im not interested in writing spyware. Im more concerned with getting the IE COM model to interact with C# and logging every http request is one way i know that its working.
|
|
|
|
|
Hi
Look in MSDN for the word "BHO" Browser Helper Objects.
cu kurt
Fast Prototyping
|
|
|
|
|
Hello,
I have a C# command line program that reads data from an Excel workbook and creates an Xml file from it. The Excel workbook is not modified, and the Excel app is hidden from the user.
Everything works fine except when I quit my program before it finishes. When I do this, Excel stays open. The only way to tell this is to look in the task bar; the first time I did this I was surprised to see 8 Excel processes running!
There must be a way to tell Excel to quit when the process that started it quits... anybody know how I can do this? Thanks!
Jeremy O
PM Logic
http://www.jeremyo.com
Jeremy O
PM Logic
http://www.jeremyo.com
|
|
|
|
|
It's been years since I fiddled with automation and excel. But if memory serves me right, simply call the Quit() method on the application object, and it should go away immediately.
--
Wir müssen leben bis wir sterben.
|
|
|
|
|
This is what I do (code is at the bottom of the page), and if I press the 'X' button in the Command Line window before my program finishes, it seems that the finally{...} block never executes. I thought that I was guarenteed it would, am I incorrect in thinking that?
Somebody said something about an Excel Automation COM library... I don't know the difference between using that and doing what I am doing. Is my head under a rock? If it is, please point me towards an explaination, perhapse an article explaining which to use and maybe even a programmers reference.
Thank you! Following is the code I use:
<br />
class XmlBuilder<br />
{<br />
<br />
private Excel.Application excelApp;<br />
<br />
[STAThread]<br />
static int Main(string[] args)<br />
{<br />
XmlBuilder app = new XmlBuilder();<br />
<br />
try<br />
{<br />
app.excelApp = new Excel.ApplicationClass();<br />
<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
}<br />
finally<br />
{<br />
if(excelApp != null)<br />
excelApp.Quit();<br />
}<br />
return 0;<br />
}<br />
}<br />
|
|
|
|