|
I think you can solve the problem making an out-of-process (i.e. an excutable) COM object: this way only a single process (the COM server) will access the hardware resource on behalf of its clients.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for the answer.
- modif 2 -
Thanks, with singleton design implementation it's perfect...
A++
...
|
|
|
|
|
I can't use Word.Application ... in VS 2005. What is the problem here? I've installed Tools for Office
|
|
|
|
|
Hi,
It's not the same problem, and my problem was solved.
But i can help you... I don't use "Tools for Office" to access Word, i use typelib with MFC wrapper or #import command.
1) To use Word typelib, word must be installed on you machine ^_^
2) You can connect to word from different way.
3) There a lot of good article on this this with Excel try one, and replace Excel.Application by Word.Application and remove Excel specific code...
If you can't solve your problem, send me an other message, actually my VC is dead, i need to install VC2005 in the next hours...
Bye...
...
|
|
|
|
|
i wanna customize webbrowser in my own ocx(mfc activex),
according to Sumit Kapoor's method(plz see,
Customize Web Browser ActiveX and change its inbuilt settings[^]
i add
CCustomOccManager *pMgr = new CCustomOccManager;
m_pDispOM = new CImpIDispatch;
AfxEnableControlContainer(pMgr); into ocx's InitInstance, and implement the IDropTarget interface,now i want to do something in Drop() function,i wanna get the point of the main ocx ctrl through AfxGetMainWnd(), ,of course i got the point,and could get the member webbrowser which had been capsulated in the ocx control,hereto,everything is ok,then i call the webbrowser's method through formmer point,(eg
CMyCtrl* pWnd = (CMyCtrl*)AfxGetMainWnd();
pWnd->m_ctrlWeb.Image(strImage);
),
here problem comes,
if (S_OK == m_pCmdTarg->QueryStatus(&CGID_MSHTML, 1, &ocmd, NULL))
return ocmd.cmdf;,
and error msg is:
First-chance exception in ViewTest.exe (MyControl.OCX): 0xC0000005: Access Violation.
what is the meaning? help!?
thanks!
-- modified at 6:41 Friday 18th May, 2007
|
|
|
|
|
XPointer wrote: First-chance exception in ViewTest.exe (MyControl.OCX): 0xC0000005: Access Violation.
what is the meaning? help!?
It means, either m_pCmdTarg or ocmd or CGID_MSHTML is uninitialized , when it is expected otherwise.
Prasad
MS MVP - VC++
|
|
|
|
|
thanks your reply,
i debug my code again,the variables u referred before are all ininitialized,
i suspect that whether i could use AfxGetMainWnd() in my ocx
|
|
|
|
|
XPointer wrote: suspect that whether i could use AfxGetMainWnd() in my ocx
Don't think so. Probably, you can use some other function , usual MFC function on that returned window pointer, to check it's sanity.
Prasad
MS MVP - VC++
|
|
|
|
|
thanks prasad,
without using AfxGetMainWnd(), which other function could i use,
btw, i have no choice but using globle point to webbrowser instead?
any good idea about this?
|
|
|
|
|
Sorry for confusion. What I meant was, use some other MFC function on returned CWd*.
CWnd *pWnd = AfxGetMainWnd(),
pWnd->FlasWindow(TRUE);
Prasad
MS MVP - VC++
|
|
|
|
|
hi,prasad,thanks your kindness,
i adding pWnd->FlasWindow(TRUE); into my program,but it's not ok yet
|
|
|
|
|
I guess, I'm not able to explain you.
This function will not solve problem. I wanted you to check sanity of pointer you suspect.
It is dangling pointer for sure. Doesn't call stack tell you something ?
Prasad
MS MVP - VC++
|
|
|
|
|
u mean the c all stack of AfxGetMainWnd() ,oh,it's too complicated
|
|
|
|
|
hi,prasad,r u here now?
i found the m_pCmdTarg's address that i called it through AfxGetMainWnd(), is different to that one called directly in the ocx control,it's so strange,
do u have any idea about this problem?
thanks
|
|
|
|
|
Hai,
How can I implement more than one interfaces in same coclass using ATL
Thanks
George
|
|
|
|
|
georgekjolly wrote: How can I implement more than one interfaces in same coclass using ATL
This is the easiest way in VC6:
You have to have a typelibrary for the interface you want to implement in your CoClass. This could mean that you define another interface in your IDL-file for your CoClass if it doesn't exist yet.
Right-click your CoClass object in the ClassView and select "Implement interface..." and check the interfaces you want to implement in your CoClass.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi Roger,
I tried it, and its working. Now I am able to Query one interface from
another(They belongs to different coclass) .
Thanks
George
|
|
|
|
|
There is an article in MSDN so that we can run multiple version of COM Components at the same time using a .local file.
"DLL/COM Redirection on Windows"
I tried this but it never works. Any Idea?
|
|
|
|
|
The DLL to be redirected to must be placed in the same folder as the application, and the file must be in the same folder and named appname.exe.local. For example, notepad.exe.local to redirect Notepad.
|
|
|
|
|
Hope to use C# for ActiveX in Excel VBA. Success to call as COM, but fail to add the control from "Control Toolbox" as ActiveX
I want to use C# for ActiveX in Excel, but fail to add the control from "Control Toolbox".
I have write a COM object using C#, and I can call those function in Excel VBA normally.
But when I try to change it as a ActiveX, I fail.
The Excel can detect my COM object as a ActiveX, that means it can show in the "Control Toolbox".
Once I select it, and try to put it in the Excel, it show me a dialog box said "Cannot insert object".
I have read the following link about the error message, but for my ActiveX in C# do not have the .odl file.
http://support.microsoft.com/default.aspx/kb/171280/
Can any one give me some hints?
|
|
|
|
|
HI again-
another newbie query:
Having got a Gridview bound to a dataset (which is the returned value of a method), and having all the fields displayed by field-name without any code, i thought i could do the same with Formview: bind it to a dataset and have form-controls generated for each field.
But it didn't happen, i could not get it to work; so i ended up binding my Formview to a method that returned a class: with code like
------------------------
myClass2.SpeciesId = _dsSpecies.Tables(0).Rows(0).Item("spID").ToString
myClass2.CommonName = _dsSpecies.Tables(0).Rows(0).Item("common").ToString
myClass2.LatinName = _dsSpecies.Tables(0).Rows(0).Item("latin").ToString
myClass2.LifeText = _dsSpecies.Tables(0).Rows(0).Item("lifecode").ToString
--------------------
to get at each field of the dataset.
Which is rather like the code I had "in the old days", but having discovered the data-adapter and "fill" and getting my Gridview bound to the dataset, i thought i had got away from such coding?
Can anyone tell me if it is possible to bind a Formview to a Dataset, so that the Formview controls can be generated (or selected) from that dataset, or do i need to leave my code as above? There must be a way oif Gridview is so clever, but binding to a method that returned a dataset didn't go anywhere
thanks -
aitch
--x---
|
|
|
|
|
Maybe the VB.NET one is more appropriate.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Maybe the VB.NET one is more appropriate.
is it, i'm sorry: but as there is far more about the Formview Control in my asp.net books than in my vb.net books, and the asp.net books go into it in much more detail, i thought this was a more appropraitw forum.
Unfortunetaly, neither the asp.net nor the vb.net books gives me any indication if i can bind a formview to a dataset.
|
|
|
|
|
HI,
How to fine the different DLL's, like which one is COM Dll, ordinary Dll or some other dll.
Nandu
|
|
|
|
|
Use Dependency Walker[^]
to load the DLL.
If the DLL has following exported functions (ideally) -
1. DllRegisterServer
2. DllUnregisterServer
3. DllCanUnloadNow
4. DllGetClassObject
then you can call it a COM DLL.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|