|
I'm assuming it's the .NET Framework V2.0 beta - am I right?
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
|
Hello All
My question is this that how to embed a flash movies on a form? I'm using Macromedia Flash Obejet (A COM(+) control. I 'm the path of Movie in Movie property but it's not showing can any body helo me what to doo how to set properties plzzzzz. I'll be very thankful.
Cheers Bye
Rizwan Ahmed
|
|
|
|
|
Have you tried using acimp utility in the frameworks BIN folder on the activeX component, it should produce .net assemblies for you to use with your app.
|
|
|
|
|
There's samples on this website. I'm pretty sure. Do a search.
/\ |_ E X E GG
|
|
|
|
|
If you've dragged the control from your toolbox (after customizing and adding it to your toolbox) to the form, or if you've used aximp.exe (not acimp.exe like the other poster said), then you reference both the AxInterop.*.dll and Interop.*.dll (or whatever you called them if you used aximp.exe and specified the /out switch). These are the ActiveX control (derived from System.Windows.Forms.AxHost ) and the RCW (Runtime Callable Wrapper, a wrapper around the COM server generated from the typelib) respectively.
After you've done that, read the documentation for the ActiveX control on Macromedia's web site (or just take a stab and guess). The classes, interfaces, enumerations, methods, properties, etc. are all the same as they would be from a COM client like Visual Basic or some scripting language, because the RCW is marshaling calls to the COM (automation) objects themselves that scripting clients use.
There have also been articles on this site written about similar topics (perhaps even embeddeding the Flash player). I suggest using the search bar underneath the CodeProject logo at the top of the page to search for existing articles.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi All,
I need help. I want to extract the ISO file to the local harddrive. Is there an sample code or some sample written in VC++ 6.0 or C#, which I can take a look. Please help.
Thank You
Regards,
ntuyen01
|
|
|
|
|
Get IsoBuster: www.isobuster.com[^] (go to site and click on download on left.) The free (non-Pro) version does everything I've needed.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
can anyone give me instructions to build a basic web broser,what's necessery and needed to archive this?
...NLD...
|
|
|
|
|
|
Dear CPians,
I am trying to convert a Bitmap object to a byte array so I can save it into an Image fiels in SQL Server 2000.
Any examples?
Thank you!
theJazzyBrain
Excellence is not an act, but a habit! Aristotle
|
|
|
|
|
private byte[] BmpToBytes(Bitmap bmp)
{
using(MemoryStream ms = new MemoryStream())
{
bmp.Save(ms, ImageFormat.Bmp);
return ms.ToArray();
}
}
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Thank you for your reply!
This seems to be axactly what I need!;P;P
theJazzyBrain
Excellence is not an act, but a habit! Aristotle
|
|
|
|
|
I need your help on following code segment.
DataSet ds=new DataSet();
da.Fill (ds, "Price");
DataTable newdt=new DataTable();
for (int i= 0; i<=ds.Tables["Price"].Rows.Count-1; i++)
newdt.Columns.Add(i.ToString());
for (int i=0; i<=ds.Tables["Price"].Columns.Count-1; i++)
for (int y = 0; y<=ds.Tables["Price"].Rows.Count-1; y++)
dr[i]=ds.Tables["Price"].Rows[y].ItemArray[i].ToString();
newdt.Rows.Add(dr[i]);
What I am trying to accomplish is to loop through one data set and do a flip-flop of data on the fly, ie. rows on the first dataset table become columns of the finished one's. Then bind the result to UI control.
The data in the table looks like this:
DisctType/QtyBreak/UnitPrice
A........./0 to 100/$10.00
A........./101 to 300/$9.00
B........./5000 & up/$2.25
The UI has to make data look as follow:
DisctType/A........./A.........../B
QtyBreak/0 to 100/101 to 300/5000 & up
UnitPrice/$10.00../$9.00....../$2.25
I think I am down to last two lines but just could not pull it off.
|
|
|
|
|
I created a windows service in c# and then installed it using both the InstallUtil and Setup project options in VS.NET but the service is NOT available from the Services Management Console.
I even went ahead and created a bare-bones windows service, installers included, compiled it and installed it but it is a NO SHOW as well.
I am in the administrators group of the machine I am using to develop.
Does anybody has an idea what else do I have to do to get to the Services Console?
>
Guillermo Jimenez
|
|
|
|
|
What Installer classes are you using, specifically? You must use both ServiceInstaller and ServiceProcessInstaller , and both instances must be added to your Installer derivative's Installers collection property. Additionally, your Installer derivative must be attributed with the RunInstallerAttribute .
When running InstallUtil.exe, display verbose output with the /v command-line switch and make sure your type (your Installer derivative class) is found.
If you right-click in the Windows Service designer, you can click "Add Installer" or something like that. Examine the code there to make sure you're coding your installer correctly.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
All that is in place.
The /v option doesn't give me any hint of error anywhere, everything is found, compiled and committed.
By the way this is a Windows 2000 (v5.) machine.
|
|
|
|
|
You might consider posting your Installer derivative source. There's most likely something wrong with the source code.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
InstallUtil does complain about missing public installers but this is automatically generated code!
InstallUtil log file
"No public installers with the RunInstallerAttribute.Yes attribute could be found in the c:\...\visual studio projects\windowsservice1 \bin\debug\windowsservice1.exe assembly.
Remove InstallState file because there are no installers."
But...
The code generated by C# automatically puts [RunInstaller(true)] not [RunInstallerAttribute], is this a bug? I am using .Net 2003.
This is the code generated by C#
[RunInstaller(true)]
public class ProjectInstaller : System.Configuration.Install.Installer
{
public System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
public System.ServiceProcess.ServiceInstaller serviceInstaller1;
private System.ComponentModel.Container components = null;
public ProjectInstaller()
{
// This call is required by the Designer.
InitializeComponent();
}
...
private InitializeComponent()
{
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.DisplayName = "A Windows Service";
this.serviceInstaller1.ServiceName = "Service1";
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[]
{ this.serviceProcessInstaller1, this.serviceInstaller1
}
);
Guillermo Jimenez
|
|
|
|
|
In C#, "Attribute" is not required for classes that end in "Attribute" and that derive form Attribute . This is documented.
I do see a problem even with the auto-generated code - namely the properties that you filled-in, or rather didn't fill in. If you read the documentation for the ServiceInstaller.ServiceName property, it is crucial that your ServiceBase.ServiceName (ServiceBase is what you extended, of course) and your ServiceInstaller.ServiceName match exactly. I'm hoping you didn't call your Windows Server "Service1" (the name that you pass to net start or net stop). You need to disambiguate and give it something meaningful (like w3svc for the HTTP service in Windows NT, or iisadmin for the IIS Administration Service).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Generic method for accessing fields in C# classes/structs
==========================================================
Previously in the unmanaged C++ world, a client could declare a structure of any length, cast it to a VOID pointer to memory, and then just deal with it as a memory location. This is sort of a rough and tumble version of polymorphism.
Consider the following example in unmanaged C++:
Client code:
===========
typedef struct dimStruct
{
double x;
double y;
int location;
};
SumFunc()
{
int aFields[] = { X_DIM, Y_DIM, LOCATION };
int iNumberItems = 3;
dimStruct dims;
services->FillTheStruct( (PVOID)&dims, aFields, iNumberItems );
}
Services Code
=============
Services::FillTheStruct( PVOID pData, int aFields[], int iNumberItems )
{
//** Now loop through the field array and stuff values into the
//** correct offsets in memory.
int itemOffset = 0;
for ( int I =0; I < iNumberItems; i++ )
{
int sizeOfItem = GoGetDataItem( &pData[itemOffset], aFields[i] );
//** increment the offset within the pData memory block
itemOffset += sizeOfItem;
}
}
I was able to replicate the functionality in C# (close. but not quite) through the following:
Client Code
===========
object[] aObjects = new object[3];
aObjects[1] = dimStruct.x; //** double
aObjects[2] = dimStruct.y; //** double
aObjects[3] = dimStruct.location; //** int
services->FillTheStruct( aObjects, aFields );
dimStruct.x = aObjects[1]; //** double
dimStruct.y = aObjects[2] //** double
dimStruct.location = aObjects[3] //** int
ServicesCode
============
FillTheStruct( object[] aObjects, int[] aFields )
{
//** Get the array of types
Type aType[] aTypes = type.GetTypeArray( aObjects );
int iSize = 0;
//** Figure out the size (to simplfy examples, ignore strings)
foreach ( Type oneType in aType )
{
iSize += marshal.SizeOf( oneType );
}
byte[] aBytes = new byte[ iSize ];
//** Magically stuff data into byte array
Services->FillTheStruct( aBytes, aFields );
//** Now, fill the client’s aObject
MemoryStream stream = new MemoryStream( aBytes );
BinaryReader reader = new BinaryReader( stream );
int iFieldCount = aObjects.GetLength( 0 );
for ( int index =0; index < iFieldCount; index++ )
{
Type oneType = aTypes[ index ];
If ( oneType.Equals( typeof( double )))
{
aObjects[ index ] = reader.ReadDouble();
}
else if ( oneType.Equals( typeof( int )))
{
aObjects[ index ] = (int)reader.ReadInt32()
}
//** And so on….
}
}
So the questions are:
====================
Is it possible to replicate the original solution in C# without using an object[] array as an intermediary?
Is there a generic way to walk through an unknown class/struct, get the fields, their types, and then make assignments into that structure/class?
I would have to have a method that accepts some sort of generic object to start.
Thanks in advance,
JohnB
|
|
|
|
|
I think you could use the GetType method to get the type of the object, which can be used to extract the properties it has and such, using the Type objects methods.
you could set the variables data using Marshal.StructureToPtr to put the structure into an IntPtr, which where you will be able to write bytes to specific using the Marshal classes methods.
|
|
|
|
|
You can still do that using C# in .NET, but I don't recommend it. You can use an unsafe code block. When you use unsafe code, though, it is not managed and you lose the benefit of a managed environment (plus it requires more permissions granted to your object; a problem if you're not running from the local machine (by default)).
Serialization - which you're currently doing yourself - is the best way to handle this. Not only is it extensible, but it's fairly straight forward to use and safe. Define your struct as [Serializable] (not inheritted) and change FillStruct like so:
[Serializable]
public struct Dim
{
public long field1;
public int field2;
public string field3;
}
public void FillStruct(out Dim dim)
{
using (MemoryStream ms = new MemoryStream())
{
ms.Write(BitConverter.GetBytes(0L), 0, 8);
ms.Write(BitConverter.GetBytes(0), 0, 4);
byte[] buf = Encoding.ANSI.GetBytes("Test");
ms.Write(buf, 0, buf.Length);
ms.Seek(0, SeekOrigin.Begin);
BinaryFormatter formatter = new BinaryFormatter();
dim = (Dim)formatter.Deserialize(ms);
}
} Serialization is very powerful and quite easy to use in the .NET Framework. I encourage you to read Serializing Objects[^] in the .NET Framework SDK, which discusses both runtime serialization (what I described above), and XML serialization.
You could also use the Marshal class, which can help you do this, too, but relies on unsafe code as well (but it's defined in mscorlib.dll, which must have FullTrust permissions - it's the core assembly of the .NET BCL and practically impossible to do without when targetting the CLR).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
johnbMA wrote:
Is there a generic way to walk through an unknown class/struct, get the fields, their types, and then make assignments into that structure/class?
Sure, something like the following (obviously you will want to do further error checking but this should get you started):
Assembly a = Assembly.LoadFile(@"C:\somedir\dir\some.dll");
if(a != null)
{
Type[] types = a.GetTypes();
foreach(Type t in types)
{
PropertyInfo[] pia = t.GetProperties();
MethodInfo[] mia = t.GetMethods();
FieldInfo[] fia = t.GetFields();
ConstructorInfo[] cia = t.GetConstructors();
EventInfo[] eia = t.GetEvents();
Type[] ia = t.GetInterfaces();
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello,
Is there a max length of text that can be shown in the statusbar?
I can only get it to hold 127 characters in the statusbar or in a statusbar panel.
Blake
|
|
|
|