|
Good people,
I have designed an application that uses WPF and targets the .NET 3.5 library. Can I assume that, if the person downloads .NET 3.5 (full or client profile), my application can run on Windows XP, Vista and Windows 7?
Also, sometimes during startup, while my application is showing the splash screen, if the user clicks around or attempts to do something else - like return to another application while mine is loading, my application will fail to load and throw an error of some sort. Any ideas on what's happening or what I should do?
Thanks in advance for any insight or information you can provide.
|
|
|
|
|
BlitzPackage wrote: Can I assume that, if the person downloads .NET 3.5 (full or client profile), my application can run on Windows XP, Vista and Windows 7?
Is it likely? Yes, assuming you haven't used any OS version specific functions, P/Invokes, etc. Though check up on the client profile/full version of the framework thing.
Is it certain? No. Test, test, and test again on all three, and still be prepared for the odd one that doesn't work.
BlitzPackage wrote: Also, sometimes during startup, while my application is showing the splash screen, if the user clicks around or attempts to do something else - like return to another application while mine is loading, my application will fail to load and throw an error of some sort. Any ideas on what's happening or what I should do?
Use the debugger. The name of the exception thrown may help. If you this doesn't help, post the exception details here, and a small, relevent amount of code from that location in your project, and we can all take a look.
|
|
|
|
|
I am developing a device that uses FTDI USB driver. The FTDI USB chip creates a virtual COM port every time a new device is plugged in to the computer. e.g. COM16. Even when the device is removed, this port COM16 is still marked "In Use" in Windows Device Manager.
When my device is in production, certain computer may connects to 100s of them. I don't want to see COM200(in use). That will be a big problem for the application.
So how can I programmably (C#) make a virtual COM Port available to my device? e.g. COM10 (in use), release this COM10, so my next device can use it. I know how to force Windows Device Manager to release it manually, but I need to do this programmably by my application in C#.
Any advice will be appreciated!
|
|
|
|
|
not exactly what you asked, but maybe a workaround:
on the manufacturer's websit www.ftdichip.com you will find the menu Documents/Application Notes, an on that page the "Advanced Driver Options"
AN_107
Chapter 7 describes the posibility to set registry entries to ingnore the hardware serial number. So you will get only one device installed, even if you frequently plug others of the same VID (Vendor ID) and PID (Product ID)
|
|
|
|
|
Consider a WIFI network and we are given a random local ip eg 172.20.0.228 and i want to find out WIFI access point through which this user is connected without using anything on user side , (using a C# program).
I think two possible solutions can be -
1) Trace a path to given ip 172.20.0.228 so that the node before the given ip in the will be access point.
2) Query all acess points and get a list of users connected to them. Then we can search any given ip (eg 172.20.0.228 in this case) in those lists.
My Problem is i dont know how to implement any of these two possible solutions in c# (Windows Application) prefrebly but if its not possible in C# post something in vc++ too.
I think 2nd solution of getting list of users will be more appropriate. So suggest me something to implement this thing in c#.
How can we get list of users from an access point ?
Thanks
|
|
|
|
|
Hi All
i have a class that inherits from the Label class.this class have to returns a DialogResult like a Button Control.but i can't create this property correctly.the following code is my class:
public class GA5_Button : System.Windows.Forms.Label
{
[Browsable(true),
DefaultValue(typeof(System.Windows.Forms.DialogResult))]
public DialogResult MyDialogResult
{
get;
set;
}
}
i want to click on this Control then set the Form.DialogResult on MyDialogResult value.how can i do this?sorry for bad english
Thanks in advance
modified on Tuesday, February 9, 2010 10:02 AM
|
|
|
|
|
What is the problem - it seems to work for me:
public partial class LabelClick : Label
{
public LabelClick()
{
InitializeComponent();
}
[Browsable(true),
DefaultValue(typeof(System.Windows.Forms.DialogResult))]
public DialogResult DialogResult
{ get; set; }
private void LabelClick_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
}
}
And in the form:
private void labelClick1_Click(object sender, EventArgs e)
{
DialogResult = labelClick1.DialogResult;
}
Closes my form and returns DialogResult to Form.ShowDialog
What is it doing (or not doing) for you?If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
I just had a thought: I have never had any success using the DefaultValue Attribute with enum properties - the only way I have found of reliably defaulting them is to use:
private DialogResult dialogResult = DialogResult.OK;
[Browsable(true)]
public DialogResult DialogResult
{ get { return dialogResult; } set { dialogResult = value; } }
If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks for your reply
my problem:
i don't want to set the Form.DialogResult by code,exactly like a button.
when we set a Button.DialogResult to OK or Cancel in Properties Window, Form.DialogResult adapted with it without coding.
i don't know that whether you understand my meaning or not????Sorry for bad English
|
|
|
|
|
I know what you mean:
When you add a button to a form, you can set the Dialog Result in the Properties window to "OK" or "Cancel", (or "Abort", "Retry" etc.). Whe you press the button on the form, the form closes, and the Dialog result is returned to the form creator via the Form.ShowDialog method.
Unfortunately, this is specific to button, and does not work in that way for labels. They don't even have a DialogResult property! You can simulate it in code, by subscribing to the Label Click event, and setting the form DialogResult to DialogResult.OK, and that will work - but this is unusual behaviour for a Windows App, and may confuse your users. A button is more normal.
To simulate the button:
1) Create a event handler for the Label.Click event either in the properties window, or programatically in your Load event with
label1.Click += new EventHandler(label1_Click)
2) In your handler set the forms DialogResult to DialogResult.OK or DialogResult.Cancel
It will have the effect you want.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
I want to record sound from mp3 player ,media player,ie
|
|
|
|
|
|
is it possible to sycn two sql database data with Microsoft Sync Framework. if so can anyone give sample code.
thanks.tbhattacharjee
|
|
|
|
|
Hi !
I'm working shell context menu on 64 pc.
I rebuild app under x64 pc.
I want add menu item to windows context menu.Registery is OK and windows explorer find my dll.
But InsertMenuItem WinAPI function not working!
MENUITEMINFO mii = new MENUITEMINFO();
mii.cbSize =(uint)Marshal.SizeOf(typeof(MENUITEMINFO));
mii.fMask = (uint)MIIM.TYPE | (uint)MIIM.STATE |(uint)MIIM.SUBMENU;
mii.fType =(uint) MF.STRING;
mii.wID = idCmdFirst + num;
mii.dwTypeData = "My menu text";
mii.fState =(uint)MF.ENABLED;
mii.cch = (uint)mii.dwTypeData.Length;
InsertMenuItem(hmenu, iMenu+1, true, ref mii);
My defenition :
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(uint hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii);
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public int wID;
public int hSubMenu;
public int hbmpChecked;
public int hbmpUnchecked;
public int dwItemData;
public String dwTypeData;
public uint cch;
public int hbmpItem;
}
Please help me. (I know writing shell menu under .net is not good,but i very want see it).
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
In Win64 all pointers take 64 bits, hence uint hMenu is wrong in public static extern bool InsertMenuItem(uint hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii); .
One should always use IntPtr when passing a handle or pointer; and yes, www.pinvoke.net has some errors in that regard.
Another potential problem may be the string in your structure; not sure that gets marshaled automatically.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi Luc.
Thanks for your reply.
I change my code like that :
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(IntPtr hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii);
[DllImport("user32.dll")]
public static extern int SetMenuItemBitmaps(IntPtr hmenu, uint uposition, uint uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
InsertMenuItem not yet working , but SetMenuItemBitmaps working well.
Please help me .
Thanks .We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
1. You have used the flag MIIM.SUBMENU (fMask) but you hasn't set the hSubMenu value.
2. You also should adjust your struct to use IntPtr instead of int.
Like this:
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public int wID;
public IntPtr hSubMenu;
public IntPtr hbmpChecked;
public IntPtr hbmpUnchecked;
public IntPtr dwItemData;
public String dwTypeData;
public uint cch;
public IntPtr hbmpItem;
}
There may be also the problem with the (LPTSTR)String dwTypeData. If it doesn't work you could try StringBuilder instead.Greetings
Covean
|
|
|
|
|
Thanks Covean.
You are right .Problem is fixed.
Now i have shell menu working both 32 bit and 64 bit Windows version!
Thank you very much! We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
You're welcome! Greetings
Covean
|
|
|
|
|
Thanks, I had exactly the same problem !
Here my new code, if it can help someone esle
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public uint wID;
public IntPtr hSubMenu;
public IntPtr hbmpChecked;
public IntPtr hbmpUnchecked;
public IntPtr dwItemData;
public string dwTypeData;
public uint cch;
public IntPtr hbmpItem;
}
public class DllImports
{
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(IntPtr hMenu, uint uPosition, uint uFlags, [In] ref MENUITEMINFO mii);
[DllImport("user32")]
public static extern UInt32 SetMenuItemBitmaps(IntPtr hMenu, uint uPosition, uint uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
}
private void AddMenuItem(IntPtr hMenu, uint id, uint position, string text, Bitmap icon, IntPtr? hSubMenu)
{
MENUITEMINFO mii = new MENUITEMINFO();
mii.cbSize = (uint)Marshal.SizeOf(typeof(MENUITEMINFO));
mii.fMask = (uint)MIIM.ID | (uint)MIIM.STRING | (uint)MIIM.SUBMENU;
mii.wID = id;
mii.dwTypeData = text;
if (hSubMenu.HasValue)
{
mii.hSubMenu = hSubMenu.Value;
}
DllImports.InsertMenuItem(hMenu, position, (uint)MF.BYPOSITION, ref mii);
if (icon != null)
{
DllImports.SetMenuItemBitmaps(hMenu, id, (uint)MF.BYCOMMAND, icon.GetHbitmap(), icon.GetHbitmap());
}
}
The biggest problem was this line :
mii.cbSize = (uint)Marshal.SizeOf(typeof(MENUITEMINFO));
As in all exemples you found on web, the size is set to 48 by default and not calculate.
Thanks again.
Decco
|
|
|
|
|
Dear Frnds,
I have got reg nos and marks. Now im supposed to allot rank.
What i tried : LIST<T>, SORTEDLIST, HASHTABLE, AND ARRAYLIST.
from the above, sortedlist works but it sorts the key ie. reg nos and not the marks.
help required.
|
|
|
|
|
Hi,
did you try .Sort() after writing and before reading the collection?
Pls send code if it doesn't help
bye
|
|
|
|
|
monstale wrote: did you try .Sort() after writing and before reading the collection?
.Sort will sort on key not on value, he need to change design of it application or do manually sorting! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
sachees123 wrote: from the above, sortedlist works but it sorts the key ie. reg nos and not the marks.
it is because your key is registration no not marks. Also you can't have marks as key as there chance you are getting same marks twice or thrice or so on! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|