|
Suggestion 1.
1> Use ATL instead of MFC and don't link to libraries you don't really need.
Suggestion 2.
1) Dynamically link your program with the MFC library. This will give you a minimum reduce of at least 2031%.
2) Go to Project Settings dialog.
3) Click the 'C/C++' tab.
4) In the 'Optimizations' combo box, choose 'Minimize size'. Click OK to close this dialog. The file size is decreased now
5) Build and compile your executable.
Now check the file size.
Suggestion 3.
Download and use some tool to decrease the size of your exe.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: Dynamically link your program with the MFC library.
PLease tell me how can i dynamically link.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
IF you are using VS 2005, then go to Project>Properties. Under this go to Configuration properties>General option. Under "project defaults" change to "Use MFC in a Shared DLL"
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
By building your application in "Win32 Release MinSize" mode.
|
|
|
|
|
Have you embedded lot of bitmaps in your application??
Regards,
Sandip.
|
|
|
|
|
I have used 10 images in my application and total size of all images are 1.81MB.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: total size of all images are 1.81MB.
This is one of the reasons of bigger executable size. I don't think you can do anything about it. You can try reducing the size as mentioned in other replies. Also try to remove incremental link option.
Check following links for more options
Techniques to reduce exe size[^]
Reduce the size of your final exe[^]
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
Are you using Release setting to build? Or Debug?
Do you have any images (BMPs) added to the resource?
- ns ami -
|
|
|
|
|
I m using Release setting to build and I have used 10 images in my application and total size of all images are 1.81MB.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If possible, it is better to keep the images separately (as image files along the exe) and load them when required at runtime.
- ns ami -
|
|
|
|
|
How can i set image on buttons at runtime.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: How can i set image on buttons at runtime.
Use LoadImage() instead of LoadBitmap() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
HI,
Currently i am signing my code binaries with the help of microsoft signing tool(signtool). But now i am tring to add two digital signature to the binary. Can any one will help me to find out any solution.
Thanks in advance.
birajendu
CyberG India
Delhi
India
|
|
|
|
|
I want to Bring a window to top. I am using BringWindowToTop() function. But its not working.How can i do it.
|
|
|
|
|
I have no idea what you mean by "it is not working". Did you check the return value of the function? The documentation says that if the function returns zero, you can check why the function failed by calling GetLastError()[^].
You could try SetForegroundWindow()[^] as well.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Please refer SetWindowPos with parameter HWND_TOPMOST . Is this helpful ?
Regards,
Paresh.
|
|
|
|
|
Is the library used for using RPC function in Visual Studio 2008 is RpcRT4.lib?.If not plz specify the excat one .
Thanks & Regards
VIJITH VIJAYAN
|
|
|
|
|
It was in Visual Studio 2003 - that was the last visual studio where I used MS-RPC.
Looking at the Platform SDK that's installed with Visual Studio 2008 (its default install location in in c:\program files\Microsoft SDKs\Windows\), it's still rpcrt4.lib.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am writing a simple (well, not for me =) ) C++ program that consist of using loops to make a game of paper, rock, and scissors for two players.
My question is:
How do I set up the game for two players? Do I use a char player1 char player2 style of syntax formatting? I just need something to start with here. I understand the loops and the game. I just do not know how to set two seperate players that with be making cin>> inputs.
Thanks!
-Nate
|
|
|
|
|
You can have your program ask whose turn, as:
C:\game.exe
Game starts!
Player-A: format = (value, x, y) <-- playser A's turn to input
3, 1, 1
Status:
3 0 0
0 0 0
0 0 0
Player-B: format = (value, x, y) <-- player B's turn to input
5, 3, 1
Status:
3 0 5
0 0 0
0 0 0
......
Maxwell Chen
|
|
|
|
|
Hello,
i want to embed a dialog in an SDI Window. I created a new SDI project
without Doc/View architecure. Then created a new dialog, disabled the border,
system menue etc.. Now, in the designer the dialog looks like en empty gray plane.
I also added a class to this dialog derived from CDialog. I did this with the designers help,
right click on the dialog and "add class".
My goal is to embed this dialog in the ChildView window and make it as large as the ChildView
window. I found an example here on code project thats similiar to my problem but anyway it
doesn't meet my requirements.
So, how can I embed this dialog in the SDI application?
best regards,
cmos
|
|
|
|
|
First:
// Simple MDI child.
class MDIChildWnd : public ClsMDIChildWindow
{
_NO_COPY( MDIChildWnd );
public:
// Construction/destruction.
MDIChildWnd() {;}
virtual ~MDIChildWnd() {;}
// Create a child.
BOOL Create( ClsString& str, ClsMDIMainWindow *pFrame )
{
// We let the base create it for us. This will automatically call the
// OnMDINCCreate() overidable in which we do our thing...
ClsRect rc( CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT );
// Create it.
BOOL bMaximized; if ( pFrame->MDIGetActive( &bMaximized ) == NULL ) bMaximized = TRUE;
return ClsMDIChildWindow::Create( str, WS_VISIBLE | ( bMaximized ? WS_MAXIMIZE : 0 ), rc, pFrame );
}
protected:
// Handle the WM_CLOSE messages.
virtual LRESULT OnClose()
{
// Destroy the window.
MDIDestroy();
return 0;
}
// WM_SIZE handler.
virtual LRESULT OnSize( UINT nSizeType, int nWidth, int nHeight )
{
...........
// Base class.
return ClsMDIChildWindow::OnSize( nSizeType, nWidth, nHeight );
}
// WM_MDICREATE handler.
virtual LRESULT OnMDINCCreate( LPCREATESTRUCT pCS )
{
// Make sure the child has a client edge. NOTE: Simply adding this
// bit to the CREATESTRUCT.dwExStyle will not work...
//
// We do it here like this also because the PreCreateWindow() overide
// will not be called when creating MDI child windows.
ModifyExStyle( 0, WS_EX_CLIENTEDGE );
return TRUE;
}
};
|
|
|
|
|
Second:
// Simple MDI frame.
class MDIFrame : public ClsMDIMainWindow
{
_NO_COPY( MDIFrame );
public:
// Construction/destruction.
MDIFrame() {;}
virtual ~MDIFrame() {;}
protected:
// A child window has been closed.
void OnMDIChildRemoved( ClsMDIChildWindow *pWnd )
{
// Look it up in our array.
for ( int i = 0; i < m_Children.GetSize(); i++ )
{
// Is this the one?
if ( m_Children[ i ] == reinterpret_cast<mdichildwnd>( pWnd ))
{
// Free it and remove the entry
// from the array.
delete pWnd;
m_Children.RemoveAt( i, 1 );
break;
}
}
}
// We do not want the system to erase the background of
// the frame window.
virtual LRESULT OnEraseBkgnd( ClsDC *pDC )
{
return 1;
}
// WM_CLOSE handler.
virtual LRESULT OnClose()
{
// Make sure the children are all destroyed.
while ( m_Children.GetSize()) m_Children[ 0 ]->MDIDestroy();
PostQuitMessage( 0 );
return 0;
}
// WM_SIZE handler.
virtual LRESULT OnSize( UINT nSizeType, int nWidth, int nHeight )
{
// Size the splitter which will in turn size and
// move it's panes.
ClsRect rc, tb;
GetClientRect( rc );
// Does it exist already?
if ( m_Toolbar.GetSafeHWND())
{
// Pass the message on to the toolbar.
m_Toolbar.SendMessage( WM_SIZE, nSizeType, MAKELPARAM( nWidth, nHeight ));
// Adjust client rectangle.
m_Toolbar.GetWindowRect( tb );
rc.Top() += tb.Height();
}
// Setup splitter rectangle. This will automatically
// resize and reposition the panes aswell.
m_Splitter.SetSplitRect( rc );
m_Splitter.RedrawPanes();
return 0;
}
// WM_CREATE overidable.
virtual LRESULT OnCreate( LPCREATESTRUCT pCS )
{
// First the base.
if ( ClsMDIMainWindow::OnCreate( pCS ) == -1 )
return -1;
// Create file/dir treeview.
ClsRect rc( 0, 0, 0, 0 );
if ( m_Tree.Create( this, rc, IDC_FILEDIRTREE, WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS ))
{
// Setup the tree.
m_Tree.ModifyExStyle( 0, WS_EX_CLIENTEDGE );
m_Tree.FileFilter() = _T( "*.c;*.cpp;*.h;*.hpp;*.txt" );
m_Tree.DoubleBuffer() = TRUE;
m_Tree.LoadingTextColor() = RGB( 255, 0, 0 );
if ( m_Tree.SetupTree())
{
// Create splitter.
if ( m_Splitter.Create( this, 0 ))
{
// Setup the splitter and it's panes.
m_Splitter.SetPanes( m_Tree, GetMDIClient()->GetSafeHWND());
m_Splitter.SetPaneMinSize( 100, 100 );
m_Splitter.SetSplitterPosition( 200 );
// Load the menu.
if ( m_Menu.Load( MAKEINTRESOURCE( IDR_MENU )))
{
// Set it up.
m_Menu.ConvertMenus();
MDISetMenu( &m_Menu, m_Menu.GetSubMenu( 0 ));
DrawMenuBar();
// Create toolbar.
if ( m_Toolbar.Create( this ))
// Ready to go...
return 0;
}
}
}
}
return -1;
}
// WM_COMMAND overidable.
virtual LRESULT OnCommand( UINT nNotifyCode, UINT nCtrlID, HWND hWndCtrl )
{
// A toolbar button?
if ( nCtrlID >= IDT_NEW && nCtrlID <= IDT_FULLSCREEN )
{
// Was it the exit button?
if ( nCtrlID == IDT_EXIT )
SendMessage( WM_CLOSE );
else
{
// Do somthing stupid like telling you
// what button you clicked (like you don't know yourself...)
TBBUTTONINFO tbi;
tbi.cbSize = sizeof( tbi );
tbi.dwMask = TBIF_LPARAM;
if ( m_Toolbar.GetButtonInfo( nCtrlID, tbi ))
{
ClsString str;
str.Format( _T( "You clicked the \"%s\" button on the toolbar!" ), tbi.lParam );
MessageBox( str, _T( "MDI Sample" ), MB_ICONINFORMATION | MB_OK );
}
}
}
// Closeup on selecting Exit from the menu.
else if ( nCtrlID == IDM_EXIT )
SendMessage( WM_CLOSE );
// Base class.
return ClsMDIMainWindow::OnCommand( nNotifyCode, nCtrlID, hWndCtrl );
}
// Data.
ClsArray<mdichildwnd> m_Children;
ClsSplitter m_Splitter;
Toolbar m_Toolbar;
FileDirTree m_Tree;
ClsXPMenu m_Menu;
};
|
|
|
|
|
|
Hi,
1) Is it possible to add additional textbox control (or a button) to all open/save file dialogs in winXP and vista?
2) Is it possible to replace them with my application?
Regards,
Gilvini
|
|
|
|