Click here to Skip to main content
16,009,640 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalrun only single instant of application Pin
trioum17-Dec-07 19:00
trioum17-Dec-07 19:00 
GeneralRe: run only single instant of application Pin
Kiran Pinjala17-Dec-07 19:54
Kiran Pinjala17-Dec-07 19:54 
GeneralRe: run only single instant of application Pin
Peter Weyzen17-Dec-07 20:52
Peter Weyzen17-Dec-07 20:52 
GeneralRe: run only single instant of application Pin
Iain Clarke, Warrior Programmer17-Dec-07 23:50
Iain Clarke, Warrior Programmer17-Dec-07 23:50 
GeneralRe: run only single instant of application Pin
David Crow18-Dec-07 3:32
David Crow18-Dec-07 3:32 
QuestionHow to control one application from another application Pin
s196675m17-Dec-07 18:46
s196675m17-Dec-07 18:46 
AnswerRe: How to control one application from another application Pin
CPallini17-Dec-07 21:37
mveCPallini17-Dec-07 21:37 
GeneralHelp regarding MSI serial key validation Pin
anu8117-Dec-07 18:46
anu8117-Dec-07 18:46 
hi all,

I am using ORCA to validate the product key in C# 2005 windows application.

i am using the following C++ code in a dll to be added to the MSI for validation.

UINT __stdcall ValidateSerial(MSIHANDLE hInstall)
{
TCHAR szPidKey[PIDKEY_LENGTH];
DWORD dwLen = sizeof(szPidKey) / sizeof(szPidKey[0]);

///retrieve the text entered by the user
UINT res = MsiGetPropertyA(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 = NULL;
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 = MsiSetPropertyA(hInstall, _T("SERIAL_VALIDATION"), serialValid);
if(res != ERROR_SUCCESS)
{
//fail the installation
return 1;
}

//the validation succeeded - even the serial is wrong
//if the SERIAL_VALIDATION was set to FALSE the installation will not continue
return 0;
}

but when i execute the above code, i am getting the following error.
error LNK2019: unresolved external symbol _MsiSetPropertyA@12 referenced in function "unsigned int __stdcall ValidateSerial(unsigned long)" (?ValidateSerial@@YGIK@Z) CustomAction.obj

i have included <msi.h> and <msiquery.h>

I am a beginner in VC++ and could anybody help me with some suggestions
Thanks in advance.Smile | :)

Regards

Anuradha
GeneralReuse of a existing Dialog Pin
naveen27gupta17-Dec-07 17:31
naveen27gupta17-Dec-07 17:31 
GeneralRe: Reuse of a existing Dialog Pin
Paresh Chitte17-Dec-07 17:54
Paresh Chitte17-Dec-07 17:54 
GeneralRe: Reuse of a existing Dialog Pin
naveen27gupta17-Dec-07 18:16
naveen27gupta17-Dec-07 18:16 
GeneralRe: Reuse of a existing Dialog Pin
Chandrasekharan P17-Dec-07 20:49
Chandrasekharan P17-Dec-07 20:49 
GeneralRe: Reuse of a existing Dialog Pin
naveen27gupta17-Dec-07 22:00
naveen27gupta17-Dec-07 22:00 
GeneralRe: Reuse of a existing Dialog Pin
Chandrasekharan P18-Dec-07 0:30
Chandrasekharan P18-Dec-07 0:30 
GeneralRe: Reuse of a existing Dialog Pin
naveen27gupta18-Dec-07 1:12
naveen27gupta18-Dec-07 1:12 
GeneralRe: Reuse of a existing Dialog Pin
David Crow18-Dec-07 3:34
David Crow18-Dec-07 3:34 
GeneralHelp about read data from a USB Pin
kcynic17-Dec-07 14:51
kcynic17-Dec-07 14:51 
GeneralRe: Help about read data from a USB Pin
Naveen17-Dec-07 17:28
Naveen17-Dec-07 17:28 
GeneralRe: Help about read data from a USB Pin
kcynic17-Dec-07 18:02
kcynic17-Dec-07 18:02 
GeneralRe: Help about read data from a USB Pin
Naveen17-Dec-07 18:13
Naveen17-Dec-07 18:13 
GeneralRe: Help about read data from a USB Pin
kcynic17-Dec-07 18:19
kcynic17-Dec-07 18:19 
GeneralRe: Help about read data from a USB Pin
Naveen17-Dec-07 18:58
Naveen17-Dec-07 18:58 
GeneralRe: Help about read data from a USB Pin
kcynic17-Dec-07 19:06
kcynic17-Dec-07 19:06 
GeneralRe: Help about read data from a USB Pin
Naveen17-Dec-07 19:23
Naveen17-Dec-07 19:23 
GeneralRe: Help about read data from a USB Pin
kcynic17-Dec-07 19:33
kcynic17-Dec-07 19:33 

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.