|
Normally the parent window of the control is notified.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Right, so I would have to handle the event in my CPropertySheet.
Since I do not have a derived CPropertySheet class, I wish to handle it within the view class!
|
|
|
|
|
stevy82 wrote:
Since I do not have a derived CPropertySheet class...
Why not?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Let's say, I have to do it so. You understand?
Okay, now is there a possibility to handle it in the view or not?
|
|
|
|
|
In the CBN_SELCHANGE notification handler, post a message to the view.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
stevy82 wrote:
Right, so I would have to handle the event in my CPropertySheet.
Is the combo a child of the CPropertySheet or is in one of the property pages. If the latter, you can get the notification in your CPropertyPage derived class.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class.
|
|
|
|
|
stevy82 wrote:
It is a child of a property page which is part of a property sheet. I do not have neither a derived sheet class nor a derived page class.
So, why don't you start writing a class derived from CPropertyPage?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that.
Ain't it possible to handle the event within the View?
|
|
|
|
|
stevy82 wrote:
Because I was given the system in the way I mentioned and it is a demand not to create derived classes like that.
I have to wonder why anyone would impose such a restriction...
stevy82 wrote:
Ain't it possible to handle the event within the View?
It might be, but it depends on what other restrictions you might have. Are you allowed to modify source files? Is it ok to write new code or are you only allowed to re-arrange the existing lines?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Of course, I'm allowed to write code
Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on?
I just wonder how to get the CBN_SELCHANGE message passed to the view.
|
|
|
|
|
stevy82 wrote:
Of course, I'm allowed to write code
Oh, good! That's an start
stevy82 wrote:
Which other restrictions (in fact there are no other restrictions than avoiding to create such sub classes) does it depend on?
Who is imposing that restriction? A silly restriction, if you don't mind my sincerity. Is this a real world program, or is it some sort of test? What's the reason for not wanting to derive the CPropertyPage? Please explain that.
stevy82 wrote:
I just wonder how to get the CBN_SELCHANGE message passed to the view.
The easiest and logical way to do it is to derive the page, receive the notification there and pass it to wherever you want or need. It can also be done in other not so direct ways. For example, you might subclass[^] a window, either the combobox itself or its parent page, but perhaps that's against the rules too?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
A silly restriction, if you don't mind my sincerity.
You are right.
Jose Lamas Rios wrote:
Is this a real world program
It is.
Subclassing the combobox? Oh no. Well, I see I won't get it done within the view. I think I should rather occupy with the silly restriction than trying to find a solution.
|
|
|
|
|
stevy82 wrote:
I think I should rather occupy with the silly restriction than trying to find a solution
Sounds like a good plan to me
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I'm using VC6 to build a console app. In it I need to know when the user clicked a mouse button (don't matter where, nor what button was pressed). I followed the MSDN indications and did the following to enable my app to receive mouse input notifications:
HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
SetConsoleMode(hStdIn, ENABLE_MOUSE_INPUT)
Then I check for mouse input this way:
BOOL bOk;
INPUT_RECORD impRec;
DWORD dwReaded;
bOk = ReadConsoleInput(hStdIn, &impRec, 1, &dwReaded);
if (!bOk || dwReaded == 0)
if (impRec.EventType == MOUSE_EVENT_RECORD)
ProcessMouse(impRec.Event.MouseEvent);
The problem is that no mouse notification arrives. In the real code I check also for keyboard events and they are notified ok, but no mouse events.
Can anyone help me on this one?
TIA
|
|
|
|
|
Can anyone please let me know the code for serial number validation that is i want to enter 15 digits and that have to be checked . All the 15 digits are numbers. How do i go around and do that .Please somebody help me out with the code necessary for this .
Thanking you in advance ,
ovia
|
|
|
|
|
Hello,
Try the following:
CString sEnteredSerialNumber = "";
CString sYourHiddenSerial = "";
if( sYourHiddenSerial.CompareNoCase(sEnteredSerialNumber) != 0 )
{
return;
}
return;
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
ovia wrote:
...i want to enter 15 digits and that have to be checked .
Checked for what?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
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
|
|
|
|
|
ovia wrote:
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 .
What about:
BOOL IsSerialNumberValid(...)
{
if (_tcslen(szPidKey) != 15)
return FALSE;
for (int x = 0; x < 15; x++)
{
if (! isdigit(szPidKey[x]))
return FALSE;
}
return TRUE;
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hallo Sir ,
can you please send me the whole program that would be of great halp to me. Please because i really don't know how to insert the sample you have send me . please help me out
Ovia
|
|
|
|
|
The code is useable as it is, just copy and paste it in. Call it like you would any other function. However, after reading the rest of your original post, it's not going to help you that much because of the other validation you require.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hi,
i want to delete the resouce in such a way:
UpdateResource(
m_hModule,
"MY_RES_TYPE",
MAKEINTRESOURCE( IDR_MY_RES1 ),
MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) ,
NULL,
0 );
MSDN:
If lpData is NULL, the specified resource is deleted from the executable file.
GetLastError ===87 — The parameter is incorrect. How can i handle this???
If i do this:
UpdateResource(
m_hModule,
"MY_RES_TYPE",
MAKEINTRESOURCE( IDR_MY_RES1 ),
MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) ,
lpData,
1 );
UpdateResource(
m_hModule,
"MY_RES_TYPE",
MAKEINTRESOURCE( IDR_MY_RES1 ),
MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) ,
NULL,
0 );
everything's going OK but resouce isn't deleted.
|
|
|
|
|
Are you sure that the resource exists? Did you call EndUpdateResource() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|