|
Again, you're making this much too hard. The implementation of the IDataObject is nothing more than a way to encapsulate all the information about an object being dragged (or copied to the clipboard).
The STGMEDIUM and FORMATETC structs describe how the data is contained, and what the data is, respectively. You provide either an IStorage (not IPropertyStorage , which is very different) or an IStream implementation in the STGMEDIUM , as well as setting the tymed field to the associated enum type. Set the clipboard format in the FORMATETC struct. Pack your data and these structs into your IDataObject implementation and call DoDragDrop with that, your IDataSource implementation (which you can easily create from a .NET
Control</cod> since I know that's what you're after), also specifying your allowed effects.<br />
<br />
When a possible drop target gets the drag over event, it looks at the <codE>FORMATETC and allowed effects to see whether or not it can except it. It may also look at the STGMEDIUM to see if it can accept data passed along in those formats (the shell should handle all of them just fine). It then alerts the drag that it can accept them. If a user drops the data, the drop target gets the storage object from STGMEDIUM and handles it appropriately. If it's a filename, it would copy, move, or link them (depending on the effects). If it was an IStream implementation, it would get information about the stream and Read till done. If it was locked in global memory it copies it out and frees the global memory. So on, so forth.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello ! I use the MFC ActiveX ControlWizzard
I'm really new to ActiveX development. I want to know if it is possible to have another ActiveX in the current ActiveX I'm developping (like a class member of the Ctrl class) ? If yes, how (and when) do I have to create the control ???
I'm a little bit lost
And by the way, if you have some links to good tutorials, they are welcome !
Thanks!
|
|
|
|
|
Yes use the composite controls.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
Thanks for the response...
Hum, sorry but can you be more specific ?? I'm really new to this and I really don't know what is composite controls...
Thanks
|
|
|
|
|
A search on MSDN will give you the sol and that would be muct detailed explanation.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
I have written a quite complex dialog-project using MFC C++. Now I would like to distribute it on the net. My only thought is to “convert” it to an ActiveX but are there any other good ways?? Pleased for suggestions.
If an ActiveX is the “best” solution, how to make it quick?
.....and justice for all
APe
|
|
|
|
|
ok, i got the com object to register using the
<br />
DECLARE_REGISTRY_RESOURCEID<br />
macro
however there was something wrong with the RGS file that made it unable to unregister it. please look at this RGS file:
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'TestAgent'
'TestAgent.DLL'
{
val AppID = s '%APPID%'
}
}
NoRemove Folder
{
NoRemove ShellEx
{
NoRemove ContextMenuHandlers
{
ForceRemove TestAgent = s '{7BA0D1BF-0B50-4B3A-B8E5-229B9D97C282}'
}
}
}
NoRemove *
{
NoRemove ShellEx
{
NoRemove ContextMenuHandlers
{
ForceRemove TestAgent = s '{7BA0D1BF-0B50-4B3A-B8E5-229B9D97C282}'
}
}
}
}
it's the first section (NoRemove AppID) that is causing the problem making ATL unable to UNregister the server. It has no problem registering it. That part is generated automatically by Visual Studio. Removing it fixes it. Why doesn't it work? Is it needed?
on a side-note, how did i find out? by manually overriding DllRegisterServer and DllUnregisterServer, i found out that this call failed:
if( this->UpdateRegistryFromResourceS(IDR_TESTAGENTPROJECT, FALSE ) != S_OK )
{
MessageBox( NULL, "ureg bad 2", "!", 0 );
return false;
}
the counter-part, registering, went flawlessly... really wierd for me..
thanks, appreciate the help.
|
|
|
|
|
How can i use the IBidiSpl COM interface in either VB.NET or C#.NET.
My major problem is knowing which type library that defines the interface because i have gone through the documentaion in the msdn with the hope that i will get a clue but no way.
I would welcome any suggetion that will enable me know the type library that implement it.
|
|
|
|
|
How do I call the Task Manager or the Job Scheduler of SQL Server
from an application. I am developing using C# but examples using VB would be great.
Adam
|
|
|
|
|
hi there
I have a very strange problem I hope you can help me sort it out.
I need to share a hashtable between multiple process (right now 2 is enough...), so I made a com+ class, made it a Singleton, inherited from ServicedComponent, registered it as a server application within "Component Service" and put it in the gac.
We'll call this class "Container"
I'm having problems sending that container the elements to put in the hash-table.
At first I made them as simple as possible, then I got an error that the class isn't serializable, so I figured that happenned because it tried passing param by value. Because I want to pass parameters as references, I made the object inherit from MarshalByRefObject instead . (We'll call this class HashObject)
Now the solution compiled, and I even called stub methods inside the Container which worked, but when I try to actually call Hashtable.Add() inside the com+ container I get an exception: System.runtime.remoting.remotingException telling me my server hasn't got a sink to use or the application doesn't have a client sink.
I know that by using com+ I'm actually using remoting as well, but why do I get that exception when I'm trying to read the values of the object I sent to the Container ?
The weirdest thing is when I made Container accept System.string instead of HashObject, it could read the string. (but not a string within HashObject in the first configuration)
I'd really appriciate any help or suugestion you might have
Thanks
Yoav S.
|
|
|
|
|
I found the solution
apparently- you can't use MarshalByRefObject in com+ , only in .net remoting.
so all information travels should be made "by value" and not "by reference".
hence all the objects passed to a com service must be serializable or implement ISerialize.
until next time
Yoav S.
|
|
|
|
|
hello!
i have a shell extension that registers on the contextmenu on folders and files. it worked fine until we migrated to visual studio 2003. the RGS file simply doesn't register!
i have looked inside the DLL that is created, and i can see that the information is there. it just isn't transferred to the registry upon registration.
it's easy to reproduce: create a new ATL project, add an ATL simple object, and compile. i rely on the (default) post-build-action "performing registration", that does the regsvr32.exe /s /c my.dll. yes, i can register it successfully manually. i am the only user on my computer, so its fair to assume i have admin rights (windows xp).
this is the looks of the basic RGS file that comes with the new project:
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'TestAgent'
'TestAgent.DLL'
{
val AppID = s '%APPID%'
}
}
}
the thing is, the dll does contain all the information from the RGS file (i can see it). the dll gets "successfully" registered, but NOTHING from the RGS file gets transfered to the registry. there ARE things coming into the registry (CLSID, TypeID etc) but those things are not from the RGS file.
i have no idea what i have done wrong. how can you tell visual studio to mark the RGS resource file so that regsrv32 transfers it to the registry? i thought that was automatical. it just isn't so in "my environment" for some strange reason.
i would be SO glad if someone could help me out, you wouldn't know! i've been on this for so long my hair has changed color. maybe there is something wrong with how i create the project.
/daniel
|
|
|
|
|
First up, a bit about mechanisms. RegSvr32 knows nothing of .RGS scripts. It only knows how to call DllRegisterServer , a function that your DLL should implement (along with its counterpart, DllUnregisterServer).
ATL offers support in CComModule (ATL pre-7.0) or CAtlDllModuleT (ATL 7.0+) for registering servers. ATL provides the parsing for the registry information. In order for ATL to register your class 'automatically', it must appear in the module's object map, and it must have an appropriate DECLARE_REGISTRY_xxx macro in the class.
The first thing to do is to check that these conditions are met.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
first of all, thank you very much!
when i worked with Visual Studio .NET (not 2003), I didn't have to think about any of that. How come it has changed like that?
Previously, the RGS file registered automatically without any macros or something like that. Then DllRegister/Unregister must have had a more rigourous standard implementation in the last version of Visual Studio, making things wierd for me. The agent worked flawlessly before, for a year or so until i transfered my whole project to visual studio 2003.
do you know of any good resources where i can learn about that? I'll make a search right away.
|
|
|
|
|
first of all, if I add in my class
<br />
DECLARE_REGISTRY_RESOURCEID(IDR_MONKEY) <br />
i get:
warning C4199: Cannot inject full attribute code due to duplicate member: UpdateRegistry
also, this code created by the wizard:
<br />
[ module(dll, uuid = "{65B6EA97-CE45-4D29-8928-E305C8DD7C9A}", <br />
name = "Monkey", <br />
helpstring = "Monkey 1.0 Type Library",<br />
resource_name = "IDR_MONKEY") ] br />
class CMonkeyModule<br />
{<br />
public:<br />
};<br />
even has a reference to the RGS file (IDR_MONKEY)
and states they are automatically implemented.
please give just a tiny little bit more of help
|
|
|
|
|
Hi,
How i can access or know about DLL files function . so i can use it in my code?
Regards
Ali Alaradi
|
|
|
|
|
While this is not a COM specific question, I'll try and answer it anyway.
The DLL (any DLL) will have 'exported' functions (and possibly data). You can use LoadLibrary to get the DLL into memory (so you can call code in it), and use GetProcAddress to find the entry point for a given function.
However, there is no guarantee that the DLL itself contains enough information for a 3rd-party to use the DLL, unless they also have documentation or perhaps a header file that describes the function names, their parameters and types.
Without those, you can't reliably use the DLL. However, some DLLs, authored in VC++, from C++ rather than C files, may contain decorated names. These will include parameter lists, including types.
Something like the dependency checker (part of the Platform SDK) can be used to examine a DLL.
Steve S
|
|
|
|
|
Thanks My friend.
regards
Ali Alaradi
Developer
|
|
|
|
|
Hi
Anyone in here who knows how to modify the properties of a MSChart ActiveX control embedded in a web page using Javascript?
I have managed to set a few properties (like Title, ChartType) that are displayed correctly, but when I try to fill the ChartData property with my own data nothing happens, and afterwards no other property can be set either.
Code snippet:
<html>
<head>
<script type="text/javascript">
function f()
{
var c = document.getElementById("MSChart1");
c.Title.Text = "Title";
c.FootnoteText = "Foot Before";
c.AllowSelections = false;
c.ChartData = [[10,20,30],[5,10,15]];
c.FootnoteText = "Foot again";
}
</script>
</head>
<body onLoad="f();">
<OBJECT ID="MSChart1" CLASSID="CLSID:3A2B370C-BA0A-11D1-B137-0000F8753F5D" CODEBASE="MSChart5.OCX" width="400" height="300">
</body>
</html>
Thanks
/Marabou
|
|
|
|
|
hi,
what is the meaning of the error "interface not compatible" returned by HRESULT? In the client I include the server header file which contains the definition of the remote interface. So, it must be the same interface.
Thanks!!!
|
|
|
|
|
hello,
i think i know what is the problem: I also need a proxy/stub DLL. So, I need to register the proxy/stub DLL on both the client and the server computers.
To regisrer the DLL on the server i have done:
nmake -f Projectnameps.mk
where projectname is the name of my project. This command has built several files, included the Projectname.dll file.
Now the problem is that i dont know very well how to register the DLL on the client. I have tried two differents things:
1.- Set up the remote activation using progammatic changes to the client (call CoCreateInstanceEx()instead CoCreateInstance()(),...).But it doesn't run.
2.- Follow the instructions of this article http://www.apostate.com/programming/reg-atl-dcom.html
but i dont understand very well the last step: "Use DCOMCNFG to change the execution location of your server from Run application on this computer to Run application on the following computer", and this way to register the DLL sounds a bit rare, doesn´t it?.
I am confused... Can you help me?
thanks.
|
|
|
|
|
Hi,
Supposing I have a 2D array of chars in my ActiveX component, how do I make my array visible to an MFC application inside of which I want to embed the control?
I have read about the Get/Set methods - in theory I should be able to return a pointer to the first element in the array to my app but how is this done???? Do I have to convert or map my 2D char array as a VARIANT type and use this in the Get method?
If anybody has an example of this kind of thing or detailed advice that would be great. I just can't find an example of this anywhere
I am using Visual C++ 6.0 to develop my ActiveX control and the MFC app.
Cheers, Stephen
|
|
|
|
|
I've created a Connection Page (in the Data Source Object of my OLE DB Provider) to be displayed by the Data Link core component.
Now I'm trying to add a tab control on the page using CreateWindow with the WC_TABCONTROL class (being registered through InitCommonControlsEx(...).
But I can't get the Instance Handle needed by CreateWindow,
because
hInst = (HINSTANCE)::GetWindowLong(hwndParent, GWL_HINSTANCE);
always returns 0x0000000.
(I've received the hwndParent through the IPropertyPage::Activate Method, that's being called by the Data Link core component)
How can I get that Instance Handle? Or is there another way of using a tab control on my property page?
|
|
|
|
|
We recently upgraded to Windows 2000 and I am having a little trouble with DCOM. I have an application which runs on one of my workstations as a server to applications on another workstation and a colleague's workstation. It works fine between my two computers but when my colleague tries to invoke it he gets a permission denied message.
The server application has a user interface, so we specified it to run under the INTERACTIVE identity. Also I set up custom launch and access permissions so that my colleague is allowed to launch and access, and I made him an administrator on my machine for good measure. This worked fine under NT 4 but apparently it is not good enough under Win2k. What am I missing?
READIN writin rhythmetic
|
|
|
|
|
"Invalid Number of Parameters"
This isn't my best day... I get some very strange bugs...
I use MS Visual Studio .NET typelib wizard to create a class for CanvasShapes Word object. I obtain the object, then I call one simple method of it. Simple textbook thing.
And I get the error message: "Invalid Number of Parameters"! Not during compilation, but during runtime!!!
W_Shapes sh = wdoc.get_Shapes();
W_CanvasShapes csh = sh.AddCanvas(0,0,500,500, covOptional);
csh.AddLine(0,0,100,200);
Produces the error!
What is going on here?
|
|
|
|
|