Encryption Program (help me please)

This is a discussion on Encryption Program (help me please) within the Windows Programming forums, part of the Platform Specific Boards category; (To the moderators, please change the name to: Encryption Program (help me please), thank you!) I navigate for 4 days ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    45

    Encryption Program (help me please)

    (To the moderators, please change the name to: Encryption Program (help me please), thank you!)

    I navigate for 4 days the web and I haven't found nothing that could help me to solve my problem.

    I re-created a keyboard on the screen, I have 26 buttons (letters form A-Z), two edit controls, one for the text that I write with the keyboard and one for the encrypted text, I also have re-created a second keyboard where I need to display the encrypted letter that in that moment is associated to the letter that I have pressed.

    I thought to use this method: when I press Q button, for example, in the plain text I can read Q(did), in the encrypted I can read J, for example(did), and I have to see in the second keyboard the J letter, but I don't know how I can apply this last thought to my code!
    Here there's the part of code of a pressed button (i.e. Q)

    Code:
    ................
    DDX_Control(pDX, IDC_CHECK1, m_Btn1);
    ................
    ON_BN_CLICKED(IDC_BUTTON_Q, OnBnClickedButtonQ)
    ................
    BOOL CTestDlg::OnInitDialog()
    {
            m_ToolTip.Create(this);
    	m_ToolTip.AddTool( &m_Btn1, IDS_TT_BTN1 );
    ................
            //Set images
    	m_Btn1.SetImage( IDB_Q, 28 );
    ................
            // set the initial state of buttons
    	m_Btn1.Depress(false);
    ................
    }
    
    void CTestDlg::OnBnClickedButtonQ()
    {
    //	keybd_event(VkKeyScan('Q'),0x90,0 , 0); // Q Press
    
    	m_Btn1.Depress(!m_Btn1.IsDepressed()); // when I press 'Q' in the second keyboard I see 'Q' instead of 'J', or another letter
    
    	//=========================
    	//Get the Pressed Letter
    	//=========================
    	LPTSTR item = "Q";
    ................
    ................
    }
    P.S.: on the second keyboard when I press the 'Q' button or other button, I have to see everytime a different letter, there's no a standard association between the pressed letter and the letter displayed in the encrypted field.

    Hope in some important help, because I really don't know how can I do.
    Last edited by Arkanos; 10-24-2005 at 02:32 AM. Reason: Encryption Program (help me please)

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Sorry not sure I understand exactly what you want....

    >>I also have re-created a second keyboard where I need to display the encrypted letter

    You will need to change the letters on the second keyboard each time you change the encryption.

    You must have some form of mapping (1st keyboard 'Q' == 2nd keyboard 'J')

    Use SetWindowText() or SetImage() to change the letters the second keyboard dispalys each time you change the encryption.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    You must have some form of mapping (1st keyboard 'Q' == 2nd keyboard 'J')
    Yeah but I don't know how can I do this, because there's no standard association between the letters, for example:

    First time:
    Q(on the 1st keyb)->Z(on the 2st keyb)
    Second time:
    Q(on the 1st keyb)->A(on the 2st keyb)

    It changes everytime that I press the button....

    I thought to use SetWindowText() or similar in the functions:
    OnBnClickedButtonA()
    OnBnClickedButtonB()
    .........
    .........
    OnBnClickedButtonZ()

    but I'm thinking how!

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    Nothing, I really don' know how can I integrate those functions in the 26 functions of that I create for every buttons of the keyboard!

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    How did you create the buttons?
    resource editor or with CreateWindow()?

    Give the buttons consecutive ID numbers. Edit resource.h as required. This will enable you to have one button handler and just pass in the ID number.

    ie
    'A' = 40000
    'B' = 40001
    ...
    ...
    'Z' = 40025

    Process WM_COMMAND, checking for BN_CLICKED (HIWORD), the LOWORD is the ID number of the button.

    Button pressed can be calculated by subtracting the ID number of the first letter from the LOWORD.
    This can then be used as an index to your array.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    I used the resource editor, I "really" created the button.

    This can then be used as an index to your array.
    But I don't have an array, I have:

    BtnA, BtnB, ........, BtnZ.

    But now I try to encode your way, that's really good!
    Thank you!
    Last edited by Arkanos; 10-26-2005 at 04:02 AM.

  7. #7
    Registered User
    Join Date
    Jul 2005
    Posts
    45
    Process WM_COMMAND
    Unfortunatelly I don't have a sort of "Window Procedure" like 'WndProc' or similar so I don't have WM_COMMAND.

    I'm really freezed on this modification!

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    >>But I don't have an array, I have:

    You should...or some sort of collection to link the data together.

    >>Unfortunatelly I don't have a sort of "Window Procedure" like 'WndProc' or similar so I don't have WM_COMMAND.

    You do. MFC just hides it from you.

    Look at CWnd::OnCommand() (not CButton)

    GET_WM_COMMAND_ID() //windowsx.h
    GET_WM_COMMAND_HWND() //windowsx.h
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Encryption program.... just doesn't work.
    By w00tw00tkab00t in forum C Programming
    Replies: 10
    Last Post: 12-28-2005, 03:38 PM
  2. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  3. Basic encryption program???
    By Finchie_88 in forum C++ Programming
    Replies: 14
    Last Post: 09-10-2004, 09:01 AM
  4. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21