Jump to content

How do I write EXE in Notepad/Sublime Text? I only know HTML, CSS, and Python

Go to solution Solved by maplepants,
38 minutes ago, Dat Guy said:

Luckily, the Windows API is exactly what enables you to write graphical Windows software in C.

It does, but it's nowhere near the intended use case. Microsoft doesn't even recommend that new programmers use C++. Their documentation says 

Quote

C++ or .NET?

In general, .NET programming in C# is less complex, less error-prone, and has a more modern object-oriented API than Win32 or MFC. In most cases, its performance is more than adequate. .NET features the Windows Presentation Foundation (WPF) for rich graphics, and you can consume both Win32 and the modern Windows Runtime API. As a general rule, we recommend using C++ for desktop applications when you require:

    precise control over memory usage
    the utmost economy in power consumption
    usage of the GPU for general computing
    access to DirectX
    heavy usage of standard C++ libraries

It's also possible to combine the power and efficiency of C++ with .NET programming. You can create a user interface in C# and use C++/CLI to enable the application to consume native C++ libraries. For more information, see .NET Programming with C++/CLI.

I'm not saying C is a bad language or anything, just that the OP here is a new programmer with some python experience whose now looking to make some basic windows apps. It makes no sense to recommend somebody like this use C as opposed to .NET. Even if I wasn't going to recommend C#, I'd still recommend C++ over C for a newbie targeting Windows.

 

Like I said in my first post, programming languages are just tools and you should pick your tool based on the job. If he were asking us about building a mac app, I'd tell him to use Swift, elementaryOS I'd tell him Vala, etc. When you're just starting out you should should always use whatever the platform's recommend tooling and pathway is. You should really only use a language like C in cases where you have a good reason to do so.

How do I make a simple .exe from Notepad or Sublime Text 3? I have very little knowledge of programming. I only know HTML, CSS, and Python. Anything I can do here? If not, can you provide an example code and languages to learn?

As Someone with the username “</TheCoder2019_”, my coding skills are atrocious.

Here are my specs:

Spoiler

 

MSI PRO-VLH H310M

Intel Core i3-8100 (Thanks, @Schnoz!)

GTX 1060 OC 3GB or Intel UHD 630

16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz

GAMDIAS Argus M1

 

An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load)

 

 

Linux Apps you NEED!

Spoiler

tmux

dhcpd

git

 

 


 

 

 

 

 

 

 

Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page

Link to comment
Share on other sites

Link to post
Share on other sites

you write a program in a language like c, c++, c# or similar. Then a complier makes the exe from the code. You don't write or edit the exe its self normally.

 

GIve a hello world a try in C or simmilar. You will need a compiler aswell. You can add gcc or simmilar to those editiors, or put them into a complier when done, or it is normally better to use a ide like visual studio or codeblocks.

Link to comment
Share on other sites

Link to post
Share on other sites

As far as i know, exe is compiled binary hence you need an IDE (cant be done in simple notepad unless you are a wizard).

 

about programming language.

pick one and master it. if all you doing is machine level stuff learn c and cpp. 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Electronics Wizardy said:

you write a program in a language like c, c++, c# or similar. Then a complier makes the exe from the code. You don't write or edit the exe its self normally.

 

GIve a hello world a try in C or simmilar. You will need a compiler aswell. You can add gcc or simmilar to those editiors, or put them into a complier when done, or it is normally better to use a ide like visual studio or codeblocks.

How long will it take to learn C? Im 13 and I dont have much time as expected.

What compiler do I use?

As Someone with the username “</TheCoder2019_”, my coding skills are atrocious.

Here are my specs:

Spoiler

 

MSI PRO-VLH H310M

Intel Core i3-8100 (Thanks, @Schnoz!)

GTX 1060 OC 3GB or Intel UHD 630

16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz

GAMDIAS Argus M1

 

An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load)

 

 

Linux Apps you NEED!

Spoiler

tmux

dhcpd

git

 

 


 

 

 

 

 

 

 

Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, TheCoder2019 said:

How long will it take to learn C? Im 13 and I dont have much time as expected.

What compiler do I use?

you can learn basics in weeks. use GCC compiler.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, TheCoder2019 said:

How long will it take to learn C? Im 13 and I dont have much time as expected.

What compiler do I use?

Look up some basic tutorials. Basic code like hello world you can learn in a day. If you want to be an expert it will be years.

 

Id install visutal studio as a start.

Link to comment
Share on other sites

Link to post
Share on other sites

21 minutes ago, TheCoder2019 said:

How long will it take to learn C? Im 13 and I dont have much time as expected.

What compiler do I use?

13? you have all the time in the world kid.

You need to learn something like C++ or Java and the code needs to be compiled.

Actually you can do it in Python, use Pyinstaller to compile it to exe.

Ryzen 5700g @ 4.4ghz all cores | Asrock B550M Steel Legend | 3060 | 2x 16gb Micron E 2666 @ 4200mhz cl16 | 500gb WD SN750 | 12 TB HDD | Deepcool Gammax 400 w/ 2 delta 4000rpm push pull | Antec Neo Eco Zen 500w

Link to comment
Share on other sites

Link to post
Share on other sites

Technically you could write code in notepad and run it through a compiler but the advice of others on here is good. Get yourself a free IDE to work with and start a tutorial.

 

I would recommend starting with C# and Visual Studio Community 2019.

 

Visual Studio Community 2019 (FREE): https://visualstudio.microsoft.com/downloads/

 

Tutorials: https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/

 

Is there anything in particular you're wanting to learn how to build (ie. website, commandline app, graphical app, mobile app, game)?

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, ProjectXv1 said:

exe is compiled binary hence you need an IDE (cant be done in simple notepad unless you are a wizard)

Yes, it can. Write your code in Notepad and compile it with a compiler.

There is absolutely no need in installing a multi-gigabyte software package only to write code.

 

 

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

Actually this tutorial is exactly what you asked. It walks through installing the (cross-platform) DotNet Core framework and using command-line to create a new app and editing the code in notepad. DotNet core also has many deployment options including an option for a completely self contained exe.

 

https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro

Link to comment
Share on other sites

Link to post
Share on other sites

You should NOT learn C or C++ as first language, as it will be too difficult and scare you or put you off.

 

Learn python , or if you rally want binaries C#, there's also free pascal which is 100% free but delphi/pascal is kinda not trendy anymore

There's also golang which is very easy to learn and makes exe files but it's a bit hard to make graphical applications in it (can do command line tools, can do games, can do graphical apps like ms paint but it's a bit harder)

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Do not try and write Windows software in C. You’re young and trying to get into programing, you probably want a graphical interface for your program.

 

I’m going to echo other posters here and recommend you look into .NET and Visual Studio. It’s free for students like you (https://visualstudio.microsoft.com/students/) and it’ll let you build nice, native Windows applications way easier that writing them in C. 

 

Programming languages are tools, and you should always pick your tool based on the job you’re doing. C is great for many things, but it’s not the way you should learn how to make basic Windows apps. 

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/7/2020 at 2:19 PM, maplepants said:

Do not try and write Windows software in C. You’re young and trying to get into programing, you probably want a graphical interface for your program.

Luckily, the Windows API is exactly what enables you to write graphical Windows software in C.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

38 minutes ago, Dat Guy said:

Luckily, the Windows API is exactly what enables you to write graphical Windows software in C.

It does, but it's nowhere near the intended use case. Microsoft doesn't even recommend that new programmers use C++. Their documentation says 

Quote

C++ or .NET?

In general, .NET programming in C# is less complex, less error-prone, and has a more modern object-oriented API than Win32 or MFC. In most cases, its performance is more than adequate. .NET features the Windows Presentation Foundation (WPF) for rich graphics, and you can consume both Win32 and the modern Windows Runtime API. As a general rule, we recommend using C++ for desktop applications when you require:

    precise control over memory usage
    the utmost economy in power consumption
    usage of the GPU for general computing
    access to DirectX
    heavy usage of standard C++ libraries

It's also possible to combine the power and efficiency of C++ with .NET programming. You can create a user interface in C# and use C++/CLI to enable the application to consume native C++ libraries. For more information, see .NET Programming with C++/CLI.

I'm not saying C is a bad language or anything, just that the OP here is a new programmer with some python experience whose now looking to make some basic windows apps. It makes no sense to recommend somebody like this use C as opposed to .NET. Even if I wasn't going to recommend C#, I'd still recommend C++ over C for a newbie targeting Windows.

 

Like I said in my first post, programming languages are just tools and you should pick your tool based on the job. If he were asking us about building a mac app, I'd tell him to use Swift, elementaryOS I'd tell him Vala, etc. When you're just starting out you should should always use whatever the platform's recommend tooling and pathway is. You should really only use a language like C in cases where you have a good reason to do so.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, maplepants said:

Microsoft doesn't even recommend that new programmers use C++.

Surprisingly, Microsoft wants to sell their .NET stuff. Even more surprisingly, Microsoft (whose popular IDE comes with no C support at all and whose C compiler is stuck with an ancient version of the standard) does not endorse C. That says a lot about Microsoft and nothing about C. :)

 

.NET applications usually don't directly use the Windows API for GUI elements, WPF and all of its recent colleagues are quite the same thing as Qt (minus the portability). I fail to see a good reason to add a multi-megabyte overhead for something which your operating system provides at no additional runtime cost.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, Dat Guy said:

I fail to see a good reason to add a multi-megabyte overhead for something which your operating system provides at no additional runtime cost.

The reason is that the .NET languages are easier to learn. You're talking about sacrificing ease of use in the name of a few megabytes of RAM and hard drive space. I used to sweat every megabyte back in the 90s, but these days even a low end machine will have enough RAM and storage that sacrificing a few megabytes in order to make learning how to program easier is the right trade off to make for 99% of people. And we already know that OP has been programming in python, which is much less efficient than nearly any compiled language because it's making a whole difference set of trade offs.

 

C is a fine language with many important use cases like low level audio processing, or other use cases where you need byte level access to I/O. But for all it's positive attributes, it is not the "I'm building my first simple Windows app" language.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, maplepants said:

And we already know that OP has been programming in python, which is much less efficient than nearly any compiled language

True. But:

 

4 minutes ago, maplepants said:

these days even a low end machine will have enough RAM and storage that sacrificing a few megabytes in order to make learning how to program easier is the right trade off to make for 99% of people.

The most interesting question here, surprisingly left unasked, is whether the OP wants to have (nearly) instant results or to actually learn how Windows works. Sure, if all he wants to achieve is a quick tool never to be touched again, the former might be a reasonable assumption - but if he wants to go deeper, moving from one giant level of abstraction to another, including having to learn how to use a new environment (IDE) as weirdly recommended above, makes no actual sense in my eyes.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Dat Guy said:

The most interesting question here, surprisingly left unasked, is whether the OP wants to have (nearly) instant results or to actually learn how Windows works.

Yes, I want to have nearly instant results

As Someone with the username “</TheCoder2019_”, my coding skills are atrocious.

Here are my specs:

Spoiler

 

MSI PRO-VLH H310M

Intel Core i3-8100 (Thanks, @Schnoz!)

GTX 1060 OC 3GB or Intel UHD 630

16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz

GAMDIAS Argus M1

 

An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load)

 

 

Linux Apps you NEED!

Spoiler

tmux

dhcpd

git

 

 


 

 

 

 

 

 

 

Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page

Link to comment
Share on other sites

Link to post
Share on other sites

29 minutes ago, Dat Guy said:

actually learn how Windows works.

I think the difference here is that I don't see learning about your OS in detail as being particularly important for anybodies first program. Trying to learn how Windows works under the cover by way of writing a hello world level GUI app would be a bit like learning about Intel's hyper-threading or branch prediction algorithm during your first multi threaded application. Or doing a deep dive on encryption and cryptography before using something like GnomeKeyring or iOS/macOS keychain in your app.

 

There are many important parts of how your system works that just don't matter for basic application writing. I'd even argue that the great benefit of modern operating systems like Linux, Windows, macOS, iOS and Android is that their API support allows you to focus on the features that really matter to your app and leave the rest up to the platform. If your platform has already solved the problem of drawing a nice table with buttons that play nicely with screen readers, scale across monitors with different pixel density and support diverse interface options like touch, mouse, pencil, etc then I'd say there's not much benefit in some newbie cracking open vim and trying to re invent the wheel with C.

 

Not that this is a knock against C or it's usage in general. Just that a full featured IDE like Visual Studio, Gnome Builder, Xcode or something like Unity exist because they offer massive benefits to their users that are basically always worth the learning curve, despite the fact that they're not doing anything you couldn't do yourself with vim and gcc.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, maplepants said:

I'd say there's not much benefit in some newbie cracking open vim

Well, the original assumption was that Notepad wouldn’t work. It would. When someone asks me how to use a specific tool to solve a problem, I’d rather not suggest a different tool first.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

On 10/29/2020 at 3:12 AM, TheCoder2019 said:

How do I make a simple .exe from Notepad or Sublime Text 3? I have very little knowledge of programming. I only know HTML, CSS, and Python. Anything I can do here? If not, can you provide an example code and languages to learn?

Python is an interpreted language (meaning that Python code is executed by the interpreter, not directly by the processor), so it cannot be compiled into machine code. Same with HTML and CSS, they can only be rendered by the browser. As mentioned above, you can make an executable out of a Python script using tools like Pyinstaller and cxFreeze (I had more luck with cxFreeze on Windows), but that would be a "fake" executable, in a way, as it will be just a piece of Python interpreter together with your script and imported libraries bundled in an .exe file. But you can totally do it if you want :) just google both packages (both are installable via pip) and see if any of them works for what you want to develop.

And you can totally do it in any text editor you want, no need for fancy IDE :)

Link to comment
Share on other sites

Link to post
Share on other sites

18 hours ago, TheCoder2019 said:

Yes, I want to have nearly instant results

What are you trying to achieve? What is this exe going to do? Maybe all you need is a bat(ch) file.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×