|
does that mean that i could allocate an unmanaged vmr9 surface to an managed 3d device?
|
|
|
|
|
Most likely, but as I said I'm not familiar with VMR9 and was not able to find anything about it in the unmanaged DirectX 9.0 SDK. I recommend going to the public newsgroup microsoft.public.win32.programmer.directx.managed[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a problem which I can't enable an UI control such as a text box in System.Threading.Timer times out.
TextBox1.Enabled = false;
System.Threading.TimerCallback tmrCB = new System.Threading.TimerCallback( this.Timer1 );
System.Threading.Timer m_UITimer = new System.Threading.Timer(tmrCB, 0, 500, System.Threading.Timeout.Infinite );
private void Timer1(object state)
{
TextBox1.Enabled = true;
}
After 0.5 second timeout, the TextBox1 is still disabled. Does there has anyway to enable a TextBox or any UI Control in a System Timer thread. I tested in Windows form and it works fine, but it doestn't work in Web Form. Does someone can help can give me an advice how make it work in Web Form.
Thanks a lot.
|
|
|
|
|
|
That is a good advice. I am doing web client side user interface design, so I can't use System.Windows.Forms.Timer. Does there have some limitation to control the UI in timer or different thread?
Thanks a lot!!
|
|
|
|
|
Hello,
I'm having an odd build error. When I build my project, I get two build errors. Both of them say "Post Build Event Failed". When I run the project afterward, I only get one of these errors. When I run it again, I don't get any and the application loads perfectly.
I have a group of five projects in a VS.NET solution. One project is a Winforms executable that directly references two dlls. One dll is just a class library, while the other one contains a couple of classes and two or three controls. Both dlls are (should be) installed to the GAC using gacutil /i /f. The library with the controls directly references the library that just contains classes. There is also another executable in the project that directly references both dlls.
Finally, there is another dll which is dynamically loaded by the first executable. In the current design, it resides in a folder under the path of the executable. The executable knows where to find the files. I will be adding more dlls later.
My code is all working and I'm just trying to swat a few last minute bugs before it goes to QA. I'm getting a message in the output window saying the following:
'gacutil' is not recognized as an internal or external command,
operable program or batch file.
Project error: A tool returned an error code from the build event
How do I fix this? It's getting old.
Will
|
|
|
|
|
gacutil.exe must be in your path and you must have installed the .NET Framework SDK. By default this is installed with VS.NET.
To add this to your PATH environment variable, right-click on "My Computer", select Properties, click the Advanced tab, and select environment variables. I recommend adding this to the system environment variables toward the end (after the various %WINDIR% directories).
Add the following to your PATH environment variable (separated by semi-colons):
%WINDIR%\Microsoft.NET\Framework\v1.1.4322 Use whichever .NET verison is appropriate. The above is for .NET 1.1, of course.
You must restart VS.NET for this change to take effect. You could also specify the following for your post build action instead of just "gacutil.exe":
$(WINDIR)\Microsoft.NET\Framework\v1.1.4322 The larger problem is, why are you installing your projects you're working on in the GAC? The GAC is for runtime assemblies only - not for building against (which is why both the .NET Framework BCL assemblies and third-party assemblies install both into a private version directory as well as into the GAC). If you're solution includes multiple projects, use a project reference instead of a file reference. This means that when you use the Add Reference dialog for your project, you click on the Project tab and add your project. Not only does this keep your assemblies up-to-date by establising build dependencies, but it also makes sure that if you're using automatic versioning (using an asterisk in your AssemblyVersionAttributE , which isn't recommended for most projects) your assemblies with that dependency will build against the right version since version numbers matters very much for managed assemblies (as opposed to most native libraries).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
The main reason that I'm installing these two assemblies to the GAC is that there is a dll that is loaded dynamically by my application that references them. The main application also references them, as does a secondary application. I figured the GAC would be the best place to put them so that the same assembly would load in all cases. This is also how I intend to install it on the client. Is there a better way?
Will
|
|
|
|
|
When you're developing your projects you should not use the GAC. Chances are you'll be compiling a lot and if you use automatic versioning (which I strong warn you about because it can cause so many versioning problems, especially with late-bound dependencies) - which means you have an asterisk in your AssemblyVersionAttribute - your GAC will become cluttered very quickly.
You could - for purposes of developing - add those projects to as dependencies of your application project. If these are all in the same solution, use the Project tab to establish a build dependency (especially handy when you use automatic versioning). If they are not in the same solution, add them as assemblies. In the PropertyGrid make sure they are copied locally. Note that unless you use a Type defined in one of those assemblies, the compiler will not link them as dependent assemblies (so they will not be referenced in your assemblies' manifests). This will, however, copy them locally. An application will attempt to use assemblies in the application directory or a probing path (like ASP.NET's bin sub-directory), or another location configured in its .config file. The GAC is one of the last places the CLR will look to locate assemblies.
Read How the Runtime Locates Assemblies[^] for more information.
And on a somewhat-related note, to read one reason why (implied) automatic versioning is bad, read about how you can improve your clients' upgrade experience by deploying publisher policies that allow older code (which references older Types) to use new Types (with a newer version). Read Redirect Assembly Versions[^] and Creating a Publisher Policy[^] in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm actually wanting it to probe for the assemblies in a folder below the application's root. The user actually picks which one(s) they want to load. The assembly is then loaded into another AppDomain. All interaction with that assembly occurs through a class in a library that both assemblies reference. The common dll is loaded into the AppDomain just before I load whatever dynamic assembly I'm using. In a development situation, could I get away with copying the common dll into the path so that it will be found when the other dll is loaded dynamically (since the dynamically loaded dll references it)?
Then, we I deploy the application, I could still throw my common dll into the GAC, right?
On the plus side, I'm not using automatic versioning, as the there is only a single instance of each assembly that I'm putting into the GAC in my Assembly folder (unless I'm not understanding correctly).
|
|
|
|
|
In the documentation I linked, you can specify a sub-directory using the <probing> element in your application's .config file:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins"/>
</assemblyBinding>
</runtime>
</configuration> Your .config file is named the same as your application with .config appended and located in the same application directory. For example, myapp.exe.config.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I use an XML file layout the steps to be completed by the program. Here is the general idea of the XML file:
<?xml version="1.0"?>
<DOC Name="TEST">
<STEP NAME="My Step 1" ID="1" TYPE="Type1">
<BLOCK NAME="TestBlock_1_1" NUMBER="68"></BLOCK>
<BLOCK NAME="TestBlock_1_2" NUMBER="35"></BLOCK>
</STEP>
<STEP NAME="My step 2" ID="2" TYPE="Type2">
<BLOCK NAME="TestBlock_2_1" NUMBER="42"></BLOCK>
<BLOCK NAME="TestBlock_2_2" NUMBER="26"></BLOCK>
</STEP>
</DOC>
I am reading the file fine, and can parse through and work with the STEP Elements. What I cannot get working is accessing the BLOCK elements within only a particular STEP
if(reader.Name=="STEP") //
{
reader.MoveToAttribute("NAME");
if(reader.Value == "My Step 1")
{
// How do I move to the Elements within this step??
// I need to know the BLOCK values
}
}
Thanks in advance for the help.
|
|
|
|
|
See the documentation for the XmlReader.ReadStartElement , which is implemented by derivatives of XmlReader .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks,
That works for reading the next element, but I need to be able to read all the elements in that STEP. i.e. there could be multiple BLOCK tags and each would need to be read through in perhaps a foreach loop. The documentation on MSDN made it sound like that was only to read the next element? Perhaps I am confused.
Would appreciate any more help you can give.
The code in plain english should be:
foreach BLOCK element in STEP(Mystep)
//do code.
THanks so much
*****************
"I know how hard it is for you to put food on your family." —GW
|
|
|
|
|
Yes, it does only read the next element. You must call it again to move to the next element.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I was having a problem using a listbox that had been populated by using its datasource property to bind with my data. The problem arose if the data was also being updated in the same project from another view. The error that would occur is "cannot modify the items collection when the datasource property is set". Part of the answer to this problem was to avoid using the datasource property of the listbox and to populate the listbox instead by using the listbox item.add method. That kinda worked, which is of course infuriating since it would be nicer if it entirely worked! For some reason, the add.item method caused the listbox to display the following in the listbox window: "System.Data.DataRow". This then filled the entire window. My research informed me that you get this result if the listbox doesn't know the values of DisplayMember and ValueMember. But since I had supplied those with the pertinent info, I assumed something else was the problem. Here is a re-cap of everything I did, and what eventually solved the problem. (I end it all by asking why this fixed my issue? I like to know why things work on occasion)
ListBox control:
Here is what will work when using this control
option (1):
You can use MyListBox.DataSource=MyDataTable;
This will appear the easy way to go. The listBox will load up and appear fine. But if you have anyplace in your application that is making changes to the underlying data of MyDataTable, you will get the error:
"cannot modify the items collection when the datasource property is set"
So it seems that using MyListBox.DataSource=MyDataTable; has its problems.
option (2):
You can use a loop to load the ListBox collection like this:
for (int i=0; i < MyDataTable.Rows.Count; i++)
{
MyListBox.Items.Add(MyDataTable.Rows[i]);
}
This should eliminate the error in the earlier situation because the listBox collection is not Bound to an external source for data, so the external data source is free to have changes made to it.
But, unfortunately, and I don't know why... providing the data to the listbox this way causes the ListBox window to display a default series of "System.Data.DataRow" because the listbox is not able to recognize the DisplayMember and DisplayValues that you have provided. Oddly enough, it is still possible for you to select off of the listbox's window items, and recover the selected data value from a DataRow:
private void MyListBox_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataRow oRow = (DataRow)MyListBox.SelectedItem;
MyTextBox.Text = oRow["MyFieldFromoRow"].ToString();
}
But this curiosity does not help us very much since what is displaying in the ListBox window is worthless.
If you want to use the listbox to display data from a table AND also have the datatable capable of being "changable" in the meantime. You must create a Class that wraps the DataTable data. This Class MUST use PROPERTIES to access the data. Then you must Create an ARRAY from the DataTable by passing each field value thru the class's properties while building the ARRAY in a load loop. Now, you can use the ListBox.Item.add in a for each loop using the resulting ARRAY we created above.
public void LoadListBox()
{
MyClass[] MyClassTab = FetchAllRowData(); // FetchAllRowData creates array using MyClass which MUST use properies to assin data values!
MyListBox.Items.Clear();
MyListBox.ValueMember = "MyValue_id";
MyListBox.DisplayMember = "MyTextValue";
foreach (MyClass E in MyClassTab)
{
MyListBox.Items.Add(E);
}
}
Whew. I am guessing that passing the DataTable data into an ARRAY that uses properties, and then using the resulting ARRAY for my ListBox must make the metadata available for the individual fields to be used by the DisplayMember and ValueMember ListBox properties. Is that why?
Does anybody out there know why I needed to do all this? Is this the way to go on this?
|
|
|
|
|
Hi,
I found an article that shows a simple way to open the default email client with some parameters set.
http://www.codeproject.com/dotnet/Default_mail_client.asp[^]
Only thing is: the attachment does not work.
(MsgBuilder.Append("&Attach=c:\mailattach.txt"))
Is there any way to open the default email with an attachment?
Thanks.
avivhal
|
|
|
|
|
As covered on this forum many times before (which is why the "Search comments" link above exists), not all MAPI clients support every syntax. It wasn't even that long ago that most MAPI clients like Outlook, Outlook Express, Netscape, and others supported the "Body" parameter. This also means that a client must have a MAPI client registered.
Rather than relying on what's installed - which gives you little to no control as you've found - send the mail yourself using SMTP. There are many articles here on Code Project as well as on this forum. You can also get third-party libraries like IP!Works[^].
Using the System.Web.Mail namespace is also a bad idea because it requires a CDO library for the system. Only Win2K and above have this client library. NT4 uses something else, IIRC, and Windows 98/Me have nothing.
True SMTP support is being added to the .NET Framework for "Whidbey" (.NET 2.0) to replace this hazardous namespace.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hai all,
Somebody help me in this issue. I need to have a menu bar which is
RightToLeft aligned, which I can achieve by setting MainMenu's RightToLeft
property to "Yes". The problem that I get is, if one of MenuItems has
submenu...the arrow(or small triangle which indiates it has submenu) appears
in the left. I wanted to know when is this getting drawn. I want to trap
that and draw my own image to indicate that it has submenu. Below is the
code that I have written for DrawItem and MeasureItem for each MenuItem. Any
help is greatly appreciated.....
Thanks,
Madhavi.
private void menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
Rectangle rc = new Rectangle(e.Bounds.X+1 , e.Bounds.Y+1, e.Bounds.Width,
e.Bounds.Height-1);
e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51,102,153)), rc);
MenuItem s = (MenuItem)sender ;
RedrawSubMenuItems(s);
string s1 = s.Text +" |" ;
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Near ;
e.Graphics.DrawString(s1 , new Font("Ariel" ,9, FontStyle.Bold), new
SolidBrush(Color.FromArgb(255,255,128)) , rc , sf );
Console.WriteLine(e.State.ToString());
if ( e.State == (DrawItemState.NoAccelerator | DrawItemState.Selected) ||
e.State == ( DrawItemState.NoAccelerator | DrawItemState.HotLight) )
{
//e.Graphics.FillRectangle(new SolidBrush(Color.LightYellow) , rc);
e.Graphics.DrawString( s.Text , new Font("Ariel" , 9 , FontStyle.Bold |
FontStyle.Underline ) , new SolidBrush(Color.FromArgb(255,255,128)), rc
,sf);
//e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.Black)), rc );
}
|
|
|
|
|
Well I am knee deep into my first foray into socket programming. So i have a windows server based application that will listen for client requests and based on client requests does X Y Z. Well, I implemented a threadpool on the processing side, but I have found a major whole in my code. The socket seems to be only letting in once connection at a time. Yep, I did not implement thread pool on that end. So, does anyone have a sample code that I can use as a guideline to implement this or suggest somehting.
There was an article on code project that I cannot remember for the life of me. It dealt with getting a connection status of people connected to a server.
|
|
|
|
|
A quick search[^] on this site for "socket thread" yields many articles.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have a binary which I wish to save to my local disk. I want to use a filestream to save this binary to my hard disk. In the case that it is already there, I want to delete it and then save it.
I used this code:
// Local is some file location
FileInfo fi = new FileInfo(local);
if(fi.Exists)
fi.Delete();
FileStream fstr = fi.Create();
fstr.Write(openedBinary, 0, openedBinary.Length);
fstr.Flush();
fstr.Close();
However, in the next line, I have another function that makes use of this binary which is now locally stored. SOMETIMES, that works, usually it doesn't. I don't quite know why! Can someone tell me why this would act unpredictably?
Cheers,
Jim
|
|
|
|
|
Okay, here's just one more thing i discovered. When I put a breakpoint on my open command, open the file externally (i.e. in Windows Explorer) close it, and THEN execute the open command it works. Its not a matter of waiting for a period of time, no matter how long I wait the open command won't work if I don't go and actually open the file.
Cheers,
Jim
|
|
|
|
|
Are you using a FileDialog control someplace in your application? The first thing you might want to try is simply using the full path for your file (local). That will probably solve your problem...
-DougW48
dwright@tdci.com
|
|
|
|
|
There's two things you must keep in mind - the application directory and the current working directory. When you start an application, the current working directory may not necessarily be the same as the application directory. Double clicking the EXE would yield this result, but a shortcut to your application may define a different working directory. A working directory can also be changed at runtime (i.e., while your application is running).
If you want that file to always be relative to your application, use the Application.StartupPath like so:
string filename = Path.Combine(Application.StartupPath, "file.dat"); Without specifying a full path starting from the drive path, the current working directory is used to resolve the file path.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|