i want only5 (five lines of codes) for a win32 application in delphi
u can use resource file and dpr file
can any body help
A compact solution that meets 's "five lines in the .dpr" constraint is to avoid the VCL and call the Windows API directly, then attach an already-compiled .res for icon/manifest. and are correct that it is a toy restriction, but it is doable for a tiny utility (message box, tray helper, launcher).
program FiveLine;
{$APPTYPE GUI}
uses Windows;
{$R MYAPP.RES}
begin MessageBox(0,'Hello world','Greeting',MB_OK); end. Create a resource script (myapp.rc) such as:
1 ICON "app.ico"
and compile it with the Delphi resource compiler shipped with the IDE: brcc32 myapp.rc -> produces myapp.res. Put myapp.res in the project folder (or reference its path) so the {$R MYAPP.RES} line finds it. To add a manifest for common controls, add a manifest line to the .rc (for example 1 RT_MANIFEST "myapp.manifest") before compiling.
Troubleshooting notes: if MessageBox is unresolved, ensure uses Windows; is present. If you see a console window, add {$APPTYPE GUI} (as above). Icon updates may not appear immediately because of OS icon caching. This pattern gives a tiny GUI EXE with no VCL forms or Application loop — fine for small tools, not for full applications that need form management or message pumping.
Jump to Post— Duoas 1,025You may not like my saying, but those are pretty stupid restrictions. Your program is going to be pretty boring.
Is there some reason you don't want to use more than five lines?
You may not like my saying, but those are pretty stupid restrictions. Your program is going to be pretty boring.
Is there some reason you don't want to use more than five lines?
better yet, why the 5 line restriction.. guiness world record? hehe
oops, Duoas asked why already, my bad...
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.