|
No, the groups aren't native COM components, they are COM compenents defined and implemented in c# and then regitered as COM.
The Problem:
unmanaged code :
1- Create an instance from OPCSerevr --> Is OK & can call all methods when
casted to any interface
2- Create an instance from OPCGroup --> Is OK & can call all methods when
casted to any interface
3- Call AddGroup method of OPCServer casted to IOPCServer that returns an
OPCGroup and casting it to any interface is OK, but when i call the
methods raises a memory error.
Thanks
Umed Ebdullahi
|
|
|
|
|
Without seeing all the source code, all I can do is make educates "stabs in the dark", but hopefully we can resolve this. Usually the questions are a little more simple.
Are these interfaces declared in unmanaged code (i.e., in an IDL file and registered in HKCR\Interfaces )? If so, don't forget to attribute the re-declaration in managed code with ComImport . This ensures that the CLR performs a QueryInterface for the requested interface instead of just a cast.
If these interfaces are declared in managed code, IIRC they will not be registered in HKCR\Interfaces by regasm.exe. The easiest way to find out is to run regasm.exe /regfile:temp.reg Assembly.dll (replacing "Assembly.dll" with your assembly, of course). You could also generate a typelib and use oleview.exe Assembly.tlb for an IDL-like output, if you like.
If not registered, you can add a couple static parameterless methods and attribute them with the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute . Keep in mind that these methods are called by regasm.exe in addition to registering your types normally. No need to do the same thing twice.
Also be sure that if you don't install your assembly into the GAC, you use the /codebase option with regasm.exe to register the fully-qualified path to your assembly so that mscoree.dll knows where to find it. Since you can create instances of your COM servers, this doesn't sound like a problem.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Yes these interfaces are declared in unmanged code, and I used ComImport with all interfaces and have installed my assembly into GAC.
I have emailed a copy of application source to your email, and any help will be appreciated greatly.
Special Regards.
|
|
|
|
|
Hello,
i am facing a problem,the main window of the program has picture boxes and tab control.
A certain menu item opens the main form's child form.
However picture boxes of the parent form remains on the top of the child form.I tried using for the child form the "bringtofront" method ,but still it wont work.The child form would be totally visible if it came in an area of the parent form with no controls.Otherwise part of the child form would be covered by the controls of the parent form.
I really need the help
Thanks a million
|
|
|
|
|
hi,
How you want to show the second from which is choosen by the user. If you don't mind. Is it possible to explaine a little bit more and clear.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I am currently trying out some things with Ben Houston's Exocortex.DSP Fourier functions to use with sound curves and I have a question: The FFT-function asks for a length, but I don't know what I should use as the length..... I tries the length of the float-array I use, but it keeps telling me that 'Index was outside the bounds of the array'..... can someone tell me what kind of variable I should use for it? Any help will be hugely appreciated.
greetings.
|
|
|
|
|
whare am i going wrong.
string strDefaultPrinter = @"\\hfd-sales07\zebra tlp2742";
prtSettings.PrinterName = strDefaultPrinter;
pgSettings.Landscape = true;
printDoc.DefaultPageSettings = pgSettings;
printDoc.PrinterSettings = prtSettings;
Rectangle rect = new Rectangle(0,50,165,310);
e.Graphics.DrawRectangle(pen,rect);
e.Graphics.DrawString("From:",mFont,Brushes.Black,rect);
|
|
|
|
|
I want to create a XSLT file in C#.NET manually.I mean that according to the user choice ,XSLT file will be created in background.But I know that there is not any class like XmlDocument,XmlTextWriter,XmlTextTeader for XSLT Document.How can I create this document?Should I use to File I/O class and how?I am waiting for your help...Thanks a lot...
|
|
|
|
|
hi,
Check this. It may help you out
XSLT in C#
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hello,
I am trying to change Black color in the given bitmap to White,
and vise versa, keeping rest of the colors as it is.
The idea is some what explained in the code below.
Off course the code is not correct, it just explains what i want to do.
Please guide me.
private void Form1_Load(object sender, System.EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter="Image files (*.BMP, *.JPG, *.GIF)|*.bmp;*.jpg;*.gif";
if(dlg.ShowDialog()==DialogResult.OK)
{
Image img = Image.FromFile(dlg.FileName);
Bitmap bm = new Bitmap(img, img.Size);
for(int y=0;y
|
|
|
|
|
hi
I found one article which deals these all things. this may serve your purpose.
Click Me
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Solved it !!!
pasting the same for the community
-----------------------------------------------------
Bitmap _bitmap = new Bitmap(_originalmage, _originalmage.Size);
BitmapData data = _bitmap.LockBits(
new Rectangle(0, 0, _bitmap.Width, _bitmap.Height), ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb);
if (data != null)
{
unsafe
{
//
// Refering all eliments
//
byte * p = (byte *)data.Scan0.ToPointer();
for (int y = 0; y < data.Height; y++)
{
for (int c = 0; c < data.Stride; c += 3)
{
// GET RGB
byte b = p[c];
byte g = p[c+1];
byte r = p[c+2];
// ToDo :: Reverse
if (b == 0 && g == 0 && r == 0)
{
// SetPixcel to WHITE
p[c] = 255;
p[c+1] = 255;
p[c+2] = 255;
}
else if (b == 255 && g == 255 && r == 255)
{
// SetPixcel to BLACK
p[c] = 0;
p[c+1] = 0;
p[c+2] = 0;
}
}
p += data.Stride;
}
}
}
_bitmap.UnlockBits(data);
-------------------------------------------------
regards
|
|
|
|
|
Hello again, "ich sag einfach Hello again"...
I have some question about a problem which seems to elude me. I did some research on plug-in frameworks (still working on my service here) and it seems to be a very useful feature to have a "pluggable" service.
Since the CodeGenerator SAP calls the ".NET Connector" will generate only code which becomes invalid after a single change to the corresponding structure in SAP, we should be able to simply replace that function with the proper one (hence, plug-in).
This would also enable us to have a service which could be extended with "Function Modules" as requirements change.
Well, I wrote an interface, implemented it in my Plugin and referenced it from both "host application" and "plugin library".
Now, I have a little trouble passing information along.
I have found one article here on CodeProject, but that referred to C++. Maybe I am just too stupid.
How can I pass my important data (as an object) between host-app and plug-in ?
Cheers
Sebastian
|
|
|
|
|
Hi All,
In my C++.NET application, the 'ndStud' object is displayed in a Property Browser. 'ndStud' object has nested properties. While changing the 'StudSize' property from the property grid, the application hangs.
If i remove the NotifyParentProperty attribute from the sub properties of StudSize (Feet & Inches), the application works, but still cant modify it's values from the property grid.
What should i do in order to make it editable from the property grid (it works at run-time)?
Plz see the code bellow:
[Serializable]
TypeConverter(__typeof(System::ComponentModel::ExpandableObjectConverter))]
__gc public class ndLength
{
private:
int feet;
int inches;
public:
ndLength()
{
feet = 0;
inches = 0;
}
ndLength(int feet,int inches)
{
this->feet = feet;
this->inches = inches;
}
[NotifyParentProperty(true), RefreshProperties(RefreshProperties::Repaint)]
__property int get_Feet()
{
return feet;
}
__property void set_Feet(int value)
{
feet = value;
}
[NotifyParentProperty(true), RefreshProperties (RefreshProperties::Repaint)]
__property int get_Inches()
{
return inches;
}
__property void set_Inches(int value)
{
inches = value;
}
};
[Serializable]
[TypeConverter(__typeof(System::ComponentModel::ExpandableObjectConverter))]
__gc public class ndStud
{
:
:
:
:
:
:
:
[DesignerSerializationVisibility (DesignerSerializationVisibility::Content)]
__property ndLength* get_StudSize()
{
}
__property void set_StudSize(ndLength* value)
{
}
};
}
thanks,
Pradeep
|
|
|
|
|
hi,
Better choose managed C++ forum
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
How can I disable write in comboBox?
thanx
|
|
|
|
|
Set the DropDownStyle property of the ComboBox to ComboBoxStyle.DropDownList.
|
|
|
|
|
Make it a Set the ComboBoxStyle property to DropDownList... that stops the text part from being an edit box!
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
It works
Thaky you
|
|
|
|
|
I have two programs. One that will allow the specification of a long list of properties and the other that will use the data in these properties without changing them.
That is I want read/write access in the specification program and readonly access in the program that uses the data, but I want to use the same namespace/class for both. Further, I want to take one of the classes in the namespace and have an instantiation on the side that uses the data with both read and write access.
I have tried putting preprocessor instructions around the set accesors, but this clearly comes to grief when I try to have read and write access for an instantiation of one of the classes on the side that uses the data. (I can't use define or undefine).
I describe my problem in more detail below:
namespace Data
{
public class ADataSet
{
private int n;
....................
public int N
{
get {return n;}
set {n = value;}
}
....................
}
public class BDataSet
{
private int m;
....................
public int M
{
get {return m;}
set {m = value;}
}
....................
}
}
In the above, the first program requires read and write access to all properties. The second program requires readonly access, but also needs to create an additional object of type BDataSet with both read and write access.
There are hundreds of properties in each of ADataSet and BDataSet. How can I get round this problem without having two identical classes, one with readwrite and the other readonly access?
I have not yet got to grips with interfaces, but I don't think these will make any difference.
Roger
|
|
|
|
|
carradus wrote:
I have not yet got to grips with interfaces, but I don't think these will make any difference.
Interfaces is exactly what you need! Eg
public interface IFoo
{
string Bar {get;}
}
class Foo : IFoo
{
public string Bar {get{...};set{...};}
}
Now you can access class Foo from the assembly internally, and only expose the IFoo interface to external users. Very powerful indeed, and I personally overuse it
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
Thanks Leppie
This worked, but I find it a bit disconcerting that I need two almost identical copies of a class to do what I want(three including the interface). One with readonly and the other with read/write (with the interface containing the declarations). With hundreds of properties I could achieve the same thing with two classes and no interface. However I appreciate the power of the method since the compiler will flag anything in the implementation that is not in the interface and vice-versa.
Roger
|
|
|
|
|
carradus wrote:
One with readonly and the other with read/write
Thats the beuty of the interface, you dont have to redo the whole class, u just one. just pass the class as the interface when the user requests it. did you remember to make the readwrite class internal?
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
User name is?
User in group?
|
|
|
|
|
string mystring = Environment.UserName;
As for the group: I have no clue.
Try Win32-API or find out if it is in here:
class Sample // MSDN-Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("GetEnvironmentVariables: ");
IDictionary environmentVariables = Environment.GetEnvironmentVariables();
foreach (DictionaryEntry de in environmentVariables)
{
Console.WriteLine(" {0} = {1}", de.Key, de.Value);
}
}
} // MSDN-Sample
|
|
|
|