|
What you could do is use Ole View (go to Run, type oleview and hit enter). Select File -> View TypeLib... and select you ActiveX control. Once you have the control open in the ITypeLib Viewer select File -> Save As. This will allow you to save the contents to a .idl file (Interface Definition Language). You can now use the MIDL compiler to generate a type library from the .idl. Once you have a .tlb file you can use one of the .NET command line tools to generate the appropriate interop assemblies. Use tlbimp.exe to generate an output assembly based on the COM-based type library you just generated. Use the newly generated assemblies in your .NET project. HTH
- Nick Parker My Blog | My Articles
|
|
|
|
|
Nope, can't do that. The Active-X control doesn't provide a typelib interface for the internal api I'm trying to access. The control itself has a typelib for interacting with the visible component, but the internal api you can get to.
For further information, I'm interacting with Adobe's SVG control. You can retrieve the internal DOM document from the COM interface, but Adobe doesn't provide a typelib for interacting with it. The functions and properties available are identical to the Javascript calls you can make from the browser, so I know the interface it provides. I just can't apply a .NET interface to the objects I get back.
Any ideas? Is there a way to get the guid from the COM object I get? It seems in order to apply an interface I need a guid.
--
Joel Lucsy
|
|
|
|
|
I have read the "DataGridColumnStyle Class" page from MSDN 2003 and built my own column style.
but i have a problem.
only when i click on a dataGrid 's cell the corresponding columnStyle appears.
but i want all the cells have their column style after AddData() Method.
for example all the cells that have the ComboBoxColumnStyle have combo appearance at first and user can select a combo.
what shoud i do .
please mail me a C# sipmle code to explain your solve.
arbuston@yahoo.com
|
|
|
|
|
|
I'm having a hardtime understanding interfaces. What is the purpose of having an interface that is a property of a class? I may not be asking this correctly because I don't know much about interfaces yet... see below
<br />
<br />
public interface IpropInt<br />
{<br />
}<br />
<br />
public interface Isomeinterface<br />
{<br />
IpropInt propertyInterface<br />
{<br />
get;<br />
}<br />
}<br />
<br />
<br />
class someclass : Isomeinterface<br />
{<br />
<br />
public IpropInt propertyInterface;<br />
{<br />
}<br />
}<br />
<br />
"...practice safe hex when IM'ing"
--Shawn L. Morrissey, Managing Editor, MSDN Online ( MSDN Flash; Volume 8, Number 20, 10/4/2004)
|
|
|
|
|
An interface allows you to define methods that a class must impiment, but you can also create an instance of an interface. So you can have all sorts of classes, with all sorts of base classes, but so long as they impliment IEnumerable, they can be cast to an instance of IEnumerable, and those methods only will be visible to the code that makes for each work, for instance.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
but you can also create an instance of an interface
Not really, they can really only be assigned by object that implement them, they can't be new'ed (the interface). I know you know what it means, I just don't want to confuse him.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Yes, you're totally right. *blush* You're right, I knew what I meant, but I didn't explain it as well as I could have.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
ok, but when I make a call to the interface that is a property of that class... I can get data out of it. What instance is it pulling that data from? How can something like that be populated with data... More info for you... the instance of my class is added to another instance of another class... the data that is inside of that interface is the same data I would expect from the "another class". I just am having a hard time seeing the relationship here.
"...practice safe hex when IM'ing"
--Shawn L. Morrissey, Managing Editor, MSDN Online ( MSDN Flash; Volume 8, Number 20, 10/4/2004)
|
|
|
|
|
If you have a class called MyClass, and it defines an interface, MyInterface, the only way to build an instance of MyInterface is from an instance of MyClass ( or another class that impliments the interface ). So the instance you're pulling data from is the instance you used to create an instance of the interface.
Have you done any C++ ? Interfaces is how C# gets around the lack of multiple inheritance.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
The interface itself can be used to call methods or supply properties, does the following example help clear it up?
interface IProcess
{
void Process();
}
class Example : IProcess
{
public void Process()
{
Console.WriteLine("Hello Example.");
}
}
class Test
{
[STAThread]
static void Main()
{
Test t = new Test();
IProcess p = new Example();
t.Fun(p);
}
public void Fun(IProcess p)
{
p.Process();
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
I'm not quite sure how to load or reference this dll as I need ntohl function.
What I need to do is to convert hex to int then switch the bytes to get other value.
I.e.
ABCD = 43981
switch byte and convert to int...
CDAB = 52651
|
|
|
|
|
I have a C++ application that I want to have interface with a C# Web Service application.
What are the different ways that I can go about this?
Thanks
|
|
|
|
|
One way that I know of:
Download the Microsoft SOAP Toolkit. It has COM object which you can use for your purpose. Use MSSOAP.SoapClient30 to invoke methods such as mssoapinit(), InvokeHelper() which let you communicate with a Web Service with most of the transport details (http/soap) hidden from you.
This will work just great for you…
I read that, Microsoft has now stopped supporting SOAP Toolkit (don't worry you will still be able to find soapsdk.exe somewhere), but what are the alternatives, is a question for me too.
Salil Khedkar [^]
|
|
|
|
|
HI all,
How can i incorporate the ability for a user to select an ROI by pressing his left mouse button and dragging it on the displayed image and also i want to set the max boundaries for dragging as the image resolution.
For this how can i implement my MouseDown event for left button.
anyideas or suggestions please...
thanks in advance,
Suman
|
|
|
|
|
Hi all,
Does anybody know how to set a windows service description? The serverinstaller component's Displayname property maps to the Service Name in the Services MMC snap-in. The Description in the MMC is empty. I can't find any property that maps to this description.
Thanks,
Peter
|
|
|
|
|
Since the ServiceInstaller doesn't define such a property, you have to write it to the registry yourself. The easiest way is, in your Installer derivative (the class that references the ServiceInstaller and ServiceProcessInstaller ), override Install (and Uninstall with code to remove the key) like so:
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
using (RegistryKey key = Registry.LocalMachine.OpenSubkey(
@"SYSTEM\CurrentControlSet\Services\" + serviceInstaller1.ServiceName))
{
if (key != null)
key.SetValue("Description", description);
}
}
string description;
public string Description
{
get { return description; }
set { description = value; }
} You wouldn't have to define it as a property, but it makes for a good design.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Fot those interrested, Heath's hint returns a read-only reference to the registry key.
Few bytes changed and it works:
public override void Install(IDictionary stateSaver)<br />
{ <br />
this.Description = "Blah blah.";<br />
base.Install(stateSaver); <br />
string p = @"SYSTEM\CurrentControlSet\Services\" + serviceInstaller1.ServiceName;<br />
RegistryKey key = Registry.LocalMachine.OpenSubKey(p,true);<br />
{ <br />
if (key != null) <br />
key.SetValue("Description", description); <br />
}<br />
}<br />
Ciao and thanks for your help Heath!
Peter
|
|
|
|
|
Hi, I am trying to use the PostMessage function by importing it through DLL import in C# with the following definition.
[DllImport("user32.dll")]
static extern bool PostMessage(IntPtr hWnd, int msg, Int32 wParam, IntPtr lParam);
Can someone give an example of what you would pass in order to get a keystroke, and a mouse click? Really, I do not understand what needs to go in for wParam, or lParam.
Thank you for your help in advance.
|
|
|
|
|
First you need to understand what the LPARAM and WPARAM types are. They are native, processor-dependent integers, so that on 32-bit processors they are 32 bits wide and on 64-bit processors 64 bits wide. Technically, both should be IntPtr , but people will often declare certain parameters as int to make it easier to call. Note, however, this is not portable to 64-bit Windows, just like declaring a parameter as a long in 64-bit Windows won't port to 32-bit. (Also note that a managed long is 64 bits; a native long is 32 bits.) The bit widths are important because in unmanaged code the arguments are pushed onto the execution stack and expected to be a certain size. If they're not, you have a stack corruption. Remember that unmanaged code is unmanaged because the CLR can't manage it.
You can, however, use things like out myStruct or ref myStruct because those pass the addresses of myStruct , which will always be the correct bit width.
When you're P/Invoking functions, you need to refer to the native API documentation in the MSDN Library[^]. So that you can easily figure out the message IDs and other constants, I also recommend you download the Platform SDK[^] so that you have the headers you need. If you've installed VS.NET with VC++ then, by default, you've already got these headers (though they may not be as up-to-date as what's online; but for stuff that's been around a while it won't change any time soon).
So, if you want to pass a message to signal a keystroke, your first place to look is at WM_KEYDOWN[^]. There you'll find the documentation for what your wParam and lParam should be.
In this case, however, you're doing the unnecessary. The .NET BCL defines the <cdoe>SendKeys class for this very purpose, though if you want to post a keystroke to another application's message queue that isn't in the foreground you'll need to P/Invoke PostMessage (if the application you want to post a keystroke to has the focus, you can still use SendKeys ).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi!
Pls tell me (if u can ) how can I drag-and-drop a panel control on the same clipboard, if i dont know the control's ID?
|
|
|
|
|
What does the control's ID have to do with anything? Drag-n-drop in .NET is simple. Just read the documentation for the Control.DragDrop[^] event for information and a complete example.
Dragging the Panel is the slightly more difficult part, since it doesn't define an event to fire when dragging begins (nor would it makes sense to in most circumstances). Instead, you'll need to handle MouseDown , MouseMove , and MouseUp as we've discussed before in this forum:
bool down;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
down = true;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (down)
{
DataObject data = new DataObject(sender.GetType().FullName, sender);
DoDragDrop(data, DragDropEffects.Move);
down = false;
}
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
down = false;
} Of course, you'll need to add these handlers to the Panel corresponsing events.
The code for the DragOver and DragDrop events you can find in the documentation I linked above.
Note that this will only work within the same AppDomain. You can't simply drag instances from one AppDomain to another. For that you need to serialize the panel and pack it in a DataObject as a string, or study OLE Drag and Drop (from which .NET drag and drop derives) and structure storage and stream information. Serializing the object to a string is the easiest alternative since .NET drag and drop doesn't expose other possible STDMEDIUM s with which to store object data (like locking it into global memory so you can use Marshal.AllocHGlobal , for example).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I need some kind of ID, because I want to make panels with image in run-time (by clicking a menu item or else) and I have to know which panel have been clicked with mouse! I would like to move the whole panel! Or if u have something else idea for moving little pics with text on the clipboard I'm waiting for it! Like buttons?!
The code u wrote me, did not work (for me)!
|
|
|
|
|
What does that have to do with drag and drop? As far as drag and drop goes, you pack the actual object so you don't need to worry about the ID because you have the object itself.
My code was an example and wasn't a full solution. You need to read the .NET Framework SDK documentation and understand what the code is doing and make it work for you. If there was syntactic errors it's because I posted it as an example and don't compile everything I post. That would take forever and you - as the developer - need to understand the code. I'm not just giving out solutions.
The concept is sound and I've used it plenty and provided the example to others in this forum over the past couple years and it's worked. That's just how drag and drop works. .NET makes it easy for you, but unfortunately in doing so it is rather limited (doesn't allow you to specify STGMEDIUM s like with OLE automation).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
The problem is: The user makes controls(by clicking a menu item) from the same tipe(class MyButton : Button) to the clipboard. I've got it! But if I
want to make MyButtons able to move by the mouse(drag-drop) I need to discriminate the MyButton controls on the clipboard to know which MyButton control was clicked or moved!
|
|
|
|