|
|
|
Hi!
I've developed some c# app which uses some external libraries such as magic (docking manager) and crystal reports. The app works fine, so I wanted to create setup program for it. I've added msi setup project to my solution and pointed external merge modules such as crystal licensing etc. When I try to build my setup, there is an error thrown during msi file creation:
ERROR: Could not find file 'G:\DOCUME~1\hgs\USTAWI~1\Temp\VSDB.tmp\reportengine.A95D0BB4_0582_442D_B456_D295EAEB7628\Program Files\Common Files\Crystal Decisions\2.0\bin\crxf_html_res_en.dll' 'Interface is not registered.'
The file crxf* is included in msm files, so why the compiler needs it at external location?
When I decided to remove crystal libraries (for testing purposes), similar error was thrown on Magic.dll which is pointed directly in project references. When I've excluded all of dependent libraries, the error thrown was:
ERROR: Could not find file 'E:\praca\23.09\17.30\WindowsApplication21\obj\Release\WindowsApplication21.exe' ''Interface is not registered.'
WindowsApplication21.exe is my project output file.
What is going wrong?
Did I miss something?
thanks
h.
|
|
|
|
|
is it possible to tell if a socket is already bound ..or in listening state ?
Thanks for your time.
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Hi!
Naive question 101: what is the easier method (not necesarily the most performant) to blit a System.Drawing.Image into a DirectDraw.Surface?
Thanks in advance,
--
Ralf
|
|
|
|
|
Wouldn't something like this work?
(assuming surface is 'mySurface' and Image is 'myImage')
System.IntPtr pDC = mySurface.GetDC();
Graphics g = Graphics.FromHdc( pDC );
g.DrawImage( myImage, ..... );
g.ReleaseHdc( pDC );
The key is to remember to release the Device Context, or else you'll leak resources.
Let me know if this works (not in front of Studio at the moment)
Jeremy Kimball
|
|
|
|
|
Thanks, I'm going to try this approach too.
In the meantime, I found out that a DirectDraw.Surface can be created directly out of a Bitmap:
SurfaceDescription desc = new SurfaceDescription();
desc.SurfaceCaps.OffScreenPlain = true;
desc.Width = width;
desc.Height = height;
Surface surf = new Surface(bitmap, desc, localDevice);
It's then easy to use Surface.Draw to blit the surface into another.
Your method would let me reuse the same surface always though, so it seems better.
Regards
--
Ralf
|
|
|
|
|
hi,
i want my richtextbox scroll down to show the bottom text after i appended a new text in it automatically.
i did sth similar in VC++ ListBox with SetTopIndex().
would anyone give me some idea how to do it in C# 's RichTextBox control?
thanks,
jim
|
|
|
|
|
i had the same problem before to jim..but i was able to overcome it with something like...
<br />
<br />
public void AppendText(string Message)<br />
{<br />
if(this.TextArea.Text!=null)<br />
this.TextArea.Text +=Message+System.Environment.NewLine;<br />
else<br />
this.TextArea.Text = Message+System.Environment.NewLine;<br />
this.TextArea.Select();<br />
this.TextArea.Select(TextArea.Text.Length-1,TextArea.Text.Length);<br />
this.TextArea.ScrollToCaret();<br />
}<br />
that should fix it.....as always..im sure there might be a better way..but it seemed to work for me.
The Code Project Is Your Friend...
|
|
|
|
|
Set the caret position to the end of the text, and use the ScrollToCaret() method to scroll to the caret position. Be sure to have HideSelection set to false, or it won't work. (I don't know how many times people have asked about why ScrollToCaret doesn't work, when they have HideSelection on! )
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
|
I am a newbie at design, and I've been studying design patterns but I can't figure what to do in this case.
I have a security object that has properties for a list of fields that also happen to be the properties of another object.
class security {
//"true" value for each property means yes, user has permission to access these fields in client
bool ssNumber;
bool hourlyRate;
bool dateOfBirth;
//getters and setters, functions to pull data from database, etc.
}
class empInfo {
string ssNumber;
decimal hourlyRate;
DateTime dateOfBirth;
//getters and setters, functions to pull data from database, etc.
}
I need empInfo to be aware as to which of its properties are considered permissible for access by a particular user.
What would be the best way to tell if a particular property in empInfo is allowed access by the user?
Should empInfo be extended to include security class and then when empInfo is instantiated and populated, grab security data then?
Since each field represents a datacolumn on the web, I would like to keep as much data manipulation in the middle tier as possible.
Thanks in advance!
|
|
|
|
|
What do you think of this (pseudocode)?:
class empInfo {
string ssNumber;
decimal hourlyRate;
DateTime dateOfBirth;
securitySetter(empInfo) {
securityCollection = security.getSecurity(empInfo);
foreach (property prop in empInfo)
{
foreach {securityItem sItem in securityCollection)
{
if (sItem.access(prop))
{
set.prop = "Not accessible";
}
}
}
return empInfo
}
}
----
I'm concerned about handling the database calls, since building the securityCollection requires a trip to the database, then building the empInfo object requires a trip to the database. Or maybe this cannot be avoided. Cacheing security information for objects would also be memory intensive?
Oh, and important...how can I do this so that ALL empInfo objects in a collection are taken care of for a particular session at one time, without having to re-set for each instantiation?
Any advice is appreciated.
|
|
|
|
|
How do you do that? In C, I would have done something like:
FileAttributes &= ~ReadOnly;
How do I do that in C#?
|
|
|
|
|
|
I want to retain all its previous attributes. Will calling SetAttributes() append this new flag or will it clear all the old ones and set this one?
|
|
|
|
|
This will preserve the old attributes
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.ReadOnly);
|
|
|
|
|
|
I have a window form that contains a textbox. I've hooked into the Validating event of the text box to check that the text is valid and prevent the textbox from lossing focus until valid text is typed. The problem is that if the user clicks a button on the toolbar it completely avoids this validation and this allows the user to get away with invalid input. Is there anyway to prevent this from happening?
|
|
|
|
|
yeah, when user click the button it will generate the required event. so you need to do error checking(validation) in the click event method of the button too.
|
|
|
|
|
So I have to repeat the validation of ALL the controls on my forms when somebody clicks on the toolbar? I'm starting to think the toolbar might not be worth the effort!
|
|
|
|
|
That shouldn't happen! The Validating event is supposed to fire *before* the control loses focus.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
But it does. I just tried it again on a simple application (in case it was something I was doing). I created a form with a textbox, a button and a toolbar with one button. I hooked the textbox validating and the toolbar button like this:
<br />
private void textBox1_Validating(object sender, System.ComponentModel.CancelEventArgs e)<br />
{<br />
MessageBox.Show("VALIDATING TEXTBOX");<br />
}<br />
<br />
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)<br />
{<br />
MessageBox.Show("CLICK");<br />
}<br />
Now when you run the app and click in the textbox and then tab away (to the regular button) or click the regular button, the VALIDATING messagebox will popup. But if you click the toolbar button, you only see the CLICK messagebox!
|
|
|
|
|
I think the problem is caused because the Toolbar doesn't take the focus away from any controls in the application. An act required for the validation event to fire.
You can fake validation by setting the focus to another control then restoring it. If you just drop a Panel onto your form then you won't even have to deal with something that is visible.
Something like this at the beginning of your ButtonClick event of your ToolBar should work:
Control control = ActiveControl;
if( control != null )
{
panel1.Focus();
if( control != ActiveControl )
{
control.Focus();
}
} HTH,
James
"then when you go to bed...wait, you dont do that do you....ok....when you plug into the 'hive mind' to charge yourself, ill hack into your head"
Nnamdi Onyeyiri over MSN
|
|
|
|
|
Thanks. I was thinking I'd probably have to do something like that, but I was hoping there might be a more elegant solution.
|
|
|
|