desktop icon functionality in a window - windows-xp

My wife complains that I have too many icons on the Windows XP-Pro desktop.
I like to be able to quickly drop a file onto the icon for application I want to have open it. And I like to follow a link to open often-used deeply nested folders rather than navigate there. Thus, I have over 100 icons on the desktop.
(We share the same user account because we switch back and forth so often and because we both need to access the same e-mail, so separate accounts isn't the answer.)
I'd like to write a program which would have similar functionality to the Windows desktop. Then I could open that window to do the drag and drop work, but, when minimized, would leave the desktop display sparsely populated for my wife. As an added bonus, I could implement better organization of the icons than the desktop allows.
This is similar to what an Explorer window does, with the key exception that the desktop allows you to do some arrangement of icons. (For instance, program icons on the left (with the most used ones near the top), folders at the top, data files on the right.)
How do I go about getting an icon to display in a Windows Form (or on an appropriate control on the form)? (For instance, if I drop in a link to Notepad or a link to a file folder.)
How do I take the same action that the desktop does if the icon is double clicked? (For instance, if a link to a folder is double clicked.)
How do I take the same action that the desktop does if the icon has something dragged onto it? (For instance, a text file is dragged onto the Notepad icon.)
I'm using Visual Studio and C#.NET for programming.
I know how to do basic drag and drop.
I do not know:
A. what controls to use on the form to display the icons
B. how to find the icon
C. what commands are built by the desktop under various situations (so I can emulate the functionality)
I apologize that this is a multi-part question, but it was hard to break apart without explaining the whole story again.

This is a big question, but I'll give you some quick thoughts to get things moving in the right direction. WinForms exposes the functionality needed to make this happen, it's just a matter of wiring everything up the way you want it.
The key piece that you will want to look into is Drag/Drop, which is very well supported by WinForms. If you implement your icons as ImageBoxes you can set the AllowDrop property on the program icons and then handle the DragDrop event and have it call an overload of System.Diagnostics.Process() to start the application with the dropped filename as an argument.
As far as finding icons, most programs have their icon included as a resource in their .EXE file or in a related .DLL.
Regarding question C, the underlying question is what behaviors of the desktop would you like to have in your program? Explorer.exe is a massive application that does far more than what you need or what you will need or want to implement. Once you decide what functionality you want, play around with the IntelliSense list of events for the form and imagebox controls. You'll find that a lot of behavior is given to you for free in the Windows common controls, and additional behavior is fairly easy to add by handling the appropriate events.

Why dont you just use a Virtual Desktop??
Try http://virtuawin.sourceforge.net/
You will skip a lot of coding.
Right from their page:
"VirtuaWin is a virtual desktop manager for the Windows operating system (Win9x/ME/NT/Win2K/XP/Win2003/Vista). A virtual desktop manager lets you organize applications over several virtual desktops (also called 'workspaces'). Virtual desktops are very common in Unix/Linux, and once you get accustomed to using them, they become an essential part of a productive workflow."

Related

Keyboard Filter Driver. Scan Code -> VK_??? (OEM Specific)

Preface (Imaginary. So someone does not ask 'What are you trying to do?):
I have a Win32 C++ application.
This application wants to know when the user wants to open the start menu via Ctrl+Esc
Of course, Ctrl+Esc is fired from the operating system so the application never see's it.
I have looked at Windows Virtual Keys.
I see that there are plenty of OEM specific VK's
(0x92-0x96,0xE0,0xE9-0xF5,..)
So my thought was:
Keyboard Filter Driver.
When my application has the focus it tells the Keyboard Filter Driver.
When my driver sees the Ctrl is down and an Esc down occurs (And my application has focus):
-- Swallow the Esc and replace it with a scan code that will produce say a VK_0x92 (OEM Specific).
Since I have swallowed the Esc the operating system will never see Ctr+Esc
My application will then see the VK_0x92 and know the user wants to open the start menu and perform some action.
My question is how do I 'muck' the input within my driver (KEYBOARD_INPUT_DATA) in order for a say
VK_0x92 to appear within my application?
Thanks in advance for any pointers.
It is all about the Keyboard Layout.
What I needed to do was not supported by Microsoft Keyboard Layout Creator (MKLC).
See: Keyboard Layout Samples.
I found the samples to be very old and hard to read through. Clearly the US and German keyboard samples are not the most recent.
I wrote a program to create Visual Studio projects for keyboard layouts by pointing to a specific layout (I.e, KBDUS.dll for example). I generate the source code, .vxcproj, ... I then make my modifications and build it.
Installing the layout is another can of worms entirely. I have asked in several places for Microsoft to release the source code for the CustomAction Dll that is contained within the MKLC generated .MSI to no avail.

Assign command to the central soft button within javaMe

I have the mobile javaMe application that has been working on Nokia Phones. However, now I'm porting it to Samsung 5611, and I've faced with such a problem: no command is assigned on the central soft button, all of them are contained in the right-button menu. When the same midlet was launched on Nokia 3110c, one command was placed on central button, other ones (if >=2) were grouped into the options menu.
I tried Item.setDefaultCommand (no effect) and Display.getInstance().setThirdSoftButton(true) (such method not supported in SDK 3.4). Also I tried to change the type of one command to Ok or Screen, and change the priority, everything is without success.
Thanks in advance. Any idea will be helpful.
Sadly there's no way for the developer to decide exactly on which softbuttons the commands belong. It is the individual device that decides. Some devices has two softbuttons, and some has three.
You can fiddle a bit with priorities, but you still can't force commands to specific softbuttons.
That's high-level GUI (Form) for you.
If you want to have control of such things, you need to go with low-level GUI (Canvas / GameCanvas). Nowadays there are several APIs you can use to create Form-like low-level GUI. Check out LWUIT for example, which I imagine makes it easy for you to port your high-level code into low-level.
But even when using low-level coding, you have to be aware of different devices having different keycodes for the softbuttons.

Writing a macro-like tool

Recently I've been finding myself doing repetitive tasks. I would click button A, highlight text field A, type in some text, click an APPLY button, click on a drop-down box and select a specific option depending on the item I'm working with, select it and hit APPLY, then repeat this process only a couple hundred to thousand times.
So I thought maybe there's a way I could automate this? Macros then came to mind. However I've never wrote macros before so am not sure of several details such as
-what tools should I even work with?
-how do I determine which button to click?
-ideally, I would want to be able to read input from a text file to specify what should be typed in and which option should be selected from the dropdown list. Is this even possible? It seems like an operation that require some intelligence.
I am not picky on tools nor about cleanliness. I just want to be able to automate the process. It will be for personal use unless I find a convenient way such that others can use it as well.
Some details about the dropdown box: when the box is focused, I can hit the DOWN key to scroll from option to option. The items that I have to associate with these options are named exactly the same, so they appear in the same "index" order (meaning, the first item and first option appear at the top of the list, second item and second option appear after, thid item and third option...etc)
The placement of all of these fields can be fixed, so if I have to manually specify where on the screen I should be clicking, that is also a possibility.
Any idea where I should look?
If you're using Windows, AutoIt is a really nice tool.
It records actions (like a word/excel macro)
It offers a BASIC like language + API which is really easy to program (if you need to)
The API is pretty powerful
Check for Windows with a certain title
Automate klicks
...
You can "compile" your scripts into exe files so you can share your tools
It comes bundled with Scite (a nice text editor) + AutoIt syntax higlighting
But you can use any editor you want
It's well documented
It's Freeware
http://www.autoitscript.com/site/
On the Mac, there is Automator. Java has the Robot class in the basic library, to help with such automation. No doubt there are other similar tools.

Where do I specify the text of a Pocket PC app's shortcut?

I'm unfamiliar with Pocket PC development, but I have to make a few minor changes to an VS2005, Pocket PC 2003 Device application. One of the changes (which I thought would be trivial) is changing the text of app's shortcut, but I can't figure out where this text is set. The solution includes a setup project, so I'm looking for it in there, but I can't find it. I know it's got to be in there somewhere because building the setup project generates an AppSetup.inf file that contains the shortcut information.
This can't be that difficult. Surly I'm suffering from what my wife refers to as "male vision" when I can't find the bottle of mustard in the refrigerator that's right in front of my face. Where do I specify this text?
It depends on exactly how the shortcut is generated. There are generally 3 mechanisms that are used.
Via the CEShortcuts section of the INF. For this, it's the text before the first comma
Via copying an LNK file via the CopyFiles section of the INF. With this mechanism, you create a physical LNK file on the desktop that gets rolled into the CAB and it's copied like any other file. The name on the device is again the first string before the comma.
Via a programmatic call (usually to SHCreateShortcut) in a custom CE Setup DLL.
You'll have to figure out which is being used in your deployment scenario to know exactly what needs to be changed.
Thinking more about this, are you trying to simply find where in the Studio UI of the installer project to change the shortcut? If so, this MSDN article may help. What is very non-intuitive is that there are little icons at the top of the Solution Explorer that change the view of the installer, allowing you to see things like files, registry entries, etc. It may be that you simply aren't looking at the right view and you need to select a different icon. There are no menu items that do what these icons do, and they are hard to notice the first time you start using an installer project.
Well, as I suspected, it was right in front of my face. We'll call this project PDAProject. In the solution explorer, under the PDAProjectSetup project is an item labeled Primary output from PDAProject (Active). If I double-click on this item two panes appear in the code editor window. The one on the far left shows a folder tree labeled File System on Target Machine. Under this are three folders labeled Application Folder, Program Files Folder, and Programs Folder. When I click on the Programs Folder, the application shortcut appears in the pane on the right and I can modify its text.
I don't know why I was never compelled to double click on that Primary output from PDAProject (Active) project item even though that's how you open any class or form for editing. I kept right-clicking and opening the Properties. Maybe it's time to give up programming and take up basket weaving.

Folder "drop box" with custom behavior

I'm thinking of trying to create a "drop box" application that can automatically organize files as you drop them into a folder. I always end up with a bunch of random files on my desktop, and I think it would be useful to be able to drag them onto an icon/folder on the desktop and have them automatically sorted into other locations based on some rules (file extensions, naming conventions, etc.)
I'm not sure how to implement this. Can anyone point me to any resources/tips on how to accomplish something like this? Maybe some sort of drag and drop folder extension?
One idea would be to have a background process that periodically checks a folder and just moves files around, but it would be cool to have this happen automagically w/out a background process.
Thanks
In C# FileSystemWatcher is your friend, check a little tutorial. It's just a wrapper over ReadDirectoryChangesW on Win32 so you could use if you use another language. Linux provide the same via dnotify.