|
I'm following some of the tutorials at MSDN to embed Windows Media Player into my program. It's a simple problem. However, I can't seseem to get the controls to work. Even though I'm following the examples directly in the MSDN.
I declare the player and make it invisible and deactivate autostart:
private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
axWindowsMediaPlayer1.Visible=false;
axWindowsMediaPlayer1.settings.autoStart = false;
So that runs find. Then I open a dialog box, read a file and store it in the player:
axWindowsMediaPlayer1.URL = openFileDialog1.FileName;
So far so good. But when I try to run the controls it states that .controls is not part of the AxWMPLib.AxWindowsMediaPlayer. However, according to the documentation it clearly states at Microsoft that to stop I could...
axWindowsMediaPlayer1.controls.stop();
But the above code will not compile. I get the sneaking suspicion that somehow I'm messing up obkjects. Between all the player objects and media objects and everything else do I have the wrong object type?
I'm using WMP9 SDK. If anyone has a clue, or can give me a simple answer, I would be gretaly obliged.
|
|
|
|
|
I had the same problem, i looked and looked and found that it was changed to Player.Ctlcontrols
so try axWindowsMediaPlayer1.Ctlcontrols to find play, stop, ect..
modified 16-May-21 21:01pm.
|
|
|
|
|
I'll give that a try. Thanks...
Is it just me or does the MSDN archive suck?
|
|
|
|
|
There is another problem using Playlist.item[ index ] you will get an error, its also been cahnged to Playlist.get_Item[ index ]. All these problems have been documented in the WMP 10 SDK now which im playing with now.
modified 16-May-21 21:01pm.
|
|
|
|
|
Okay cool... Now, I have the wmp sdk 9. Haven't updated to ten yet. Should I just assume the commands in 10 are mostly right for 9. Because even the 9 commands don't seem to work. for example, in 9 it states I can use:
player.cdromCollection.item(index).eject()
but that doesn't work. I have problems with item. So instead I tried:
player.cdromCollection.getByDriveSpecifier(drive).eject(); That works fine.
|
|
|
|
|
Strange i just tried that and it worked ?
Player.cdromCollection.Item(0).eject();
I dont know if you cut and paste you code on the fourm but the "item" has to be "Item",uppercase I. Strange even in the WMP 9 SDK it has a lowercase 'i'.
Are you using Visual Studio .Net it should have that autocomplete feature so you can get the true objects (except that get_item, it doesnt show it?)
if not try borlands C# builder its free and just like VS. NET
modified 16-May-21 21:01pm.
|
|
|
|
|
Hi All,
I've written a Windows Service (c#) which contains config params in a app.config.
I now need to extend it to offer a means to change the app.config via a winform.
The Question
Is it possible to add a winform to the service so that if the user executes the service executable by file selection, then it be launched as a normal winform app rather than the service?
I started writing a seperate app, but obviously the two apps don't share the target config file. Anybody know a clever way around that one?
Thanks in advance...
Andy
|
|
|
|
|
What you can do is combine the source code of the two applications. You can modify the Main function so that it will launch a windows form when the user specifies a special command line parameter, otherwise it will start the windows service.
I haven't tried this myself, but it sounds pretty straight forward.
My articles and software tools
|
|
|
|
|
HHOOK h;<br />
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)<br />
{<br />
<br />
switch(nCode)<br />
{<br />
case WM_SIZING:<br />
return 0;<br />
break;<br />
<br />
case WM_MOVING:<br />
return 0;<br />
break;<br />
<br />
default:<br />
return CallNextHookEx(h,nCode,wParam,lParam);<br />
}<br />
}<br />
void InstallHook()<br />
{<br />
h=SetWindowsHookEx(WH_CALLWNDPROC,CallWndProc,0,0);<br />
}
this code if made in mfc dll but i have 2 problems :
1- i dont know if the created DLL is created correctly or not
2- i used this DLL in another app and called InstallHook but a big msg appears said that there is no entry piont for the installhook in the dll
if anyone knows anything plz reply me
|
|
|
|
|
Perhaps if you post this on the Visual C++ forum[^] someone might be able to help.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
Hello,
I have created a control, extending UserControl, called ColorMixer. Then, I created a small app, call it Host, to host that contol. I right-clicked Host, chose Add Reference, went to the projects tab, and selected my ColorMixer project. Automatically, ColorMixer appeared in the toolbox in the My User Controls tab.
Now, I wrote another control, ColorMixerWithArgs, and another host app, and did the same thing. However, ColorMixerWithArgs does not appear in my toolbox.
Does anyone know why? I would rather the control automatically appear like ColorMixer did than go to the My User Contolrs tab and add the dll manually.
Thanx,
-Flack
|
|
|
|
|
Unfortunately, you're pretty much at the mercy of Visual Studio .NET when it comes to this behavior. Sometimes it works; other times, it doesn't.
One thing to keep in mind, however, is that I doubt you'll be needing the control in the toolbox so often within a solution. If this is a control you use often, then finalize the code and "install" it on your machine as a third-party control is. Put a copy in the Global Assembly Cache (drag and drop it into %WINDIR%\assembly or use gacutil.exe -i <filename>) for run-time use, so you don't have to worry about re-locating the file for each project that uses it.
If you need to include this in a project in order to design it and it doesn't show up in the toolbox, just do what the designer does (which isn't really magic - it's just code that you can type as well). Add a declaration along with the rest toward the top of your class definition. Go into the InitializeComponent method (hidden in a region) and instantiate it like all the others and add it to the container control's Controls collection property. When you switch back to design view, you can begin designing it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
This is in regards to the AMS profile C# dll:
http://www.codeproject.com/csharp/ReadWriteXmlIni.asp
Is there any way to specify the path of the xml file to write the settings to? Below is the code I am trying to use, but I get the following error:
An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll
Additional information: System error.
It occurs when I try to set a value using:
sPath = System.AppDomain.CurrentDomain.BaseDirectory + "/test.xml";
sPath = sPath.Replace("/","");
if ( System.IO.File.Exists(sPath) == false ) {
// create the xml file
System.IO.File.Create(sPath);
}
AMS.Profile.Xml oXml = new AMS.Profile.Xml(sPath);
oXml.SetValue("test","testone","cool!");
Thanks in advance!!
_invid
|
|
|
|
|
|
Heath is right, you should have posted this in the article's message board, but since we're here...
The most likely reason you're having the problem is because you're calling System.IO.File.Create(sPath), which creates the file and then locks it. This causes the XmlDocument.Load to fail.
The solution is simple: You don't need to worry about the file's existence. If it's not found, AMS.Profile will create it for you automatically. So just get rid of the "if" code and you'll be fine.
Regards,
Alvaro
Give a man a fish, he owes you one fish. Teach a man to fish, you give up your monopoly on fisheries.
|
|
|
|
|
Cool! Thanks!! Sorry bout posting here :/
|
|
|
|
|
how can play macromedia flash file in asp.net pages randomly?
can use adrotator for this work?
Regards' Amir jalaly
|
|
|
|
|
The AdRotator has a specific, well-documented XML file schema that wouldn't work with Flash files. The concept is similar, though, just that instead of outputting IMG tags you'd need to output OBJECT tags with the right attributes (like the CLSID of the Macromedia Flash player, the codebase, and the src as a PARAM ).
This wouldn't be too difficult to implement, but if you're interested, download .NET Reflector[^] and see how the AdRotator works, duplicating the code for the most part, except of course for Flash-specific settings in the XML file (or whatever you want to use - I would recommend using the provider pattern) and the output HTML.
You should ask this on the ASP.NET forum, though. Besides being the proper forum for this question (since it is regarding ASP.NET, not a specific language), someone might've already done this. You could also try searching the CodeProject articles as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
i want to transfer files and data throw modem .we have 2 pc and 1 tel line and want to send and recieve by this line so how can do it?
Regards' amir jalaly
|
|
|
|
|
It really doesn't matter what the connection device is. So long as you're connected, you can use a myriad of classes to transfer files. You could create a simple TCP socket connection using the TcpClient class, for example. If an accessible share exists on one or the other machine (or both), then you can simply use File.Copy to copy files, although this typically won't work because of default security (and anonymous write permissions are too risky).
You could also go all-out and create a .NET Remoting client/server between the two, transfering files as byte[] arrays, or better yet use DIME (part of the WSE 2.0, which you can download from MSDN[^]. DIME gets around serialization, which is a big performance boost.
So, just forget that a modem is connecting to the two clients and use whatever class(es) you'd like. So long as TCP/IP is the protocol connecting the clients, your options are many; otherwise, you'll need to create a Socket connection with the correct AddressFamily .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I have a datagrid, which represents a datatable fetched out of my DB. If I click on the column in the toprow in my grid the grid gets sorted. Perfect: So far so good.
Now it seems that (after sorting) the datatable and the datagrid do not correspond anymore .
Can anyone tell me how I can manage to sort my datatable together with my datagrid? (or equally good just to get the correct row (primary key or something??)) I don't want a roundtrip to my database.
TNX A LOT!!
I forgot: it's about winforms no webforms
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
Tried a DataView?
Create a DataView from the DataTable, set the Sort property on the DataView, set the DataGrid's DataSourse to the DataView.
Hope this helps
Bill
|
|
|
|
|
Hi:
I am using WilsonDotNet (www.wilsondotnet.com) ORMapper to map my Business Objects to C# classes. My Business class, because of its object inheritance hiearchy contains more properties than I want to display in my DataGrids. The plain vanilla way of binding a IList object to a DataGrid is to set the DataGrid.DataSource property to the object. But since this displays all kinds of info that I want to hide I was exploring using the DataGridTableStyle object and DataGridColumnStyle object. Because of my neophyte status this exploration contains the distinct possibility of my banging my head against the .Net wall for a good period of time, so to avoid this mental anguish I was wondering if anyone had done this and whether it was possible.
Any hints would be deeply apreciated.
Mike
|
|
|
|
|
You can use table styles and column styles for objects besides the DataTable . The column style's MappingName is the name of the property, plain and simple. The information you need to read is the documentation for the DataGridTableStyle.MappingName property in the .NET Framework SDK. This is where it gets down to details about mapping to objects.
For a table, it's obviously the table name (whether you set a DataTable to the DataGrid.DataSource property, or set that property to a DataSet and specify the table name in the DataGrid.DataMember , which is actually a better way of doing it for many different reasons). For an array, use the type name plus the array indexer operator (ex: MyClass[] ). For another implementation of the IList interface besides those, just specify the type (ex: ArrayList ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath:
Thank you for your help. I found the help associated with the DataGridTableStyle.MappingName and created a small form based on the NorthWind Category to Product relationship. When I bind the DataGrid using:
this.productsGrid.DataSource = this.category.Products;
I can see all the data.
When I use this code duplicated from the Machine[] example in the help file the grid shows nothing
DataGridTableStyle productsTable = new DataGridTableStyle();
productsTable.MappingName= "Products";
DataGridTextBoxColumn nameColumn = new DataGridTextBoxColumn();
nameColumn.MappingName= "Name";
nameColumn.HeaderText = "Name";
productsTable.GridColumnStyles.Add(nameColumn);
productsGrid.TableStyles.Clear();
productsGrid.TableStyles.Add(productsTable);
My definition for product looks like:
public class Category : Wilson.ORMapper.IObjectHelper
{
private int id;
private string name;
private string description;
private IList products;
public int Id {
get { return this.id; }
}
public string Name {
get { return this.name; }
set { this.name = value; }
}
public string Description {
get { return this.description; }
set { this.description = value; }
}
public IList Products {
get { return this.products; }
}
}
|
|
|
|
|