Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Injecting a MFC DLL, problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Jesper
Grandmaster Cheater Supreme
Reputation: 9

Joined: 21 Feb 2007
Posts: 1156

PostPosted: Tue Feb 15, 2011 4:56 pm    Post subject: Injecting a MFC DLL, problem Reply with quote

I made a basic DLL using MFC and when I inject it, the target application freezes until I've closed the DLL's window. Anyone know a way to fix this? I've googled for about an hour now, without finding anything helpful.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Tue Feb 15, 2011 5:18 pm    Post subject: Reply with quote

Not much we can do to help you without seeing code. "it dun work" type topics generally never get answered because of this.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Jesper
Grandmaster Cheater Supreme
Reputation: 9

Joined: 21 Feb 2007
Posts: 1156

PostPosted: Tue Feb 15, 2011 5:21 pm    Post subject: Reply with quote

TreeView.cpp
Code:

#include "stdafx.h"
#include "resource.h"
#include "TreeView.h"

CDtreeApp dApp;

BOOL CDtreeApp::InitInstance()
{

CDtreeDlg dlg;
m_pMainWnd = &dlg;
dlg.DoModal();
return TRUE;

}
CDtreeDlg::CDtreeDlg(CWnd* pParent /*=NULL*/) :       CDialog(CDtreeDlg::IDD, pParent)
{
}

BOOL CDtreeDlg::OnInitDialog()
{
   
   CDialog::OnInitDialog();
   CMenu* pSysMenu = GetSystemMenu( FALSE );
   HICON m_hIcon = NULL;
   SetIcon(m_hIcon, TRUE);
   SetIcon(m_hIcon, FALSE);
   HTREEITEM DERP = m_Tree.InsertItem("Derp", TVI_ROOT);
   return TRUE;
}

void CDtreeDlg::DoDataExchange(CDataExchange *pDX)
{
   CDialog::DoDataExchange(pDX);
   DDX_Control(pDX, IDC_PACKETS, m_Tree);
}

TreeView.h
Code:
#include <afxcmn.h>

class CDtreeApp : public CWinApp
{
public:
   BOOL InitInstance();
};
class CDtreeDlg : public CDialog
{
public:
   CDtreeDlg(CWnd* pParent = NULL);
   enum { IDD = IDD_PACKETVIEW };
protected:
   CTreeCtrl    m_Tree;

   virtual void DoDataExchange(CDataExchange* pDX);
   virtual BOOL OnInitDialog();
};
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Tue Feb 15, 2011 5:30 pm    Post subject: This post has 1 review(s) Reply with quote

DoModal is telling the dialog to run specifically in front of any existing parent window. Since you aren't creating this in a separate thread either, this is forcing the parent thread to suspend til your new dialog finishes.

Either create a thread for the dialog to run inside of separate from the main thread, or use a different approach to create the window so that it isn't modal to the parent.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Jesper
Grandmaster Cheater Supreme
Reputation: 9

Joined: 21 Feb 2007
Posts: 1156

PostPosted: Tue Feb 15, 2011 6:08 pm    Post subject: Reply with quote

Got it to work now. Thanks for the help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites