How to create GUI on the windows7 Desktop?

  • Thread starter Thread starter Nate Duong
  • Start date Start date
  • Tags Tags
    Desktop Gui
Click For Summary
Creating a GUI button on the Windows 7 desktop to run a batch file can be challenging. While shortcuts to batch files are the simplest solution, they may not appear professional. Visual Basic is recommended for users with no programming experience, as it allows for the creation of simple applications. For a more advanced approach, users can consider developing a widget or a system tray application, although these methods can be complex and may not provide the desired button functionality. Ultimately, using a shortcut remains the most straightforward and reliable option for executing batch files.
Nate Duong
Messages
125
Reaction score
4
Dear Group,

I am trying to to build a button ( with rectangle size) on the desktop of windows7,

Whenever I click on that button, it will connect to batch file (which I created for some function) and run that batch file (filename.bat),

Can you give me ideals that how to have that button on the desktop? I had some research and most people use python and java, but I would like to know a specific software which easiest to help me get that point.

Please help!

Thank you, Group.



Nate Duong.
 
Computer science news on Phys.org
If you have no previous programming experience you would probably find Visual BASIC to be the easiest way to produce a simple app for Windows like you describe.
 
  • Like
Likes Nate Duong
Would a shortcut do? Eg just create a shortcut to the batch file and put it on the desktop.
 
  • Like
Likes Vanadium 50 and FactChecker
That should work, though It might be necessary to invoke the command line program with the batch file supplied as a parameter.
Probably not though, the OS would most likely figure out for itself that it needs to run the command line program.
However that approach won't allow for the possibility to have a rectangular depressable button.
 
Last edited:
CWatters said:
Would a shortcut do? Eg just create a shortcut to the batch file and put it on the desktop.
Dear CWatters,

I've done that ideal but I really do not like it, it is not professional, But thank you so much for your help...
 
rootone said:
If you have no previous programming experience you would probably find Visual BASIC to be the easiest way to produce a simple app for Windows like you describe.

Dear Rootone,

Thank you for your recommendation, let me try to work on it,

Regards,

Nate Duong.
 
Good luck! :smile:
 
Nate Duong said:
Dear CWatters,

I've done that ideal but I really do not like it, it is not professional, But thank you so much for your help...
The professional way is to use the system to get the job done in the simplest, most reliable way. A shortcut will do that. If you want the rectangle icon, you can convert a .jpg to .ico file type and change the shortcut icon. Google will give you links to conversion programs.

If you are more interested in learning how to do graphics, that is another thing entirely. Visual Basic, Open GL, and Microsoft Foundation Class are some options.
 
Professional way is to not introduce new elements of the GUI to not confuse users - it is a so called principle of least astonishment. I have no "buttons" on my desktop and I wouldn't know what to expect from one if it will appear. Shortcuts on the other hand are quite typical and it is obvious they will start some kind of action.
 
  • Like
Likes FactChecker
  • #10
Nate Duong said:
Dear Group,

I am trying to to build a button ( with rectangle size) on the desktop of windows7,

Whenever I click on that button, it will connect to batch file (which I created for some function) and run that batch file (filename.bat),

Can you give me ideals that how to have that button on the desktop? I had some research and most people use python and java, but I would like to know a specific software which easiest to help me get that point.

Please help!

Thank you, Group.
Nate Duong.
I am not sure you can change the GUI in Windows. I think the closest you're going to get to buttons on your desktop that you can program would be widgets.

Windows has a "side bar" where you can load widgets, people often have the clock and CPU meter there. You can create your own widget and place it there, program it with buttons that execute some code when clicked.

I've never built one so I'm afraid I cannot guide you on what to do. I would start with googling something like "create Microsoft widget" or "create sidebar widget"

I would imagine it would be done in visual studio, visual studio express is the free version you can download.

Hope this helps.
Cheers
 
  • #11
Routaran said:
I am not sure you can change the GUI in Windows. I think the closest you're going to get to buttons on your desktop that you can program would be widgets.

Although it wouldn't precisely be "on the desktop", an appropriate way to accomplish this would be to write an application that places an icon in the system tray so that, when you right-click the icon, you can run the application, or exit it, or whatever.

The difficulty really is, that Windows GUI applications have some issues when they call a batch file, because they cannot ascertain when the batch file has completed it's work. There are clunky workarounds, subject to occasional issues, such as using file creation semaphones.

I have written system tray apps using Visual Studio and it's not difficult per se, but it is a little bit arcane. Code samples are likely freely available on the world wide web.
 
  • Like
Likes Silicon Waffle
  • #12
Honestly, if you really want a button that you click once, just write a batch script and put it in there.
It's on your gui and you have to click it once just like a button and then it does exactly what you want.
 

Attachments

  • Screenshot from 2015-12-22 10:24:59.png
    Screenshot from 2015-12-22 10:24:59.png
    1.8 KB · Views: 499
  • #13
Ideally, the shortcut solution described above is the best way.
There is no way to actually have an interactive button on the desktop buffer.

What you can do, if you really must have a the button on the desktop itself, is to create a WINDOWLESS program that draws directly to the desktop buffer and checks for mouseclick on the button to call the batch file. This is not ideal and contrary to good programming practice.

There is no double buffering performed on the deskto background, it is simply drawn first onto the screen and then windows are drawn over it.

Also, since Windows Vista, the DWM (Desktop Window Manager) will only redraw certain parts of the desktop and taskbar at certain times to make things a little faster - your button will be flickery and may be corrupted with mouse interaction etc. frequently.

Obviously, you must ensure the windowless program is running.
 
  • #14
Routaran said:
Honestly, if you really want a button that you click once, just write a batch script and put it in there.
It's on your gui and you have to click it once just like a button and then it does exactly what you want.
Also the links toolbar works well.
linkstoolbar.jpg
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
18
Views
9K
Replies
15
Views
10K
Replies
8
Views
3K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
10
Views
5K