|
Unfortunately, it appears that the optimization switches are still disabled with or without the compiler files in place.
I don't really have any experience with optimized output in the Standard Edition. After looking through one of my Visual C++.NET project files, it looks like Optimization through the Standard IDE is a no-show. Sorry to deliver the bad news.
Happy Programming and may God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
N-Tech Productions
http://www.n-tp.com/
|
|
|
|
|
hi,
I have a "first.dll" ..Now I want to generate C++ code from that DLL.Can I do that?.if possible, pleae send me reply where I can find that..
Thanks.....
|
|
|
|
|
pubba wrote:
Now I want to generate C++ code from that DLL.Can I do that?.
No.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I thought you could back-engineer programs? (mostly not legal)
I wouldn't know how or what though.
Maybe you know what backwards engineering is, because I thought it was creating code from dll's/exe's...?
(and we're learning every day )
tnx.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
V. wrote:
I thought you could back-engineer programs?
Reverse-engineering is possible, but you cannot get C++ code from an EXE or DLL. The best you could hope for is barely-legible assembly.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
There are products that can generate high level code from machine code.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Do tell.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Aside from the site containing lots of broken links, some of which take you to adult-related sites, I saw nothing about producing high-level code as a result of reverse-engineering an EXE or DLL. This might have been a better choice.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Right, ny intention was to provide a starting point for reverse engineering, and since i've seen Mammon's capable contribution to rev eng, it would be a good place to start learning about it.
Wasnt intending to supply a "decompile to C source code" site.
Bikram Singh
|
|
|
|
|
Hello,
This is the second (and last) time I (try) to approach this issue -- I'm posting a second time because I don't quite understand ScrollDC 's mechanics, so please forgive for the (almost) duplicated post.
Righ then, I have this (custom) control which outputs text within a RECT viewport and, at some point in time, there is the need to scroll its contents (either down or up -- always vertically though).
The problem I keep getting is that whenever a window hovers the control, the DC does not scroll the contents properly. Lets imagine the following situation:
My custom control's pos/size: [0,0] - [100, 200] // [x0,y0] - [width,height]
Now imagine a window, say a dialog box, hovering at [75, 60] - [500, 350]
My custom control's DC does not scroll from [75,0] - [100,60] , I keep getting "garbage" on that location
I know I'm doing something wrong here, but I just don't know what.
This is the call I'm doing to the ScrollDC:
DCHandle -> ScrollDC(0, iYScroll, &ViewArea, &ViewArea, NULL, NULL);
iYScroll represents the amount of pixels to scroll up/down
ViewArea is basically the viewport area
Any comments and/or suggestions are welcome.
Thank you for taking the time,
David
|
|
|
|
|
Would you be willing to send me your code so I can look at it? I don't really have time to pull together something which has this scenario and I don't think I can answer your question off the top of my head.
Of course, MSDN doesn't say anything about this situation in ScrollDC, but I did find this comment:
[MSDN]
An application should use the ScrollWindow member function of class CWnd when it is necessary to scroll the entire client area of a window. Otherwise, it should use ScrollDC.
[/MSDN]
ScrollWindow's description in MSDN: "CWnd::ScrollWindow: Scrolls the contents of the client area of the current CWnd object."
ScrollDC's description in MSDN: "CDC::ScrollDC: Scrolls a rectangle of bits horizontally and vertically."
It may be that ScrollDC simply isn't suited for what you are doing, since you probably want the whole client area of your custom control to be scrolled. I'm not sure if using the other function will solve the problem. Give it a try and if it doesn't work I would be willing to look through your code if you would be willing to send it (Alexander@wisemanweb.com).
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
To Hello,
Created dynamically an 2-D array CButtons in the CFormView.
How do you add the message handler?
Thanks.
S1189216G
|
|
|
|
|
Use this macro to map a contiguous range of control IDs to a single message handler function for a specified Windows notification message, such as BN_CLICKED.
ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn )
From the MSDN library
|
|
|
|
|
Hi guys,
On closing my app I got a list of memory leaks in the output window. No problem, I went through the list, double-clicking the code line reference and adding a "delete" for that object. However, I'm left with 1 single frustrating little bugger that doesn't have a code line reference at all:
Detected memory leaks!
Dumping objects ->
{562} normal block at 0x0032D488, 4 bytes long.
Data: < s2 > 10 73 32 00
Object dump complete.
Why does this one not have a code line reference and how do I go about finding it?
Many thanks,
Simon
|
|
|
|
|
Take a look at the _CrtSetBreakAlloc in the MSDN. You can assign this your allocation number (562). So if you run your software the exact same way, you should get a BP when that allocation takes place in your program. You can then use the stack trace to backtrack to the offending code.
If you vote me down, my score will only get lower
|
|
|
|
|
Hi Roger,
Thanks for the reply - this looks exactly what I'm looking for. The only thing is that my allocation number isn't the same every time, even when I run the app in exactly the same way. It shifts between 510 and 520 with the occasional 550 thrown in for good measure! Is there a way around that?
Thanks again for your help,
Simon
|
|
|
|
|
Hi,
i have an mc file containing text in english and korean languages.I have changed my System Locale to Korean and my OS is Windows 2000(English).When i compiled this mc file i am getting all the string ids in .h file.So i was not able to access these ids using FindResourceEx() as it is searching the string table for the ids and my other language id is in .h file.How can i make this fucntion to search in .h file also?Or Is there any other way where i can copy the string ids to string table
Plz help me
Poorni
|
|
|
|
|
Dear Experts,
I am a novice student programmer who is touching Embedded Visual C++ for the first time in my life. (Previously only learnt BASIC and Visual Basic).
Currently, I am involved in this project to this simple pda to pda wireless communication. I am currently stuck at the server side of the communication program. (The client program has been written and tested to be working well).
The problem with the server side is that the program does not seems to execute the OnAccept function of the Listening socket(
although it jolly well could create a socket, listen for connection and seems to make the client program aware of its presence
by enable the client able to establish connection with the server whenever the client is attempting to connect the same port
that the socket is listening to). By not doing so, I am unable to create another client socket for communication. (Came to this
conclusion as neither results I have put in the function has appear when excuted)
I have declared the following Classes:
CServerApp (By default generated)
CServerDlg (By default generated)
CListenSocket (Class for the listening scoket. Base class: CSocket)
CLinkSocket (Class for the Client scoket. Base class: CSocket)
Member Variables (Only for the class CServerDlg, the rest does not have any)
IDC_cmdListen
Function: Listen for connection
Type: CButton
Member: m_bListen
IDC_cmdDisConnect
Function: Disconnect current connection
Type: CButton
Member: m_bDisconnect
IDC_cmdStop
Function: Stop all server service
Type: CButton
Member: m_bStop
IDC_Port
Function: hold the value of the port name
Type: int
Member: m_sPort
IDC_Status
Function: hold the value of the text meant for a status screen
Type: CString
Member: m_sStatus
|
|
|
|
|
#if !defined(AFX_LISTENSOCKET_H__E3F3638D_86D1_4A2D_B54C_87F2197FF509__INCLUDED_)
#define AFX_LISTENSOCKET_H__E3F3638D_86D1_4A2D_B54C_87F2197FF509__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ListenSocket.h : header file
//
#ifndef _LISTENSOCKET_H__
#define _LISTENSOCKET_H__
/////////////////////////////////////////////////////////////////////////////
// CListenSocket command target
class CServerDlg;
class CListenSocket : public CSocket
{
DECLARE_DYNAMIC(CListenSocket);
// Attributes
public:
CListenSocket(CServerDlg* pDlg);
CServerDlg* m_pDlg;
virtual ~CListenSocket();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CListenSocket)
public:
virtual void OnAccept(int nErrorCode);
//}}AFX_VIRTUAL
// Generated message map functions
//{{AFX_MSG(CListenSocket)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
// Implementation
protected:
//virtual void OnAccept(int nErrorCode);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
#endif
// !defined(AFX_LISTENSOCKET_H__E3F3638D_86D1_4A2D_B54C_87F2197FF509__INCLUDED_)
|
|
|
|
|
// ListenSocket.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "ListenSocket.h"
#include "ServerDlg.h"
#include "Server.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CListenSocket
CListenSocket::CListenSocket(CServerDlg* pDlg)
{
m_pDlg = pDlg;
}
// CListenSocket member functions
CListenSocket::~CListenSocket()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CListenSocket, CSocket)
//{{AFX_MSG_MAP(CListenSocket)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
IMPLEMENT_DYNAMIC (CListenSocket, CSocket)
/////////////////////////////////////////////////////////////////////////////
void CListenSocket::OnAccept(int nErrorCode)
{
CSocket::OnAccept(nErrorCode);
m_pDlg->pAccept();
}
|
|
|
|
|
#if !defined(AFX_LINKSOCKET_H__12D75D46_F7FA_4860_B853_6F83CAB47C85__INCLUDED_)
#define AFX_LINKSOCKET_H__12D75D46_F7FA_4860_B853_6F83CAB47C85__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// LinkSocket.h : header file
//
#ifndef _LINKSOCKET_H__
#define _LINKSOCKET_H__
/////////////////////////////////////////////////////////////////////////////
// CLinkSocket command target
class CServerDlg;
class CLinkSocket : public CSocket
{
DECLARE_DYNAMIC(CLinkSocket);
// Attributes
public:
CLinkSocket(CServerDlg* m_pDlg);
CServerDlg* m_pDlg;
virtual ~CLinkSocket();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLinkSocket)
public:
virtual void OnReceive(int nErrorCode);
//}}AFX_VIRTUAL
// Generated message map functions
//{{AFX_MSG(CLinkSocket)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
// Implementation
protected:
//virtual void OnReceive(int nErrorCode);
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif
#endif
// !defined(AFX_LINKSOCKET_H__12D75D46_F7FA_4860_B853_6F83CAB47C85__INCLUDED_)
|
|
|
|
|
// LinkSocket.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "LinkSocket.h"
#include "ServerDlg.h"
#include "Server.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLinkSocket
CLinkSocket::CLinkSocket(CServerDlg* pDlg)
{
m_pDlg = pDlg;
}
/////////////////////////////////////////////////////////////////////////////
// CLinkSocket member functions
CLinkSocket::~CLinkSocket()
{
}
// Do not edit the following lines, which are needed by ClassWizard.
#if 0
BEGIN_MESSAGE_MAP(CLinkSocket, CSocket)
//{{AFX_MSG_MAP(CLinkSocket)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#endif // 0
IMPLEMENT_DYNAMIC (CLinkSocket, CSocket)
void CLinkSocket::OnReceive(int nErrorCode)
{
CSocket::OnReceive(nErrorCode);
m_pDlg->Read(this);
}
|
|
|
|
|
// ServerDlg.h : header file
//
#if !defined(AFX_SERVERDLG_H__68FD52BF_0A0E_4EF9_8F71_52B633DED1A3__INCLUDED_)
#define AFX_SERVERDLG_H__68FD52BF_0A0E_4EF9_8F71_52B633DED1A3__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "afxwin.h"
#include "LinkSocket.h"
#include "ListenSocket.h"
/////////////////////////////////////////////////////////////////////////////
// CServerDlg dialog
class CServerDlg : public CDialog
{
// Construction
public:
CServerDlg(CWnd* pParent = NULL); // standard constructor
struct Packet
{
int packetno;
int cstatus;
char UserID[10];
char Message[20];
};
Packet RPacket;
Packet SPacket;
int State;
CListenSocket* lSocket;
CLinkSocket* eSocket;
CString screen;
void pAccept(void);
void Read(CLinkSocket* eSocket);
// Dialog Data
//{{AFX_DATA(CServerDlg)
enum { IDD = IDD_SERVER_DIALOG };
CButton m_bStop;
CButton m_bListen;
CButton m_bDisconnect;
CString m_sStatus;
int m_sPort;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CServerDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CServerDlg)
virtual BOOL OnInitDialog();
afx_msg void OnHelpInfo();
afx_msg void OncmdDisconnect();
afx_msg void OncmdListen();
afx_msg void OncmdStop();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SERVERDLG_H__68FD52BF_0A0E_4EF9_8F71_52B633DED1A3__INCLUDED_)
|
|
|
|
|
// ServerDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Server.h"
#include "ServerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CServerDlg dialog
CServerDlg::CServerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CServerDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CServerDlg)
m_sStatus = _T("");
m_sPort = 0;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CServerDlg:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
//{{AFX_DATA_MAP(CServerDlg)
DDX_Control(pDX, IDC_cmdStop, m_bStop);
DDX_Control(pDX, IDC_cmdListen, m_bListen);
DDX_Control(pDX, IDC_cmdDisconnect, m_bDisconnect);
DDX_Text(pDX, IDC_Status, m_sStatus);
DDX_Text(pDX, IDC_Port, m_sPort);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CServerDlg, CDialog)
//{{AFX_MSG_MAP(CServerDlg)
ON_WM_HELPINFO()
ON_BN_CLICKED(IDC_cmdDisconnect, OncmdDisconnect)
ON_BN_CLICKED(IDC_cmdListen, OncmdListen)
ON_BN_CLICKED(IDC_cmdStop, OncmdStop)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CServerDlg message handlers
BOOL CServerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
State = 0;
GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> EnableWindow(FALSE);
GetDlgItem(IDC_cmdListen) -> ShowWindow(TRUE);
screen.Empty();
SPacket.packetno = 0;
return TRUE; // return TRUE unless you set the focus to a control
}
void CServerDlg::OnHelpInfo()
{
MessageBox(_T("Help"));
}
//Listen Function
void CServerDlg::OncmdListen()
{
UpdateData(TRUE);
lSocket = new CListenSocket(this);
int Port;
Port = m_sPort;
//char* txtPort;
//int i = m_sPort;
//_itoa(i, txtPort, 10);
//MessageBox(txtPort,NULL,MB_OK);
//If cannot create port
if (!lSocket->Create(Port))
{
MessageBox(_T("No port Created!"), NULL, MB_OK);
return;
}
else
{
}
//If cannot listen
if (!lSocket->Listen())
{
MessageBox(_T("Cannot listen"), NULL, MB_OK);
return;
}
else
{
MessageBox(_T("Listening"), NULL, MB_OK);
GetDlgItem(IDC_cmdListen) -> EnableWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> EnableWindow(TRUE);
State = 1;
}
}
//Accept Function
void CServerDlg::pAccept(void)
{
eSocket = new CLinkSocket(this);
if (lSocket->Accept(*eSocket))
{
State = 2;
MessageBox(_T("Connection Accepted!"), NULL, MB_OK);
GetDlgItem(IDC_cmdStop) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(TRUE);
}
else
{
MessageBox(_T("Connection not Accepted!"), NULL, MB_OK);
delete eSocket;
}
}
// Read Function
void CServerDlg::Read(CLinkSocket* eSocket)
{
CString strcommand;
int pRead = eSocket->Receive(&RPacket, sizeof(Packet));
if (pRead > 0)
{
if (RPacket.cstatus == 0)
{
OncmdDisconnect();
}
else
{
//command = mbstowcs(buffer, RPacket.Message, 100)
}
}
}
void CServerDlg::OncmdStop()
{
GetDlgItem(IDC_cmdListen) -> EnableWindow(TRUE);
GetDlgItem(IDC_cmdDisconnect) -> EnableWindow(FALSE);
SPacket.cstatus = 0;
lSocket->Close();
delete lSocket;
GetDlgItem(IDC_cmdListen) -> EnableWindow(TRUE);
GetDlgItem(IDC_cmdStop)-> EnableWindow(FALSE);
State = 0;
}
// Disconnect Function
void CServerDlg::OncmdDisconnect()
{
SPacket.cstatus = 0;
eSocket->Close();
lSocket->Close();
delete eSocket;
delete lSocket;
GetDlgItem(IDC_cmdDisconnect) -> ShowWindow(FALSE);
GetDlgItem(IDC_cmdStop) -> ShowWindow(TRUE);
State = 1;
}
|
|
|
|
|