J
John Dinning
(Using VS2005 C# and compact Framework. Target device is running CE5).
I am creating a simple visual control (New Control Library project for smart
device Windows CE 5), derived from Label, with a couple of extra properties.
I need to call an external dll from this control, on a timer.
When I insert the declaration for the external dll function and build the
control project, strange things happen to any project that uses this
control.
One of my new properties disappears from the properties window.
The form designer displays the error:
"The type 'Microsoft.CompactFramework.Design.UnsafeControl' has no property
named 'TType'"
(TType is my new property - an enum).
The dllImport declaration looks like this:
[System.Runtime.InteropServices.DllImport("Test.dll")]
private static extern bool GetAlphaMode();
It makes no difference if the Test.dll exists or not so the problem is not
with the dll, only with the declaration.
I am not actually calling the function - just declaring it.
If I remove these two lines, all is well again, and all properties are
visible in the designer.
With or without these two lines, the project compiles with no errors.
My first question is:
Is it ok to call a Dll from a visual component library?
If not does anyone have any idea what is going on here?
More info:
If I remove all my new properties, so the control only inherts the standard
label, the control compiles, but the default text on the label is not
'MyNewLabel1' but 'MyNewLabelLib.MyNewLabel', i.e. the library name and
class name of the component. Weird.
Any help extremely welcome.
John.
I am creating a simple visual control (New Control Library project for smart
device Windows CE 5), derived from Label, with a couple of extra properties.
I need to call an external dll from this control, on a timer.
When I insert the declaration for the external dll function and build the
control project, strange things happen to any project that uses this
control.
One of my new properties disappears from the properties window.
The form designer displays the error:
"The type 'Microsoft.CompactFramework.Design.UnsafeControl' has no property
named 'TType'"
(TType is my new property - an enum).
The dllImport declaration looks like this:
[System.Runtime.InteropServices.DllImport("Test.dll")]
private static extern bool GetAlphaMode();
It makes no difference if the Test.dll exists or not so the problem is not
with the dll, only with the declaration.
I am not actually calling the function - just declaring it.
If I remove these two lines, all is well again, and all properties are
visible in the designer.
With or without these two lines, the project compiles with no errors.
My first question is:
Is it ok to call a Dll from a visual component library?
If not does anyone have any idea what is going on here?
More info:
If I remove all my new properties, so the control only inherts the standard
label, the control compiles, but the default text on the label is not
'MyNewLabel1' but 'MyNewLabelLib.MyNewLabel', i.e. the library name and
class name of the component. Weird.
Any help extremely welcome.
John.