Computing.Net > Forums > Programming > perl - GUI for Win32 programing

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

perl - GUI for Win32 programing

Reply to Message Icon

Name: Kelly
Date: May 20, 2002 at 15:41:26 Pacific
Comment:

I have windows 98 SE with 32MB of RAM and 133MHz P2 processor.

Does anyone know how I can make a GUI with perl, I have never programed a GUI before, I tryed the Tk module but had errors so I am now trying Win32::GUI The problem is I copy and pasted a simple GUI program from a tutorial then I ran it with my perl interpriter and got the following:

Can't locate Win32/GUI.pm in @INC (@INC contains: C:/Program Files/Perl/lib C:/Program Files/Perl/site/lib .) at first.pl line 1.
BEGIN failed --compilation aborted at first.pl line 1.

Here is my code:

use Win32::GUI;

$W1 = new Win32::GUI::Window(
-name => "W1",
-title => "Main Window",
-pos => [ 100, 100 ],
-size => [ 300, 200 ],
);
$W1->AddButton(
-name => "Button1",
-text => "Open popup window",
-pos => [ 10, 10 ],
);

$W2 = new Win32::GUI::Window(
-name => "W2",
-title => "Popup Window",
-pos => [ 150, 150 ],
-size => [ 300, 200 ],
);

$W1->Show();

Win32::GUI::Dialog();

sub Button1_Click { $W2->Show(); }

sub W1_Terminate { return -1; }

$W2->AddButton(
-name => "Button2",
-text => "Close this window",
-pos => [ 10, 10 ],
);

sub Button2_Click { $W2->Hide(); }

I have programed with C, Python, Qbasic, JavaScript, HTML, DHTML, CSS and CGI. I have only made dos applications. I don't know much about objects, classes, sockets or GUI for that matter, I like the look and ease of use of perl so I realy want to dig in and perhaps write a web browser now that I have some knowledge in networking and TCP/IP. I got myself perl2exe so I can compile my scripts into exe files but I realy need to get over this small GUI herdle. Can anyone tell me what I can do to fix this problem?



Sponsored Link
Ads by Google

Response Number 1
Name: Jeff J
Date: May 21, 2002 at 10:46:21 Pacific
Reply:

My Perl experience is getting dated, but even with all the new features coming out for it, I don't think it's the best way to go for an extensive GUI. C is the most common language for GUIs, with C++ classes wrapped around C in the lead these days. For faster coding, VB, full Java, and Object-Pascal (Borland's Delphi) are really popular.

I'm not trying to discourage, as I love Perl, but for the more serious GUI work you have planned, you might be better off diving deeper into C or C++.

If someone doesn't answer your question directly soon, you might want to repost, as some people might think this post already answered your immediate question.


0

Response Number 2
Name: Kelly
Date: May 22, 2002 at 10:47:04 Pacific
Reply:

I am seriously concidering your sugestion to dive deeper into C. Last night I found a example GUI program writen in C so I saved it then tryed to compile it, one error is stoping me from getting it to work, it said :

Error A:\TL-WIN~1.C 3: Declaration syntax error

The following is the code:

#include

int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nCmdShow )
{
MessageBox( NULL, "Hello, World!", "Hi!", MB_OK );
return 0;
}

MessageBox() apeared on a single line.

This is realy bugging me, I found another example last night that put a extra pre-processor directive after #include but still got the error. They were useing bcc32 to compile it which is Borlands C++ for Win32.
I have only Bcc as I have C/C++ 3.1 Complete Compiler Edition, It comes with a development enviroment cpp.exe and bc.exe and a comand line compiler bcc.exe as well as the linker, after reading last night It has become aparent that maybe my compilers are only for 16 bit. I am not sure. Should I still be able to compile link and execute GUI apps with my compiler? And if not does anyone know where I can find a c/c++ compiler for win32 development for free as I have no money.

Please help, once I can make a simple GUI application and sere it run I will be satisfied, then I will just read on my own time to learn all about the Win32API calls. Please help.

P.S. I discovered the answer to my first post was I did not have the gui perl module installed so I installed it, but now it yells at me telling me one of the library files needed to run Dynaloader.pm is missing. That error ocured on line 206 if i remember corectly of Dynaloader.pm
The code I used is the same as the very first code I pasted. Please help me anyone.

I prefer to make all my apps in perl but I am willing to dance with C more then I have as long as I dont get C sick :)


0

Response Number 3
Name: Jeff J
Date: May 23, 2002 at 11:28:49 Pacific
Reply:

I'm very familiar with bcc, and it's a great compiler. However, yours is somewhat dated, and 16-bit won't cut it, but Borland provides its latest compiler for free, in command-line form. You could write in your IDE, or one of the many free ones available, and use the newest bcc to make great code. It comes complete with the latest Win32 headers too:

"http://www.borland.com/cbuilder/cppcomp/index.html"

You don't have to spend a dime, and please don't get C sick :)

The occasional catch with using bcc to compile programs specifically written for Micro$oft's compiler, is that there are some slightly different #pragmas, and sometimes also #defines and #includes. They're easy to bypass, though.

The compiler switches (I'm assuming you're using a command line) are usually what it takes a little getting used to. But no matter what compiler you use, all Windows programs require the obligatory:

#include

That's the entry header into all the basic Win32 API stuff needed to write Windows stuff. If one's real savvy, then this line precedes that one:

#define WIN32_LEAN_AND_MEAN

That makes compiles go faster, since it removes lots of less-commonly-used stuff.


0

Response Number 4
Name: Jeff J
Date: May 23, 2002 at 11:32:32 Pacific
Reply:

Bracketted #include lines don't seem to post on this crazy site, so let's just say that line was:

#include "windows.h"

but with the double-quotes replaced with angle brackets.


0

Response Number 5
Name: Kelly
Date: May 23, 2002 at 16:20:40 Pacific
Reply:

Thank you so much for your help. Yesterday I got out my Teach yourself C book that I got at college and started to eat it/feed it to my brain :) it is very tastey, I forgot how much fun I had with C. When I was in college we made simple dos applications, we were not in a computers cource, we were EET (Electronics Engineering Technician) but we were required to have some computer programing under our belts so they gave us this neat book and a whole developemtn kit that came with it, I was the only one in the class that liked it, I seriously think my friend Brook wanted to burn it, he said it was evil. I got a high mark in that class but in the end I got woundering, what good is C if you cant make any graphical GUI progs, Now you just informed me that you can make GUI with C you just got to learn how. So of I go on one of my adventures, hopefully I will learn enough to make a web browser, though I doubt it will sell seing how many web browsers are already out there, many are free. I just got the compiler and free comand line tools you were talking about, cant wait to try them out. I have never compiled from the comand line, I always used the IDE to develop and the menu had a make so it compiled and linked with the point and clik of a mouse, but now that I got this new compiler for win 32 i am going to write my apps with a text editor then compile and link them at comand line, I might learn a thing or two at the same time :) Thank you so much for the help and I will definately try not to get C sick, I am disapointed about my GUI woos and wos with perl as I was hopeing to develop all my apps with perl.

print "\n\x4De and \x4Dy perl:)\n";

I discoverded after useing perl2exe to convert perl scripts into exe files that the exe was way biger then it should be, about 400K for a simple line of text on the screen is a bit much :( oh well, away we go, me and C


0

Related Posts

See More



Response Number 6
Name: Kelly
Date: May 24, 2002 at 12:49:22 Pacific
Reply:

This is so fun, i'm programing a storm in C now and loveing it, it seems a bit more complicated to GUI program in C then the examples I seen in perl but I love it. Eventualy I will try to figure out what went wrong with perl, I don't want to give up, but for now C will do for makeing my GUI, I decided that perhaps a web browser as a first GUI app might be a bit hard for a beginer like me so I am going to try to write a program like evidence eliminator to get me started, if it works I will ofer it as open source under the GPL license because evidence eliminator preforms such simple tasks that they could not posibly ask for money for it. I have a question for you if you are still reading this, do you think I should venture off into C++ eventualy or is C satisfactory, I hered that object oreintated programing produces smaller code, meaning less lines. I took a look the other day at a visual basic tutorial and that looked too easy plus I figured it problably was not very sucure as for not very good at encripting though I dont know till I try, the package is too big for my computer, I have a small HD with 2 gigs :( oh well back to work I go. I mean playing with C :)


0

Response Number 7
Name: Jeff J
Date: May 25, 2002 at 08:16:21 Pacific
Reply:

Definitely extend your C to C++, as C++ contains most everything in C, and just adds more (classes and templates). If you use an object-oriented C++ library, you usually need to write less code yourself, since the C++ headers you #include will contain lots of code themselves. However, I recommend you avoid Micro$oft's MFC, as it's still really old and inefficient. It's gradually being phased out into newer templated stuff, but somehow I don't think you'll even run across it.

There are now 2 different VB formats: VB5/6 which was based on COM (which MS is abandoning), and the newer VB.Net, which is based on MS' Common Language spec. COM-based VB was great for quick and simple GUIs, but almost insane for anything more complex. VB.Net is more like stretching VB to handle .Net's Common Language Runtime (CLR), and it's very complicated and verbose (C# is the much better .Net offering). I shed my last tear over years of COM (and hence VB) experience becoming obsolete. Se la vie...

There are several Windows GUI libs out there, including Borland's VCL, which is included with the BCC you downloaded. It's a great library, and much more efficient than the MFC. If you can ever get your hands on C++Builder 4 or higher, your GUI writing will become absolutely intoxicating, as you can manipulate VCL controls on-screen. However, you'll also need much larger drives!

There are many lesser-known GUI libs that are great, but usually the documentation is poor-to-nil. My current rave (other than the one I wrote/am still writing), is MS' newly-released Windows Template Library (WTL). It's free, based on their venerable ATL, efficient, small, and what MS claims they often use internally. Good stuff, but no documentation yet, and requires modest class and template understanding. Nevertheless:

"http://download.microsoft.com/download/VisualStudioNET/Install/7.0/WXP/EN-US/WTL70.exe"

About 440KB. There are already fan sites popping up about it, explaining its use. Just search for "WTL". Take it from another electronics-to-programming person:

P != E*I

but rather...

P == C | C++


0

Response Number 8
Name: Kelly
Date: June 1, 2002 at 15:42:40 Pacific
Reply:

I have noticed that it is dificult to find tutorials for Win32 API programing strictly for C, whereas the majority of the resources and tutorials are with C++ so today I am starting a tutorial on C++ and at the same time I am continueing to learn GUI programing, I can now write my own small text editor, all it does is open a file for editing and save a file, then i created a about dialog box accessable from a menu, and a version info box. So hapily I am finding it fun and easy. I talked to a few people within the last few days and they also told me to stand clear of mfc. I have a question though, I am finding that computers, especialy computer programing is definately a high interest to me, as a hobby i will always experiment with electronics but now I am seriosly considering becomeing a computer programer or a web developer. Would I need any special cources to get a job as a programer? or would my self taught cources at home be suficiant provideing I can prove my knowledge. I am 19 years old, I do not have a job and I am not in school. I have graduated from college. I enjoy reading online tutorials, texts, papers, articles and any material I can get my hands on. What languages should I know for a job in todays world of computer programing?


0

Response Number 9
Name: mark
Date: July 14, 2002 at 21:58:04 Pacific
Reply:

you haven't installed win32::gui. check out dada.perl.it. isn't much documentation but there's a link to the mailing list. if you get the same message for dynaloader.pm then you haven't installed dynaloader either. for perl modules check out search.cpan.org


0

Response Number 10
Name: upendra singh
Date: July 30, 2002 at 01:53:02 Pacific
Reply:

please send latest features of perl and many more related to perl.

thnaks


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: perl - GUI for Win32 programing

Question Creating GUIs for programs www.computing.net/answers/programming/question-creating-guis-for-programs/5972.html

i need a Perl interpter for XP www.computing.net/answers/programming/i-need-a-perl-interpter-for-xp/4301.html

Test specs needed for a program?? www.computing.net/answers/programming/test-specs-needed-for-a-program/12466.html