|
"as i'm new to this, can someone plz advice me?"
Not really relevevant to the specific question, but:
1.) You have a "Shift" key - Don't be afraid of it (Seeing as the only capitals are C#, VB, C++, KB, MSN)
2.) Encrypt your given e-mail address. People can Phish it. Change to something like 5narmon5@gmail.com - And ask people to remove the 5's. (If they DESPERATELY want to e-mail you, they can use your Profile )
Hey - It's a start
-= Reelix =-
|
|
|
|
|
Is there something in WPF which would be an equivalent of CustomLineCap in GDI+? How do I implement a custom line ending in WPF? Thanks!
|
|
|
|
|
Not much WPF traffic here, but what there is, is mostly in the WPF forum.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I have a windows form application. How do you detect if a form is shown within your process. I have no control of other forms that are shown in my application cause some of them are inside a dll.
MyMainForm (exe)
|--> ModuleDLL (dll)
|--> Forms (I have no way to know when they will be shown)
Thanks,
BJ
|
|
|
|
|
If you have the source code to the DLL, you could post an event to your main form from the child forms' "Shown" event. However, I can't for the life of me come up with a valid reason that the parent form would want to know when a child form was shown.
However, without knowing the nature of the app *and* the DLL, it would be impossible to comment with any authority.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks for the reply. I have no source code for the DLL. I wanted to know if a form is being shown because I wanted to replace or modify the controls on the form that is being shown (i.e. set a background, change colors of a button).
|
|
|
|
|
The forms are created inside the dll ? Then how can you add stuff to them ? If you have a reference to the form, to interact with it, then you can subscribe to it's events and check it's properties
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes I have a reference to the form using Application.OpenForms. But I just thought that there would be an event that I can attach to if a form is currently being shown. Hmm, I think I should see if there's such an event in the Application.OpenForms collection.
|
|
|
|
|
OK, then, there is a Visible property on the form, if you want to know if it's currently visible. An event fires when it becomes visible, not when you grab a reference and want to know if it was shown before you got it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I think Application.OpenForms is your friend.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks, I'm actually using that. You gave me an idea, I'm gonna check if there's such an event in the OpenForms collection to see if a form is being shown.
|
|
|
|
|
Hi,
I'm encountering problem while trying to load unverifiable assembly (mixed managed and unmanaged code written in c++.net) using Assembly.Load(byte[] buffer). An "Unverifiable code failed policy check" exception is awlays thrown. The same error did not appear when I tried loading using Assembly.LoadFile. Unfortunately, I can only use Assembly.Load because I'm only given the assembly image in an array of bytes and I'm not allowed to write to any other storage devices due to security reason. Did I miss out anything? or Does anyone know any alternatives to load assembly other than Assembly.Load?
Regards,
chew
|
|
|
|
|
Very odd. On this Windows Server 2003 R2 box that my client has, the call to "ShowDialog" in the OpenFileDialog and SaveFileDialog classes are crashing. No useful information is provided other than "External Exception".
Anyone encounter this?
Marc
|
|
|
|
|
You could try going through VS Debugger (if it is available on that machine). Otherwise I would check for Explorer plugins that are interfering with those two dialogs. Is this problem with all open/save dialogs in the OS? Do you have proper privileges to show those dialogs?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thomas Stockwell wrote: You could try going through VS Debugger (if it is available on that machine).
Yup. Tried that. Crashes in "external code", as in the Win32 API.
Thomas Stockwell wrote: Otherwise I would check for Explorer plugins that are interfering with those two dialogs.
Well, this machine has a bunch of SharePoint stuff loaded on it. Does that count?
Thomas Stockwell wrote: Is this problem with all open/save dialogs in the OS?
Given that it happens sporadically, not sure. Also, given that the only way to access this computer is with remote desktop (terminal services), that adds another twist to the problem.
Thomas Stockwell wrote: Do you have proper privileges to show those dialogs?
Yes.
Marc
|
|
|
|
|
Do you have enough permission to show them?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I've never seen this before, but I think you might want to try reducing the complexity from your code, and start with just a plain openfiledialog. Then I would add back the custom settings I assume you're using until you find the one that's breaking the dialog box. To be extra safe, I'd probably do it in a test app instead of the program you're working on.
If it were a permissions problem, I would think you're get something more specific than "external exception". It sounds to me like R2 has something in it that .Net doesn't like. BTW, what version of .Net are we talking about, and does your client have the latest version of it installed?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: you might want to try reducing the complexity from your code, and start with just a plain openfiledialog.
I'm considering that, but in all honesty, this:
OpenFileDialog ofd = new OpenFileDialog();
ofd.RestoreDirectory = true;
ofd.CheckFileExists = true;
ofd.Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
ofd.Title = "Load Report";
DialogResult res = ofd.ShowDialog();
is quite simple already. Sure, I could remove the RestoreDirectory and CheckFileExists options.
Marc
|
|
|
|
|
Marc Clifton wrote: that. Crashes in "external code", as in the Win32 API.
If the code that you just posted is what you are using why would their be any errors regarding Win32 API? Is the bug before or after the segment you just posted but only shows symptoms during the ShowDialog method?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thomas Stockwell wrote: If the code that you just posted is what you are using why would their be any errors regarding Win32 API? Is the bug before or after the segment you just posted but only shows symptoms during the ShowDialog method?
The exception happens on the call to ShowDialog.
Marc
|
|
|
|
|
This is probably totally unrelated to your situation, but I'll
throw it out there just in case...
I just tried your code from C++/CLI on Vista...
int _tmain()
{
OpenFileDialog ^ofd = gcnew OpenFileDialog();
ofd->RestoreDirectory = true;
ofd->CheckFileExists = true;
ofd->Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
ofd->Title = "Load Report";
DialogResult res = ofd->ShowDialog();
...
...and got an exception "System.Threading.ThreadStateException...
Current thread must be set to single thread apartment (STA) mode
before OLE calls can be made. Ensure that your Main function has
STAThreadAttribute marked on it..."
A quick change to this made it work fine:
[STAThreadAttribute]
int _tmain()
{
OpenFileDialog ^ofd = gcnew OpenFileDialog();
ofd->RestoreDirectory = true;
ofd->CheckFileExists = true;
ofd->Filter = "rpt files (*.rpt)|*.rpt|All files (*.*)|*.*";
ofd->Title = "Load Report";
DialogResult res = ofd->ShowDialog();
...
Good luck
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Ensure that your Main function has
STAThreadAttribute marked on it..."
Yup, I came across this wisdom why googling about my problem and I did verify that it's there, and just double checked.
Thanks for taking the time for investigating this though! Much appreciated.
Marc
|
|
|
|
|
And you sure you are calling ShowDialog from the main thread?
|
|
|
|
|
S. Senthil Kumar wrote: And you sure you are calling ShowDialog from the main thread?
Yup. I don't spawn any new threads. The call is being made in response to a menu click event.
Marc
|
|
|
|
|
Hi Guys
i m writing an activeX control for a Webform
The requirements for this control are that the user must be able to drag files from Windows explor into
a Listbox which appears on a webpage.
For the listbox i set the property Allowdrop = true.
And inserted the control into the webform.
My problem is that the IE ignores the Drag & drop.
When i Put the same listobx on a Winform it works.
May somebody help me??
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Drawing;<br />
using System.Data;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace ActiveXUploadControl<br />
{<br />
public partial class ActiveXUploadControl : UserControl<br />
{<br />
public ActiveXUploadControl()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void LBFiles_DragDrop(object sender, DragEventArgs e)<br />
{<br />
if(e.Data.GetDataPresent(DataFormats.FileDrop))<br />
{<br />
string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];<br />
int i = 0;<br />
<br />
for (i = 0; i<= files.Length - 1; i++)<br />
{<br />
LBFiles.Items.Add( files[ i] );<br />
}<br />
}<br />
}<br />
<br />
private void LBFiles_DragEnter(object sender, DragEventArgs e)<br />
{<br />
if (e.Data.GetDataPresent(DataFormats.FileDrop))<br />
e.Effect = DragDropEffects.All;<br />
}<br />
}<br />
} <br />
<br />
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ActiveXTest._Default" %><br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br />
<br />
<HTML><br />
<br />
<HEAD><br />
<br />
<script type="text/javascript"><br />
<br />
</script><br />
<br />
</HEAD><br />
<br />
<body MS_POSITIONING="GridLayout"><br />
<br />
<OBJECT id="OBJECT1" style="<br />
<br />
Z-INDEX: 0; LEFT: 125px; WIDTH: 484px;<br />
<br />
POSITION: absolute; TOP: 85px; HEIGHT: 200px" classid="ActiveXUploadControl.dll#ActiveXUploadControl.ActiveXUploadControl" ><br />
<br />
</div><br />
<br />
</form><br />
<br />
</body><br />
<br />
</HTML><br />
|
|
|
|