CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    4

    injected dialogbox problem :(

    Code:
    dllmain()
    {
    ....
    ...
    DialogBox( hModule, MAKEINTRESOURCE(IDD_DIALOGHACK), NULL,(DLGPROC) MenuProcedure);
    ...
    
    ....
    }
    
    BOOL CALLBACK MenuProcedure(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch(message)
        {
              case WM_INITDIALOG:
              {
               return TRUE;
               }
             return FALSE;
        }
    
    }


    Resource Script
    ------------------------------


    Code:
    /////////////////////////////////////////////////////////////////////////////
    //
    // Dialog
    //
    
    IDD_DIALOGHACK DIALOGEX 0, 0, 316, 183
    STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Dialog"
    FONT 8, "MS Shell Dlg", 400, 0, 0x1
    BEGIN
        DEFPUSHBUTTON   "Show/Hide Bombs",ID_BOMBTOGGLE,25,25,74,14
        DEFPUSHBUTTON   "Autowin",ID_AUTOWIN,26,46,72,14
        DEFPUSHBUTTON   "Edit Scoreboard",ID_EDITSCOREBOARD,28,73,69,14
        DEFPUSHBUTTON   "Reset Timer",ID_RESETTIMER,27,99,69,14
        DEFPUSHBUTTON   "Freeze Timer",ID_FREEZETIMER,30,124,69,14
        DEFPUSHBUTTON   "Start Timer",ID_STARTTIMER,27,150,69,14
    END
    
    
    /////////////////////////////////////////////////////////////////////////////

    What it looks like in editor

    http://imageshack.us/photo/my-images/408/captureop.jpg/

    What it looks like when i actually run the program

    http://imageshack.us/photo/my-images...apture1yk.jpg/

    any idea on what im doing wrong or why it looks messed up? thanks

    NOTE: my program is compiled into a DLL and is to be injected at runtime into another application.

  2. #2
    Join Date
    Aug 2009
    Posts
    219

    Re: injected dialogbox problem :(

    You use the latest control styles?

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: injected dialogbox problem :(

    A very typical flaw:
    Code:
    BOOL CALLBACK MenuProcedure(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch(message)
        {
              case WM_INITDIALOG:
              {
               return TRUE;
               }
            
        }
        return FALSE; // must be out if switch scope
    }
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured