|
|
EladKatz wrote: i want the application owner to be able to add entries to the file
Then ClickOnce deployment is not what you want; ClickOnce apps are lightweight, low-impact apps that aren't installed in c:\program files or any other location that requires admin privs. Use a standard setup program instead. Creating a setup project in Visual Studio[^] For what it's worth, I don't know if you can create setup projects using Visual Studio Express editions; I believe you must have the pro edition or better.
|
|
|
|
|
Hi,
I need to get the common_documents environment and it is NOT obtainable using system.environment so I need to use CSIDL and SHGetSpecialFolderPath.
Can some one post some example code in c# on how I implement this please.
Thanks,
Glen Harvy
|
|
|
|
|
string value = Microsoft.Win32.Registry.GetValue(@"HKey_Local_Machine\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Common Documents", null) as string;
|
|
|
|
|
Hi,
For whatever reason, this does not achieve the result I need (at least on my W2K3 server).
I need to install files into the common_documents directory so that any user can edit them (they are template type files).
The code you listed does indeed return the correct path as far as I can tell (viz c:\documents and settings\all users\documents) however if I create a sub-directory in that directory it is not being shown in the MyDocuments window.
This must have something to do with the network, profiles etc but it seems to me that I cannot achieve my goal as easily as I thought.
Thanks for your response - much appreciated.
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: however if I create a sub-directory in that directory it is not being shown in the MyDocuments window.
Glen Harvy wrote: The code you listed does indeed return the correct path as far as I can tell
Ah, ok, you didn't mention that in your first post. Yeah, it may be wise to look into Win32 shell calls to have this done, but I'm not an expert in that area.
|
|
|
|
|
Try taking a look here[^].
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Im on need of a way to extract an internet explorer's shortcut icon fo my favorites system in my webbrowser. Anyone know how?
|
|
|
|
|
IE favorite files are stored in [documents and settings]\[user]\Favorites\ in WindowsXP. Open that sucker up with a File.ReadAllLines call and look for a line that reads like this:
IconFile=http: Do a WebClient.DownloadFile to grab that icon from the web and you're home free.
|
|
|
|
|
could you write me an example on how to do this. Ive got the File.ReadAllLines Part but how would you search for the string representing the favicon.ico path?
|
|
|
|
|
sagedread wrote: how would you search for the string representing the favicon.ico path?
In .NET 1 and .NET 2, you'd write it like this:
string iconFilePath = "";
string iconFileLabel = "IconFile=";
foreach (string line in File.ReadAllLines(theFavoriteFilePathGoesHere))
{
if (line.StartsWith(iconFileLabel))
{
iconFilePath = line.Remove(0, iconFileLabel.Length);
break;
}
} Or if you're using the latest version of .NET, you could write this as a LINQ query:
var matchingLines = from line in File.ReadAllLines(favoriteFilePath)
let iconFileLabel = "IconFile="
where line.StartsWith(iconFileLabel)
select line.Remove(0, iconFileLabel.Length);
var iconFilePath = matchingLines.FirstOrDefault();
|
|
|
|
|
Hello,
I'm trying to pass an array of a type I've defined to unmanaged C++.
If I declare the parameter as: func (BitmapInfo* objects...
I get the error: "Cannot take the address of, get the size of, or declare a pointer to an unmanaged type." (This is even with BitmapInfo declared with the "unsafe" attribute.)
If I declare it as: func (BitmapInfo [] objects...
It compiles, but crashes with the message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
If I try to put the address in an IntPtr:
IntPtr arrayStart = (IntPtr) (&(objects [0]));
I get the first compile error again.
How can I pass a custom array to unmanaged code? Thanks!
|
|
|
|
|
Never mind -- I solved the problem. Here's the solution in case anyone else encounters this:
The key idea is to use a struct instead of a class. The reason is that class instances are allocated in the heap, and the managed environment moves heap items around, so any pointer to a class instance may become invalid.
Structs are allocated on the stack and stay there, so it's feasible to use pointers to them.
|
|
|
|
|
For reference types (classes) you would need a GCHandle that allows you to fix the object
in memory, get its IntPtr, use it, then free it again.
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.
|
|
|
|
|
|
Hi guys
I have a rdlc report which displays an image from a database. I have no problem displaying the image. What i do have a problem with is that the image always shows in the top left corner of my picture box, does anyone know how to center the image vertically and horizontally.
Thanx in advance
|
|
|
|
|
Hi,
Take a look at the SizeMode property and specify PictureBoxSizeMode.CenterImage
"The image is displayed in the center if the PictureBox is larger than the image. If the image is larger than the PictureBox, the picture is placed in the center of the PictureBox and the outside edges are clipped."
AlanN.
|
|
|
|
|
Thank you for the reply Alan
I have set the Sizemode property to AutoSize so that the image that i get from the db displays proportionally. I do not want the picture scaling to be distorted.
|
|
|
|
|
My question isn't exclusive to C# , it applies to any language that can use system api's..
here goes..
I'm writing a driver for a USB device a friend of mine pieced together..
All's well up to one point.. the thing registers certain events , and i have to send keystrokes accordingly so , to be system friendly (I'm quite a friendly person) I use the recommended SendInput function in User32.. still no problems here..
BUT , i have a software K(v)M switch running ( i use multiplicity but i used to use synergy , but thats not important) , the important thing is , it doesn't register the keys i press using the SendInput function...
So i was wondering ..
1 can someone say with absolute certainty how they do it...
2 i presume they use a SetWindowsHookEx with low level keyboard intercepts , and when I'm on the second screen , they probably return a dummy value on CallNextHookEx ... (still that doesnt explain why they aren't fooled by SendInput)
3 Can i also put in a hook in my program , bump it above the hook set by the kvm software(no idea if that's possible ), and use the callback function to simulate key presses...
If anyone has any suggestions about this please feel free to reply , any reply is welcome.
Thank you in advance.
|
|
|
|
|
You can try using keybd_event, thats like putting the keyboard data into the buffer yourself, rather that it getting sent from the keyboard. The key presses will be sent to the active window / control though, so you don't have as much control over where it goes.
keybd_event[^]
I think there's also an article on CP illustrating how to use keybd_event in C#
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I started reading about it before , but i stopped when i read
"Windows NT/2000/XP/Vista:This function has been superseded"
By which i sort of understood the function's days were numbered ..
Does this function influence the lowest keyboard input related layer in the OS , before i have to start messing with memory , and reserve or map memory before the OS is loaded..
Anyway , ill have a go , and see what it gives , thnx for the suggestion.
modified on Tuesday, April 15, 2008 4:08 PM
|
|
|
|
|
Negative on keyevent ..
Pffffffff........
I have no idea where to start looking now..
-Make a virtual HID device .....
-Make a memory mapping of the bios keyboard area somewhere at the end of vmem space to access from OS. by making some kind of boot loader..
-Buy some chinese feller from a sweatshop and make him press certain keys when he gets electric shocks in certain places.. ( response time would be a gradually incrementing feature )
I am still inclined to think the kvm software has a hook set up somewhere , and i need to feed it keys from the callback above.. tho i have no good feeling about sending a callback without having gotten a key in the first place..
Or maybe i should try the C++ section..
Any reply is welcome
Kind regards.
|
|
|
|
|
mumble mumble ..
any of you have experience modifying DDK's VHIDMINI driver ...?
i guess i'll ask in C++
..
|
|
|
|
|
How can I refresh or update ParentForm from ChildForm?
|
|
|
|
|
You probably could use this.Parent.Refresh()
or this.MdiParent.Refresh() if you have an MDI child form
|
|
|
|