Page 1 of 1

Serial # - Enforcing minimum number of characters typed in

Posted: Tue Jan 23, 2007 4:22 pm
by epohl
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

Posted: Fri Jan 26, 2007 11:48 am
by epohl
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

Posted: Fri Jan 26, 2007 11:51 am
by epohl
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

Posted: Fri Jan 26, 2007 1:44 pm
by Gizm0
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.

Posted: Fri Jan 26, 2007 4:47 pm
by epohl
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