|
Did you ever get an answer on this?
|
|
|
|
|
Hello!
There is interface IWebBrowser2, which I use to get IHTMLDocument2, IHTMLElementCollection, IHTMLElement, IHTMLImgElement from.
I can get different picture options from IHTMLImgElement, but I can't get the picture itself.
How can I do that? Please advise.
P.S.
I've tried to use the following code:
IOleCommandTarget* pCT;
CComVariant vGlyphTableEntry;
vGlyphTableEntry = "c:\\temp.jpg";
if (pElemDispatch->QueryInterface(__uuidof(IOleCommandTarget), (void**)&pCT)==S_OK)
{
pCT->Exec(&CGID_MSHTML, IDM_SAVEPICTURE , OLECMDEXECOPT_DONTPROMPTUSER ,&vGlyphTableEntry, 0);
pCT->Release();
}
But this code shows the 'Save as' dialog, which shouldn't appear. What's wrong with this code? Is there some other way to do that?
Thanks in advance
|
|
|
|
|
Take a look at IHTMLElementRender which you should be able to query the IHTMLImgElement for. This interface has a DrawToDC method that you could use to render the element to a DC of your own creation.
|
|
|
|
|
I want to write a program which checks present available wireless networks through my wireless application ,
and to ping message to all the networks to check their availability..... i think i have use aodv concept but dont no how to start .... pls help in getting start ...
Thanks for any suggestion ....
|
|
|
|
|
I am trying open a excel file after downloading it from website, but its giving error "Missing file: C:\default.css?5".how can i overcome the error thru C#.
Thanks
Senz
|
|
|
|
|
Hello,
I want to create a C# DLL that passes out a string as a parameter. I have tried this (partial code):
[C# Code]
public interface iInterface1
{
[System.Runtime.InteropServices.DispId(13)]
void Call13(
[System.Runtime.InteropServices.In]
[System.Runtime.InteropServices.Out]
[System.Runtime.InteropServices.MarshalAs(
System.Runtime.InteropServices.UnmanagedType.BStr)]
ref string s1);
[System.Runtime.InteropServices.DispId(17)]
void Call17(
[System.Runtime.InteropServices.In,
System.Runtime.InteropServices.Out,
System.Runtime.InteropServices.MarshalAs(
System.Runtime.InteropServices.UnmanagedType.LPWStr)]
ref System.String s1);
}
[C++ Code]
BSTR s;
m_int0.Call13(&s);
[C++ Code]
LPWSTR s2;
m_int0.Call17(&s2);
The programs compile, but do not run:
The C++ call to Call13 gives me the message "Not enough storage is available to complete this operation".
The C++ call to Call17 in Debug mode shows that there is a breakpoint in the program:
"This may be due to a corruption of the heap, and indicates a bug in go2.exe or any of the DLLs it has loaded."
Does anyone have any ideas?
Regards,
Mike
modified on Wednesday, April 15, 2009 10:23 AM
|
|
|
|
|
|
Hi
My VB.NET Library references ADODB. When I build it, the above message comes out.
Should I run tlbimp.exe ?
Thanks
Marcello Turnbull
|
|
|
|
|
You may need a strong name key file. Investigate Project Properties->Signing:
Sign the assembly
Choose a strong name key file
Regards,
Mike
|
|
|
|
|
Hi all,
I am new to COM,
and i use MFC for developing com
I developed an out process server(Automation Server) and i exposed a singleton comobject to outside world
to achieve singleton what i have done is inherited a class from COleObjectFactory and override the OnCreateObject in the derived class and it looks like this
CCmdTarget* CSingletonFactory::OnCreateObject()
{
//static CServer m_sServer;
//return &m_sServer;
if (m_Server == NULL)
{
m_Server = new CServer;
}
return m_Server;
}
and i wrote a client that too in MFC which just creates the object every time i click start button
(here always it returns same object's IDispatch pointer)
void CComClientDlg::OnBnClickedStart()
{
// TODO: Add your control notification handler code here
CLSID id = { 0xe856e42c, 0xe479, 0x4008, {0xb2, 0xf8, 0x1, 0xec, 0x9e, 0x5a, 0x84, 0x63} };
COSERVERINFO si;
si.pwszName = OLESTR("127.0.0.1");
si.pAuthInfo = NULL;
si.dwReserved1 = 0;
si.dwReserved2 = 0;
MULTI_QI rgmqi;
rgmqi.pIID = &IID_IDispatch;
rgmqi.pItf=NULL;
rgmqi.hr=S_OK;
HRESULT hresult = ::CoCreateInstanceEx(
id,
NULL,
CLSCTX_LOCAL_SERVER,
&si, 1, &rgmqi);
if (hresult == S_OK)
{
//hmmm success
;
}
}
but wat happens is when i click the start button 6 times my server is getting crashed
running in debugger alone i could able to find the crash(if not in debugger my server is getting shutdown silently and opening again)
In Debugging what i have found is the reference count of my object is steady getting reduced,
when i try to create the object first time(first time when the OnBnClickedStart is called) the ref count is 0 and next time it becomes 4(i dono how) and when i continuously call OnBnClickedStart for six time server crashes)
am i missing some thing here?
As it is a singleton should i give my one addref and release?
help me please
Thanks,
Jey
jey
|
|
|
|
|
For one of my customers I simply used the TAPIRequestMakeCall method for making an outgoing call.
The problems is that it triggers Windows Dialer which popups 2 windows.
This is very annoying.
So I am looking for another way to make an outgoing call (not using the requestmakecall method) using the TAPI3LIB.
So my question is, what is the minimum required code/steps for making an outgoing call?
The article at http://msdn.microsoft.com/en-us/library/ms733298(VS.85).aspx[^]
Seems to have too much overhead for me.
Can anyone help me out here?
|
|
|
|
|
I'm at the end of my rope here... I've been bashing my head on my keyboard for the last week trying to figure out this issue.
I'm trying to display a flash control on a DirectDraw surface and my call to AtlAxAttachControl fails - preventing the flash player from appearing within the control.
Here's a stripped down version of my code:
#pragma once
#include <string>
#include <windows.h>
#include <exdisp.h>
#include <mshtmlc.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
using std::string;
#import "PROGID:ShockwaveFlash.ShockwaveFlash" no_namespace raw_interfaces_only
typedef HRESULT (WINAPI *LPAtlAxWinInit) ();
typedef HRESULT (WINAPI *LPAtlAxGetControl)(HWND hwnd, IUnknown** unk);
class FlashViewer
{
public:
FlashViewer();
~FlashViewer();
bool Init(int Width, int Height);
void OpenFlash(const char* filename);
void DrawToSurface(LPDIRECTDRAWSURFACE7 lpdds);
private:
int mViewerWidth;
int mViewerHeight;
HWND mViewerWnd;
IShockwaveFlash* mFlashCtrl;
};
FlashViewer::FlashViewer()
{
mViewerWidth = 0;
mViewerHeight = 0;
mViewerWnd = 0;
mFlashCtrl = NULL;
}
FlashViewer::~FlashViewer()
{
DestroyWindow(this->mViewerWnd);
if (this->mFlashCtrl != NULL)
{
this->mFlashCtrl->Release();
this->mFlashCtrl = NULL;
}
}
bool FlashViewer::Init(int width, int height)
{
LPAtlAxWinInit AtlAxWinInit3 = (LPAtlAxWinInit)GetProcAddress(LoadLibrary("atl"), "AtlAxWinInit");
LPAtlAxGetControl AtlAxGetControl3 = (LPAtlAxGetControl)GetProcAddress(LoadLibrary("atl"), "AtlAxGetControl");
MSG msg;
HRESULT hr = AtlAxWinInit3();
HWND hwnd = CreateWindow("AtlAxWin", "", WS_VISIBLE|WS_POPUP, 0, 0, 1024, 768, 0, 0, 0, 0);
IShockwaveFlash* flash = 0;
hr = CoCreateInstance(__uuidof(ShockwaveFlash), 0, CLSCTX_ALL, __uuidof(IShockwaveFlash), (void **)&flash);
hr = flash->put_WMode(L"transparent");
hr = flash->put_Loop(true);
hr = AtlAxAttachControl(flash, hwnd, NULL);
hr = flash->put_Movie(L"c:\\FrontEnd.swf");
long pVal = -1;
flash->get_ReadyState(&pVal);
return true;
}
void FlashViewer::OpenFlash(const char *filename)
{
this->mFlashCtrl->LoadMovie(0, _bstr_t(filename));
}
void FlashViewer::DrawToSurface(LPDIRECTDRAWSURFACE7 lpdds)
{
if (this->mViewerWnd == NULL)
return;
RECT rect = {0, 0, this->mViewerWidth, this->mViewerHeight};
HDC hdcSurface;
HRESULT hr = lpdds->GetDC(&hdcSurface);
if (FAILED(hr))
return;
SetMapMode(hdcSurface, MM_TEXT);
OleDraw(this->mFlashCtrl, DVASPECT_CONTENT, hdcSurface, &rect);
lpdds->ReleaseDC(hdcSurface);
}
When debugging - the console displays two First-chance exceptions as soon as AtlAxAttachControl() is called... Both are 0x8001010D: An outgoing call cannot be made since the application is dispatching an input-syncronous call.
This problem is totally driving me crazy... PLEASE SOMEONE HELP.
|
|
|
|
|
How to create new object in C# for reading COM port.
I am having 'Comet.xyz' object. this object comes from COM port.
please tell me how can i convert following code into c#.
/////////code in delphi
Coment := CreateOleObject('Comet.xyz');
Coment.COmPort="COM1";
please convert it into C#
|
|
|
|
|
You can make a reference to the object...
If not then you can use "Late Binding",...
Type type = Type.GetTypeFromProgID("WScript.Shell");
Object oShell = Activator.CreateInstance(type);
Object[] oArgs = {"notepad.exe"};
type.InvokeMember("Run", System.Reflection.BindingFlags.InvokeMethod, Type.DefaultBinder, oShell, oArgs);
I'm not home in C#, but in VB.Net with "Option Strict Off" you can also just write
Dim type As Type = Type.GetTypeFromProgID("WScript.Shell")
Dim oShell As Object = Activator.CreateInstance(type)
oShell.Run "notepad.exe"
GTH
It feels good to learn and achieve
modified on Thursday, April 9, 2009 5:58 PM
|
|
|
|
|
Just like add-in express, do we have another development tool??
I need to add 2 buttons in microsoft outlook express...
Can someone redirect me to relevant sites,articles etc..
Thanks.
|
|
|
|
|
Hi Guys,
I am trying to round the value of long value. But i have this value in data type Variant.BSTR.
I can convert to this value by changing its data type from BSTR to VT_I4 through VariantChangeType(), in this conversion this value will be get rounded to nearst integer.
Again i should convert this value from VT_I4 to BSTR by VariantChangeType().
This is working fine for ODD numbers but failing for EVEN numbers.
if(FAILED(VariantChangeType(&vtValue,&vtValue,VARIANT_NOVALUEPROP,VT_I4)))
{
ASSERT(false);
}
if(FAILED(VariantChangeType(&vtValue,&vtValue,VARIANT_NOVALUEPROP,VT_BSTR)))
{
ASSERT(false);
}
Ex: if vt.BSTR = "5.5"
after conversion to VT_I4 its value will be 6
But
if vt.BSTR = "6.5" My expected value is 7 here
but after conversion to VT_I4 its value will be 6 only.....any idea please...need to set anything while using this api...
|
|
|
|
|
For me it is crashing when I am changing BSTR to VT_I4 with change type , can you please give me the solution if you found?
My code looks like:
varValue.ChangeType(VT_I4); //_variant_t varValue is BSTR
where varValue is BSTR type and it is null, how can we change in this situation?
modified 17-Jun-19 8:59am.
|
|
|
|
|
Hi,
I need to use the System.Printing.Activation dll bu I'm unabled to find it in the .NET Framework 3.5
I was searching on the net but I can't find it and I saw no other case like mine. Did somebody have tehe same problem I have.
Please help me.
Regards.
|
|
|
|
|
I Just found an answer to my question. The reference i was searching is include into the ReachFramework.dll
apologies
|
|
|
|
|
Hi,
I have a VB code (ActiveX ExE) which has a VB form called DocX.
This form has a GET property (name it retProp) which returns an object.
I have compiled the ActiveX EXE and later used tlbimp from dotnet to generate an Interop.MyProject.dll
Later I have included this dll as a reference in my C# project.
Now I am getting the namespace MyProject.MyInterface.
When I use the following code it says "true"
if (MyInterface.Windows.Exist(ref data) == true)
--> MyInterface.Windows.Exist(ref data) returns the MyInterface.Windows.Window as object
Because MyInterface.Windows.getItem(ref data).Form is returned as an object to me I am not able to Unbox it. I get an error :
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'VB.Form'. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type. Instances of this type cannot be cast to any other class; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Pls help.
Regards,
tvks
|
|
|
|
|
I want display a black background page in a IWebBrowser2. But it always flicker when it is refresh.
So I write following code to fix it.
::SetWindowLong(m_hBrowWnd, GWL_WNDPROC, (LONG)MyBrowWndProc);
m_pBrowWndProc=(WNDPROC)::SetWindowLong(m_hBrowWnd, GWL_WNDPROC, (LONG)MyBrowWndProc);
LRESULT CALLBACK CDlgTest::MyBrowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CDlgTest* pThis=(CDlgTest*)g_pIeTestDialog;
if(!pThis)
return FALSE;
if(message == WM_ERASEBKGND)
{
return NULL;
}
return CallWindowProc(pThis->m_pBrowWndProc, hWnd, message, wParam, lParam);
}
It work well at IE 8, but crash at once at IE 6.
Who can help me?
|
|
|
|
|
Will I be able to address all the requirements with a free threaded model? Assuming I have an efficient synchronization mechanism in place. Single,Multi apartments can ever be avoided?
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: Will I be able to address all the requirements with a free threaded model?
Ummm, what requirements?
_8086 wrote: Single,Multi apartments can ever be avoided?
A COM server resides in either a Single Threaded Apartment or a MultiThreaded Apartment. To avoid the use of them you should not use COM at all....
I guess you have to clarify your question (a lot, probably).
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
What about Free-Threaded model? Which is analogous to a background thread? Free-Threaded model is Multi-threaded model?
----------------------------
286? WOWW!
|
|
|
|
|
Ok let me try to explain better.
I write a COM component that runs multiple threads inside. A simple CreateThread used.
I use critical sections to protect objects inside the thread function. What is this model called? I think this is free threaded model.
Also, when I read about STAs they say it deals with UI messages. It makes me tried. After all these brain squeezing efforts to understand COM, when I felt I'm okay with the concepts, a thunder on the head again. What the frack UI messages have got to do with a COM component. I know the dumbness is on my side, but I really don't understand. May be they are talking about Active-x? Understanding this threading models looks like nightmare. If you can help me with a casual explanation. I'd be grateful.
----------------------------
286? WOWW!
|
|
|
|
|