|
Thanks Heath Stewart
under your answer,I found an article from here
http://www.codeproject.com/cs/media/extimageindexconv.asp
the red line must been added;
[Category("Appearance"), <br />
Description("..."), DefaultValue(-1)]<br />
[<font color="#FF0000">TypeConverter(typeof(ImageIndexConverter)), </font><br />
Editor("System.Windows.Forms.Design.ImageIndexEditor", typeof(UITypeEditor))]<br />
public int ImageIndex<br />
{<br />
get <br />
{<br />
return _ImageIndex;<br />
}<br />
set<br />
{<br />
if (_ImageIndex = value)<br />
{<br />
_ImageIndex=value;<br />
}<br />
}<br />
}
I think if I changed the ImageIndexConverter to a Converter class which I designed , In desingn time , will it show my Converter in property grid?
|
|
|
|
|
That's the idea, yes. Just make sure you reference the Type (either using typeof or a string representation, which is handy when you want to have a separate design-time assembly like Microsoft does for most members) in the ConverterAttribute .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
I would like to ask a question as below,
My software is composed of a main C# program with some other c# dll as components. In the first round, I will install all the stuff on the machine.
Then after sometime, I need to install some additional dll to work with
the main C# program. How can I do that ? Is that possible in C#.Net framework ?
The scenario is similiar to install Microsoft Office Suite, at the first time, I only install MS WORD with the MS Office main framework, but later I install also MS Excel (just like i install another DLL in my application)
onto the MS Office Main program on the PC.
Thanks
|
|
|
|
|
Yes it is possible but the initial design of your application will need to be carefully thought out. I'm actually working on a project that is very similar in nature to yours and we are using this method to develop more functionality to users over time and to patch specific parts of the system without actually going off-line.
The application we are writting is a trading application for different asset groups. We have a framework which compiles into an executable and all that framework does is authenticate the user again a database and see what permission the user has. GUI-wise the framework is just an MDI Parent window with a form that takes care of the login/authentication. When the user clicks on a menu only items that the user has permission to use appear as menu items. This is done with the combination of checking what DLL's are available on the remote server where all the DLL's reside on what the user has permission to access. So if a trader is an Equities trader he/she does not have access to Foreign Exchange screens/data so those images will not even appear inside the menu(s) of the framework.
All images that can run inside the framework are separate projects within the solution and produce DLL's into a common output directory (be careful because VS .NET is not too happy when you do this). When a bug is fixed and it's time to put the changes into the production system all we have to do is just move the newly updated DLL into a directory where the framework is expecting it and tell all the traders who need to use this updated image to close their existing image and open a new instance of it. I belive this is a very good way to design an application that will be used by many people since maintanance is very easy but on the down side it will take some time to "get it right" at first.
|
|
|
|
|
Yes,
" This is done with the combination of checking what DLL's are available on the remote server "
But I would like to know how to check what dll's are available on the remote server?
|
|
|
|
|
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
|
|
|
|
|