|
harold aptroot wrote: What do you need it for anyway?
When someone downloads my program to test it out, the last thing I want them to have to do is send me an email saying - it doesn't work
I would think many would just uninstall it and I've lost a sale.
If I know my program doesn't work then I need to tell my users how to bypass/fix the problem or fix it myself. I don't want to tell my prospective client that MS doesn't know what it is doing in regards to the UAC and please turn it off. What are they going to think about me
Glen Harvy
|
|
|
|
|
Ok well fortunately a program can request admin privileges - but I think it has to be restarted for that. It'll throw an UAC prompt of course but everyone always clicks OK anyway.
|
|
|
|
|
With Vista you sometimes have to right click on the application and select run as administrator. This will run the program as the administrator without have to always to UAC off.
Hope that helps.
|
|
|
|
|
tech603 wrote: right click on the application and select run as administrator
I never knew that - thanks - it is another option I can suggest until I get this issue resolved.
Glen Harvy
|
|
|
|
|
I have been telling my users to switch the UAC of and of course this solves their immediate problem. However, that doesn't solve the issue - why can't my program read the data directory
After another couple of hours research it seems InstallAware isn't changing the permissions as I thought it was. This now seems to make everything fall into place for me.
I have found this http://stackoverflow.com/questions/243995/setting-folder-permissions-on-vista[^] and as I already have InstallAware (which is running with sufficient privileges) run an update program then I will include the method and make sure the said directory is granted read/write access.
Glen Harvy
|
|
|
|
|
|
If it's just during the program run rather than the application install, you need to add an Application Manifest File and edit it to request the permissions in there. The user will be greeted with the UAC prompt each time, but that's life with Vista
The recommendation is to make the program not require elevation, but as you know, that's not always possible/practical.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks for your comments.
I have made some progress:
DaveyM69 wrote: you need to add an Application Manifest File
Actually, VS2008 adds it for you automatically and it defaults to 'asInvoker'. That's why my application runs OK when launched by the installer (by default the installer has elevated privileges) but not when the user (without elevated privileges) launches my application.
DaveyM69 wrote: The recommendation is to make the program not require elevation, but as you know, that's not always possible/practical.
My application pops up it's own messagebox saying it can't access it's database. I included this ages ago well before Vista. I have determined that with Vista, it is because the UAC prevents access to the Common Application Data folder. The name of that folder is to me incongruous and lead me away from the fact that it cannot be read or accessed unless you have sufficient privileges. It's 'common' to all users accessing my application but not 'common' to all user privileges.
Having discovered that fact, I later discovered that my Installer (InstallAware) fails to set privileges even if I do tell it to. Apparently you need to write additional scripts to get InstallAware to do it in Vista but InstallAware's help file and support generally lacks any specific information on how to do this.
Earlier in this thread, you will read how I have discovered some code which I have now included in a program that runs at install time and therefor inherits InstallAware's elevated privileges. This code apparently sets the permissions successfully.
Unfortunately I don't even own a copy of Vista so I can't personally test this. I am waiting for a tech savvy person I know who owns Vista to test it for me. If it works, I will post a small article because frankly, I don't see what all the fuss is about in regards to the UAC and Vista.
Glen Harvy
|
|
|
|
|
Here is what I'm trying:
System.Drawing.SolidBrush myPen = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
Graphics h = webBrowser1.CreateGraphics();
h.FillRectangle(myPen, new Rectangle(5, 5, 10, 10));
myPen.Dispose();
h.Dispose();
It doesn't draw anything onto it, I've tried drawing onto buttons and other things just to make sure I'm doing it right and it works in the other cases.
|
|
|
|
|
I would think you need to derive from WebBrowser and override the OnPaint method.
modified on Friday, March 20, 2009 8:33 PM
|
|
|
|
|
Just tried this and it didn't work. Sorry.
|
|
|
|
|
ya, I donno
google hasn't yielded any results either
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
wbHandle = webBrowser.Handle;
StringBuilder className = new StringBuilder(100);
while (className.ToString() != "Internet Explorer_Server") // The class control for the browser
{
wbHandle = GetWindow(wbHandle, 5); // Get a wbHandle to the child window
GetClassName(wbHandle, className, className.Capacity);
}
//Show Click
System.Drawing.Graphics g;
g = Graphics.FromHwnd(wbHandle);
g.DrawEllipse(new Pen(new SolidBrush(Color.Red),15), yourX, yourY, 15, 15);
//g.DrawImageDrawString("X", this.Font, new SolidBrush(Color.Red), yourX, yourY)
g.Dispose();
|
|
|
|
|
Hello,
Beyond monitoring registry, file system, etc access with process monitor, and window messages with the likes of something like Winspector, is there a piece of software that can watch API calls of processes?
Thanks,
Matt
|
|
|
|
|
I was tempted to say .. 'look at Detours' qv http://research.microsoft.com/en-us/projects/detours/[^], but that doesnt help you in a C# environment AND I think you'd still have to know what API calls you were going to watch ahead of time ..
so Im sorry, this is a waste of a post - I hope someone else has useful info for you ..
'g'
|
|
|
|
|
That's very interesting, and brings up the point that the senior dev at my work said... detour/redirect the APIs.
I think that process monitor actually attaches a debugger to each process, this isn't enough?
What about analyzing the call stack (like process explorer), but in an on going logging manner?
Thanks,
Matt
[ud]
eyyy yo[^]
modified on Friday, March 20, 2009 8:21 PM
|
|
|
|
|
bbranded wrote: What about analyzing the call stack (like process explorer), but in an on going logging manner?
ok, I could see this being used for exploratory purposes/during development, but, 'on going' ... surely it would be very expensive cpu-wise ?
Interesting issue though .. does tickle something in the reccesses of my deep/gutter like brain .. something about someone with an instrumentation API for C# - but it wasnt making him/them any money so I think it got canned .. lets see...
well, it wasnt this http://tracetool.sourceforge.net/[^] I was thinking of, but it may give you ideas ...
'g'
|
|
|
|
|
I don't mean "on going," like on going, but more like how you'd use process monitor. Process explorer's call stack thing is very small, and simple.
I'm looking to passively observe, and am looking for a piece of software, although an API is cool too. I'm not particularly looking for a debugger, as I can't debug software I may need to monitor (I work at a hedge fund, and am a net and sys admin, but I do code in C#).
Are you speaking of fastice, or whatever that debugger is?
Thanks for the replies!
Matt
|
|
|
|
|
bbranded wrote: Are you speaking of fastice, or whatever that debugger is?
no, there was an instrumentation api/product out there - cant find it now
'g'
|
|
|
|
|
Sir,
can u state methods to extract data from hl7 message
|
|
|
|
|
|
Man, it sucks to be you. HL7 is a pile of crap embedded in a pile of crap. The technical documentation for it is several THOUSAND pages. Buy a parser - it's your only hope.
"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
|
|
|
|
|
In my application I use the Application Settings to store user preferences (such as preferred colors, size of the window, which parts or my program to hide or show etc)
But I'd also like to store an ArrayList in the settings.
Now I already have an ArrayList stored containing some simple integers (column widths), which works perfectly.
However, when I try to store an ArrayList containing a custom class (Group) which contains a string (name) and a boolean (isVisible) and I start up my application again (it saves the settings on exiting) the setting is empty, as if the arraylist never contained any groups.
At first I thought it was the custom class I made which would cause the problem, but I also store some values which are a custom class in the settings, so I doubt that's it.
I guess my problem is obvious here, why won't the Application Setting remember my ArrayList containing Groups?
For those interested in the Group class code:
public class Group
{
private string name;
private bool visible;
public Group(string name)
{
this.name = name;
}
#region Getters and Setters
public string Name
{
get { return name; }
set { name = value; }
}
public bool IsVisible
{
get { return visible; }
set { visible = value; }
}
#endregion
}
|
|
|
|
|
I've not tried it, but I guess decorating your class with the Serializable attribute whould allow it to be serialized to the settings
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I am not really familiar with the whole Serializable attribute, but I read that adding [Serializable] above your class should do the trick.
So I did that, and now the ArrayList isn't empty, now it's null >_<
EDIT: I've been playing around a bit, and if I convert the contents of the group to 1 string, and store an arraylist containing those strings, it stores it fine.
So I either need to find some great tutorial on how that serialization thingy works, or I need to find another way to store this data (originally I stored in in a file next to the exe, but this, of course, is very error sensitive since it can easily be edited).
modified on Friday, March 20, 2009 6:28 PM
|
|
|
|