View Full Version : DLLUserInput.dll (my first crack)
RizlaUK
04-23-2007, 12:10 PM
Hi guys,
this is my first crack at making a dll for ams, its quite simple with just a few function but still a usable addition
it features:
a username/password dialog
2 input dialog (like the password but without masked input)
3 input dialog
4 input dialog
you can set the text above each input and the text of the buttons and it will return a table (useing DelimitedStringToTable) that can be used in ams
look in atcions>>startup for the code for the password input, and all other code is in the buttons
C&C Welcome
A problem is that your dialog is not modal.
You can still click on the window behind and it will responde to events,
where it should not do that until you close the dialog.
Dermot
04-23-2007, 12:21 PM
Nice job. :yes The only suggestion I have is to line up the labels with the input fields.
and yes like Bule says, make it modal. Another suggestion, if you pass the Window Handle of the AMS windo to the dll, you can make the dialog a child of the AMS window so that it will always centre to the AMS windown instead of the screen.
mz241508
04-23-2007, 02:51 PM
Great job RizlaUK, i also agree with the modal window. :yes
RizlaUK
04-23-2007, 04:09 PM
thanks guys......modal window, ok after 3 or 4 hours of searching im still getting nowhere, PureBasic cant make modal windows with out code that i dont yet understand, i can make a window created by a pb window modal but i cant make a window called from the dll modal, im stuck and my patience is running out fast, the help file is somewhat lacking in information and the user forum (phpbb) has a very poor search function............the search continues....
RizlaUK
04-23-2007, 05:04 PM
if you pass the Window Handle of the AMS windo to the dll, you can make the dialog a child of the AMS window so that it will always centre to the AMS windown instead of the screen.
i have that part working ok, i am trying to disable the ams window by useing the same method but im getting nowhere fast.....any pointers ??
Dermot
04-23-2007, 05:07 PM
Just use EnableWindow_(WinHandle, #False) where WinHandle is the handle of the AMS window.
Very important to use EnableWindow_(WinHandle, #True) when the dialog closes, otherwise the AMS window will be unuseable.
Intrigued
04-23-2007, 05:36 PM
Right on guys! PB & AMS!
:yes
ps. if we all put DLL or EXE (which ever pertains) in our posts (I prefer the Subject)... it will make it easy for us to search for them later.
RizlaUK
04-23-2007, 06:08 PM
dam, iv been trying all night using DisableWindow in every form i could find, it would disable a window created with another pb window but not the dll window, i guess that one is local only
Cheers Dermot :yes "EnableWindow_(WinHandle, #False)" works a dream
heres an a update,
text now aligned with inputboxes
dialogs will now appear center of the app no matter where it is on screen
all dialogs are now modal (phew)
now im off to see what other goodies i can come upwith ;)
Intrigued
04-23-2007, 06:25 PM
RizlaUK, I can see you creating SDK style plugins in a few weeks, months.
:yes
Intrigued
04-23-2007, 06:29 PM
So, when the user/pass dialog goes away (they entered the wrong info) they do not see the AMS Window and/or outline even!
Adjust the On Startup code (scroll to see in-bold text change):
-- title text
title = "My Password Input (coed in project startup)"
-- username text
usertext = "Enter Username (user)"
-- password text
passtext = "Enter Password (pass)"
-- submit button
Submit = "Submit"
-- cancel button
Cancel = "Cancel"
-- call the dll
result = DLL.CallFunction("AutoPlay\\Docs\\DLLUserInput.dll", "ShowPassInput", "\""..title.."\",\""..usertext.."\",\""..passtext.."\",\""..Submit.."\",\""..Cancel.."\","..Application.GetWndHandle(), DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
-- check cancel was not clicked
if result ~= "0" then
-- convert the string to a table
tbResults = DelimitedStringToTable(result,"|");
-- define the username and password
User = "user"
Pass = "pass"
--check if the user and pass was the a match
if tbResults[1] == "user" and tbResults[2] == "pass" then
blnOK = true
else
blnOK = false
Dialog.Message("Notice", "Wrong username or password, exiting application", MB_OK, MB_ICONNONE, MB_DEFBUTTON1);
end
end
-- if user and pass dident match then exit app
if blnOK ~= true then
Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE)
end
Intrigued
04-23-2007, 06:52 PM
I mirrored your offering at www.amsuser.com:
www.amsuser.com/ams/examples/DLLUserInput-AMS6-RizulaUK.apz
Thanks for sharing.
RizlaUK
04-23-2007, 07:31 PM
thats better, i hated that flick of the app i was getting but ran out of steam and decided to leave it as it was
and cheers for the mirror, its nice to know my first dll is worthy of hosting :yes
Intrigued
04-23-2007, 07:35 PM
No problem on both counts.
I'm looking forward to seeing more from you on the .dll front.
:yes
CyberRBT
04-23-2007, 09:28 PM
@ RizlaUK:
Congratulations. Great Work !!! And ... it fills an existing need.
BTW, it is amazing to me that having no Basic programming or Windows API programming experience that you did this as your first project. Nice! My first one was 25 years ago in 8080/Z80 Assembly and it took me 3 days to figure out how to display 'Hello World' on a console screen (MASM 1.0 and DOS 1.0).
Bravo! :yes You definitely have a talent for this.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.