|
hi there..
thanks for your time..
i needed to know if its possible to know if a control is UI Activated already or not? and secondly which function is called when a control is UI DeActivated?
regards
safee
|
|
|
|
|
|
Hi there
Using the API GetAmbientUserMode() , this tells whether the container is in run-mode (TRUE) or design-mode (FALSE).
regards
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I'm quite new to VC++ programming. I need to develop an application which has independent pluggable modules (DLL ?) with the core application passing some arrays of data to the plug-ins and getting back the processed data from the plug-in. The core application should run without error even if any corresponding module (plug-in/DLL) is missing at run-time. The core application should also be able to detect any new plug-in and load it dynamically. Any changes to the plug-ins should not require the core application to be re-built.
Grateful if anyone could advise the best possible solution to the above mentioned task - use explicitly linked DLLs or use COM ? Any sample codes or articles available for this?
I'll be using VC++ 6.0. Thanks a lot in advance !
|
|
|
|
|
You will probably get far more helpful, and a greater number of replies in the VC++ forums.
Though your search for an answer will almost certainly lead you back here at some point or another
Cata
|
|
|
|
|
Hi,
I'm just starting to use COM dlls but have come across what I believe must be a common problem for brainwashed MFC folk... absolutely any suggestions would be welcome!
I have a standard Windows app generated using Visual C++ V6.0 which uses a CRichEditCtrl control. The app is served by several COM dlls.
I would really like to dedicate one of the COM dlls to displaying the information in the CRichEditCtrl control. The problem is how do I tell the COM dll the pointer to the control?.
I have tried passing the control window handle (hwnd) and then using SendMessage(hwnd,,,). Thats OK for raw text but when I want to (say) get the defaultcharformat I really need the control's CRichEditCtrl* pointer.
I guess I could pass a void ptr and then cast to CRichEditCtrl* - but this seems to go against good COM practice? Can anybody recommend a COM friendly solution and restore my initial enthusiasm to program with COM!
Many Thanks
BarryM
|
|
|
|
|
Hi,
I eventually passed a long* ptr and casted back to CRichEditCtrl* in the COM method. Not nice but it seems to work. I hope to eventually discover the proper "COM" method of approaching this problem!
BM
|
|
|
|
|
I am trying to produce a library of objects relating to Drag and Drop. My library currently looks like this:
import "oaidl.idl";<br />
import "ocidl.idl";<br />
import "objidl.idl";<br />
[<br />
uuid(01020304-0506-0708-9010-011012013014)<br />
]<br />
library DragDrop{<br />
interface IDataObject;<br />
interface IEnumFORMATETC;<br />
interface IEnumSTATDATA;<br />
struct tagFORMATETC;<br />
struct tagDVTARGETDEVICE;<br />
struct tagSTGMEDIUM;<br />
struct tagSTATDATA;<br />
enum tagADVF;<br />
enum tagDATADIR;<br />
enum tagTYMED; <br />
};
However I have a problem. While I have found many of the interfaces and structures used by the IDataObject and it's proceeding object tree. I have been unable to find the STGMEDIUM object in any of my IDL import libraries. Do i need to include this in my library?
I have found a number of instances of STGMEDIUM object, but have not actualy found one that is the one I am looking for. there is remSTGMEDIUM, and uSTGMEDIUM. Which of these should I be using if any?
I would Have thought so if i want to compile it to a TLB.
Aditionaly, there are a number of structures and enumerations defined in the interfaces. Should I pull these out and implement them in the type library seperately? Or is this done automaticaly?
Is there anything else I am missing?
Thanks
Cata
|
|
|
|
|
hi Everbody
I know GUIDGEN.EXE with four select,but i don't know what meaning those are and how to use! I hope you tell me !
Thanks for your answer!
|
|
|
|
|
They are just different formats of typing the same thing.
MSDN Says:
The radio buttons in the GUID Format group box determine the format of the GUID the program will generate.
The first format is designed to be used in invocations of MFC's IMPLEMENT_OLECREATE macro.
The second format generates a reference to the DEFINE_GUID macro.
The remaining formats are appropriate for statically allocated GUID s and GUID s included in registry entries or registry editor scripts.
|
|
|
|
|
I'm trying to run midl, however, I am encountering error after error.
Cl.exe was not located in the correct location.
when i moved it, there was no mspdb70.dll to support CL.exe.
These components were all in different folders.
Is this right? Or is my instalation of .NET completely knackered?
Is it worth moving all the tools and associated DLL's into one directory? As it's really annoying.
I've copied all the stuff in the Vc7\bin folder to the common7\tools\bin folder.
I've moved the objidl.idl file into the tools\bin directory.
It's still not building objidl.idl. I get the error "Cannot open unkwn.idl"
help!
Cata
|
|
|
|
|
Either your install is seriously f'ed up or you didn't run vcvars32.bat before trying to exec midl.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
Ahhh.... Gratz
didn't run vcvars32
What does it do?
I'm relatively new to the whole COM thing, and have only just discovered all these wonderful tools in VS.
Cata
|
|
|
|
|
I've run it through the command prompt (via windows), and it says that:
vcvars32.bat is not regognised as an internal or external comman, operable program or batch file.
do i have to run this in actual dos?
Cata
|
|
|
|
|
I had 3 versions of the batch file.
2 of them had the base bath, the third one was in quotes.
the third one worked.
Weird.
Cata
|
|
|
|
|
It does what I was telling you about in the C# forum - it sets the BIN, INCLUDE, and LIB env. vars. to directories associated with VS.NET (including its common directories, the PSDK (if installed with VS.NET), and the Framework SDK). It also sets up a few more helpful things.
Setting all these in your user or system env. vars. is even better, though, because then you don't have to worry about starting a command prompt with a certain batch script like the vcvars32.bat script. This way, any programming application that uses the env. vars. for such a thing and any command prompt you start (no matter how you start it) knows where to find executables (PATH), headers (INCLUDE), and libraries (LIB). The same goes for directories and JAR packages for Java (CLASSPATH).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
There's a Visual Studio 2003 Command Prompt entry in your VS.NET start menu folder.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Hi all..
I want to make a component (ATL) that returns an ADO Connection..
declaration of function :
STDMETHODIMP Cobj::get_Con(_ADOConnection *pVal)
{
.
.
.
return S_OK;
}
the problem is in the IDL :
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(DCF77B2B-1F18-4753-B0E5-6A937407509C),
dual,
helpstring("Iobj Interface"),
pointer_default(unique)
]
interface Iobj : IDispatch
{
[id(1), helpstring("method GetIt")] HRESULT GetIt();
[propget, id(2), helpstring("property Con")] HRESULT Con([out, retval] _ADOConnection *pVal);
};
[
uuid(310CB985-C3C4-4244-9D75-AB3345F8E982),
version(1.0),
helpstring("RetObj 1.0 Type Library")
]
library RETOBJLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("C:\Program Files\Common Files\system\ado\msado15.dll");
[
uuid(DAACB26F-1C20-455C-A1CE-2B979040A51F),
helpstring("obj Class")
]
coclass obj
{
[default] interface Iobj;
};
};
I get an erron neer the _ADOConnection :
error MIDL2025 : syntax error : expecting a type specification near "_ADOConnection"
any help please?
|
|
|
|
|
|
Hi,
I want to pass a window handle from my MDI application to one of my active X control's function. I tried doing it , but I recieve a error in my mdi application which is as follows.
"cannot convert parameter 3 from 'struct HWND__ *' to 'struct _RemotableHandle *'".
The idl in the active X control has the following declaration.
"[id(1), helpstring("method Init")] HRESULT Init(LPTSTR lpstrCmdLine, int nCmdShow,HWND hwnd);"
Upon compiling the idl I get the following warning
"warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'hwnd' of Procedure 'Init' ( Interface 'IIWzIDE' ) ]"
Please tell me how I can pass the window handle to my active X control.
Thanks a ton in advance
belankaar
|
|
|
|
|
Hi ,
Actually HWND data type cannot be used for automation, as it is not supported.
so what you can do is simply use long data type, make "HWND hwnd" as "long hwnd" and when u recieve handle in ur activeX object typecast again into HWND
Init(LPTSTR lpstrCmdLine, int nCmdShow,long hwnd)
{
HWND wHandle =(HWND)hwnd;
// now you can use this wHandle for your purpose
-----
-----
}
Regards
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I have found the EnumFORMATETC method for IDataObject in COM, and the C# verion, and they appear to have nothing in common. How does this:
HRESULT EnumFormatEtc(
DWORD dwDirection, //Specifies a value from the enumeration
// DATADIR
IEnumFORMATETC ** ppenumFormatetc
//Address of output variable that receives the
// IEnumFORMATETC interface pointer
);
Get turned into this:
IEnumFORMATETC OleEnumFormatEtc([in] int dwDirection);
i'm very fuzzy on this, as from what I understand, it should get turned into this:
<br />
int EnumFormatEtc(<br />
int dwDirection,<br />
out IEnumFORMATETC[] ppenumFormatetc<br />
)
If anyone could explain to me, why this is the case, I would be a very happy dude!
Cheers
Cata
|
|
|
|
|
I don't have much experience with C# but it seems that it respects the retval keyword (treating "failed" HRESULT s as exceptions).
And by the way... the ppenumFormatetc is an INTERFACE pointer, not an array.
And if the paths that I have followed/have tread against the flow/there is no need for sorrow
I am coming home
Return, Crüxshadows
|
|
|
|
|
As Stefan points out, HRESULTS are translated as exceptions in .NET. More specifically, they're translated into System.Runtime.InteropServices.COMException 's.
If you look up the IDL definition for EnumFormatEtc it'll look something like this:
HRESULT EnumFormatEtc([in] DWORD dwDirection, [out, retval] IEnumFORMATETC) All [in] parameters are treated as normal copy by value parameters. [in, out] are treated as ref parameters, and [out] are treated as out parameters in C# lingo. [out, retval] is a special kind of parameter (which must always be the last parameter by the way), which is mapped as the return type in languages which are not "C like".
The .NET framework will call the method something like this (pseudo code):
IEnumFORMATETC* EnumFormatEtc(DWORD dwDirection) {
IEnumFORMATETC* res = 0;
HRESULT hr = itf_ptr->EnumFormatEtc(dwDirection, &res);
if(FAILED(hr)) throw COMException(hr);
return res;
}
--
You're entertaining at least.
|
|
|
|
|
hi,
i have created an exe com seerver with Visual C++ 7 & WinXP SP1.
on my system ans my testing machine, my server register successfully.
But my client can't register it !
he seems he doesn't have any MFC70XX.dll on it system, thus an error appear during registration.
How can i update it system in order to add the MFC70 dll series ??
thanks.
modified 14-Jun-22 21:01pm.
|
|
|
|