Serial # - Enforcing minimum number of characters typed in

Got a problem you cannot solve? Try here.
epohl
Posts: 35
Joined: Tue Nov 28, 2006 10:18 am

Serial # - Enforcing minimum number of characters typed in

Postby epohl » Tue Jan 23, 2007 4:22 pm

Is there an easy way to enforce a minimum number of characters that can be entered in a field before moving on to the next dialog? We have a registration number in the form

XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

I can set a MaxLength of 29 characters on the text field to ensure that it is not too long, but if it's too short I'd like a message box to pop up and say something like "Serial number is not long enough. Please check your typing and re-enter." (OK, something a bit more polite than that, but you get the idea.)

I have seen other posts that mention either creating a plug-in or calling an external DLL, but this seems like overkill for my needs - is there a "string length " call somewhere I could make?

Thanks,

Eric

epohl
Posts: 35
Joined: Tue Nov 28, 2006 10:18 am

Postby epohl » Fri Jan 26, 2007 11:48 am

Update: I tried calling the kernel32.dll function lstrlenA to get the string length, but it didn't work; I got the error "Unable to load plug-in library. Please rebuild your project and make sure all required plug-ins are installed. Action skipped." I suspect this is because I don't have all of the parameters for the Call DLL Function set up exactly right.

Here is the call I'm making in clipboard form:

~InstallAware Clipboard Data~
~Call DLL Function~
~{7D9B000F-F296-47BA-BE84-B47848AA8D70}~
~kernel32.dll,lstrlenA,long,SERIALNUMBERLENGTH,"allocated string buffer (MAX_PATH length)",$SERIALNUMBER$,$~
~~mIDEFunc.dll\\mEXEFunc.dll~ ~

Anyone have a clue on what's going wrong here?

Thanks,

Eric

epohl
Posts: 35
Joined: Tue Nov 28, 2006 10:18 am

Postby epohl » Fri Jan 26, 2007 11:51 am

One more thing: I have tried passing in the string parameter both as an allocated string buffer and as a pointer to string. No luck either way.

Eric

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Fri Jan 26, 2007 1:44 pm

Why don't you split it on X/Total Length textboxes?It's very easy to do it that way.. Look the example shipped with InstallAWARE.
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation

epohl
Posts: 35
Joined: Tue Nov 28, 2006 10:18 am

Postby epohl » Fri Jan 26, 2007 4:47 pm

Mmm, yes, with a little creativity the Parse String command can be used to verify a string length. A bit of a hack perhaps, but it worked.

Thanks,

Eric


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 48 guests