Click here to Skip to main content
15,904,935 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: combobox event in propertypage Pin
Jose Lamas Rios18-Jul-05 5:21
Jose Lamas Rios18-Jul-05 5:21 
GeneralRe: combobox event in propertypage Pin
stevy8218-Jul-05 6:26
stevy8218-Jul-05 6:26 
GeneralRe: combobox event in propertypage Pin
Jose Lamas Rios18-Jul-05 6:51
Jose Lamas Rios18-Jul-05 6:51 
QuestionHow to get mouse events in console application Pin
Bin2Hex15-Jul-05 3:34
Bin2Hex15-Jul-05 3:34 
GeneralSerial number Validation Pin
ovia15-Jul-05 2:23
ovia15-Jul-05 2:23 
GeneralRe: Serial number Validation Pin
Bob Stanneveld15-Jul-05 2:27
Bob Stanneveld15-Jul-05 2:27 
GeneralRe: Serial number Validation Pin
David Crow15-Jul-05 2:41
David Crow15-Jul-05 2:41 
GeneralRe: Serial number Validation Pin
ovia15-Jul-05 2:52
ovia15-Jul-05 2:52 
Hi ,
Thanks for the immediate response . I need to enter 15 digits and it shud check whether the 15 digits are entereed i.e if i try to enter 13 digits it shudn't allow me proceed further . hope you get what i mean . This is actually an install shield which i 'm creating in which i have a user registration dialog in which i will have cust enter serial number so i need a code to check that whether he or she has entered correctly 15 digits

for ex :
// Serial Validation DLL.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"

#define PIDKEY_LENGTH 100
#define DIGIT(a) ((a) - '0')

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
return TRUE;
}

UINT __stdcall ValidateSerial_Sample(MSIHANDLE hInstall)
{

TCHAR szPidKey[PIDKEY_LENGTH];
DWORD dwLen = sizeof(szPidKey) / sizeof(szPidKey[0]);

///retrieve the text entered by the user
UINT res = ::MsiGetProperty(hInstall, _T("PIDKEY"), szPidKey, &dwLen);
if(res != ERROR_SUCCESS)
{
//fail the installation
return 1;
}
bool snIsValid = true;
//validate the text from szPidKey according to your algorithm
//put the result in snIsValid

//the template we use is <###-####> = <xyz-abcd>; # digit between 0 and 9
//the algorithm is very simple (XY * Z + 7) * 13 = ABCD / 2
int xy = DIGIT(szPidKey[0]) * 10 + DIGIT(szPidKey[1]);
int z = DIGIT(szPidKey[2]);
int left = ((xy * z + 7) * 13 ) * 2;
int right = DIGIT(szPidKey[4]);
right = right * 10 + DIGIT(szPidKey[5]);
right = right * 10 + DIGIT(szPidKey[6]);
right = right * 10 + DIGIT(szPidKey[7]);

snIsValid = (left != 0) && (right != 0) && (left == right);
//

TCHAR * serialValid;
if(snIsValid)
serialValid = _T("TRUE");
else
{
//eventually say something to the user
::MessageBox(0, _T("Invalid Serial Number"), _T("Message"), MB_ICONSTOP);

serialValid = _T("FALSE");
}
res = ::MsiSetProperty(hInstall, _T("SERIAL_VALIDATION"), serialValid);
if(res != ERROR_SUCCESS)
{
return 1;
}
//the validation succeeded - even the serial is wrong
//if the SERIAL_VALIDATION was set to FALSE the installation
//willl not continue
return 0;
}


But i need to check for 15 digits . Can you please send the code for this .
Thanking you ,
Ovia
GeneralRe: Serial number Validation Pin
David Crow15-Jul-05 3:06
David Crow15-Jul-05 3:06 
GeneralRe: Serial number Validation Pin
ovia15-Jul-05 21:19
ovia15-Jul-05 21:19 
GeneralRe: Serial number Validation Pin
David Crow16-Jul-05 11:00
David Crow16-Jul-05 11:00 
GeneralDeleting resouce problem Pin
TheDen15-Jul-05 2:22
TheDen15-Jul-05 2:22 
GeneralRe: Deleting resouce problem Pin
David Crow15-Jul-05 2:45
David Crow15-Jul-05 2:45 
GeneralRe: Deleting resouce problem Pin
kreaThor25-Jul-05 0:12
kreaThor25-Jul-05 0:12 
General(ATL/COM/MFC/C++) Q about IE programming Pin
Member 212103815-Jul-05 2:18
Member 212103815-Jul-05 2:18 
GeneralRe: (ATL/COM/MFC/C++) Q about IE programming Pin
fakefur15-Jul-05 8:35
fakefur15-Jul-05 8:35 
GeneralRe: (ATL/COM/MFC/C++) Q about IE programming Pin
Member 212103815-Jul-05 20:16
Member 212103815-Jul-05 20:16 
GeneralPointery Confusion Pin
sroberts8215-Jul-05 2:03
sroberts8215-Jul-05 2:03 
GeneralRe: Pointery Confusion Pin
Bob Stanneveld15-Jul-05 2:29
Bob Stanneveld15-Jul-05 2:29 
GeneralAsm code Generation for a CPP source code Pin
phijophlip15-Jul-05 1:08
phijophlip15-Jul-05 1:08 
GeneralRe: Asm code Generation for a CPP source code Pin
geek15-Jul-05 1:44
geek15-Jul-05 1:44 
GeneralRe: Asm code Generation for a CPP source code Pin
Alexander M.,15-Jul-05 2:05
Alexander M.,15-Jul-05 2:05 
GeneralRe: Asm code Generation for a CPP source code Pin
David Crow15-Jul-05 2:47
David Crow15-Jul-05 2:47 
GeneralADSI/ Extracting NetBIOS name from DNS Pin
AnkurGupta_198114-Jul-05 23:37
AnkurGupta_198114-Jul-05 23:37 
GeneralRe: ADSI/ Extracting NetBIOS name from DNS Pin
Jose Lamas Rios15-Jul-05 4:31
Jose Lamas Rios15-Jul-05 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.