|
I have a project that is taking WAAAAYYYY too much time to compile... ( IMHO )
all files are C++ and are using precompile headers.
I use Program Database ( Zi ), minimal build ( and link ).
the only thing that I'm not sure, is that some of my source files are in subfolders of the main project file, and do
#include "../stdafx.h"
can that be a problem ?
also, there's a vc7.idb and vc7.pdb that are created ( and recreated ) quite often, I assume that the .pdb is the program database, but is it supposed to be recreated at every couple of files ?
THanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
With minimal build and link enabled, it can take longer and longer to compile and link because certain files are hashed, instead of being rewitten every time. You might try a FULL rebuild (or rebuild all) periodically to keep this thrashing to a minimum. I see this same problem with VC 6.0 when I have incremental link enabled.
The PDB must correlate the lines in your source with the locations on the executables, so it is common for that to rebuild each time you recompile and relink.
|
|
|
|
|
BOOL Cfirstw32mfcApp::InitInstance()
{
SetRegistryKey(_T("Natural_Demon"));
...
..
..
}
this works perfect ...
the data retrieved from the registry is nicely update in the GUI
BOOL Cfirstw32mfcDlg::OnInitDialog()
{
..
...
...
..
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
return FALSE; // return TRUE unless you set the focus to a control
}
this works perfectly ...
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
AfxGetApp()->WriteProfileString("Settings", "email", "hi");
AfxGetApp()->WriteProfileString("Settings", "password", "do");
return NULL;
}
but why doesn't this work ...?
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(FALSE);
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
return NULL;
}
if i do this ...
UpdateData();, UpdateData(FALSE); or this UpdateDialogControls(this, FALSE);
nothing works
EDIT1 en EDIT2 are empty and the registry get's updated with empty values.
where am i mistaking here?
thnx in advance.
kind regards,
marco
|
|
|
|
|
Your Data Exchange handler function might not be set up correctly.
The Data Exchange might be overwriting the data in your edit field controls, or no member variables are setup to write into the controls.
It looks like you fill them in OnInitDialog, but you should do that in DoDataExchange.
|
|
|
|
|
this is what i got and all those intents u see in code don't work
thank for your time and kind regards,
marco
// firstw32mfcDlg.h : header file
//
#pragma once
// Cfirstw32mfcDlg dialog
class Cfirstw32mfcDlg : public CDHtmlDialog
{
// Construction
public:
Cfirstw32mfcDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_FIRSTW32MFC_DIALOG, IDH = IDR_HTML_FIRSTW32MFC_DIALOG };
CString EDIT1;
CString EDIT2;
CString m_EDIT1;
CString m_EDIT2;
CString m_TEMP_EDIT1;
CString m_TEMP_EDIT2;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
HRESULT OnButtonOK(IHTMLElement *pElement);
HRESULT OnButtonCancel(IHTMLElement *pElement);
//HRESULT OnChangeEdit1(IHTMLElement *pElement);
//HRESULT OnEnChangeEdit2(IHTMLElement *pElement);
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
DECLARE_DHTML_EVENT_MAP()
public:
//char m_EDIT1;
//char m_EDIT2;
//afx_msg void OnEnChangeEdit1();
//afx_msg void OnEnChangeEdit2();
};
-----------------------------------------------
// firstw32mfcDlg.cpp : implementation file
//
#include "stdafx.h"
#include "firstw32mfc.h"
#include "firstw32mfcDlg.h"
#include ".\firstw32mfcdlg.h"
//#include <atlbase.h>
//#include <afxpriv.h>
#include <oleauto.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// Cfirstw32mfcDlg dialog
BEGIN_DHTML_EVENT_MAP(Cfirstw32mfcDlg)
DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK)
DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel)
//DHTML_EVENT_ONCHANGE(_T("email"), OnChangeEdit1 )
//DHTML_EVENT_ONCHANGE(_T("password"), OnEnChangeEdit2 )
END_DHTML_EVENT_MAP()
Cfirstw32mfcDlg::Cfirstw32mfcDlg(CWnd* pParent /*=NULL*/)
: CDHtmlDialog(Cfirstw32mfcDlg::IDD, Cfirstw32mfcDlg::IDH, pParent)
//, m_EDIT1(0)
//, m_EDIT2(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void Cfirstw32mfcDlg::DoDataExchange(CDataExchange* pDX)
{
CDHtmlDialog::DoDataExchange(pDX);
DDX_DHtml_ElementInnerText(pDX, _T("email"), EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("password"), EDIT2);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text1"), m_EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text2"), m_EDIT2);
}
BEGIN_MESSAGE_MAP(Cfirstw32mfcDlg, CDHtmlDialog)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// Cfirstw32mfcDlg message handlers
BOOL Cfirstw32mfcDlg::OnInitDialog()
{
CDHtmlDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 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
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
UpdateData(FALSE);
return FALSE; // return TRUE unless you set the focus to a control
}
void Cfirstw32mfcDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDHtmlDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void Cfirstw32mfcDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<wparam>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDHtmlDialog::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR Cfirstw32mfcDlg::OnQueryDragIcon()
{
return static_cast<hcursor>(m_hIcon);
}
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(TRUE);
//CString strEmail = SysAllocString(GetElementText( _T("email")));
//CString strEmail = GetWindowText(EDIT2);
//AfxGetApp()->WriteProfileString("Settings", "email", strEmail);
/*
BSTR bstr = SysAllocString(GetElementText( _T("email")));
CStringW str = bstr;
SysFreeString(bstr);
*/
if(!GetElementText( _T("email")))
{
m_EDIT1=("FALSE");
UpdateData(FALSE);
}
else
{
m_EDIT1=("TRUE");
UpdateData(FALSE);
}
BSTR bstr = SysAllocString(GetElementText( _T("email")));
CString str = CString(bstr);
SysFreeString(bstr);
m_EDIT1=str;
UpdateData(FALSE);
CString strEmail = "email";
AfxGetApp()->WriteProfileString("Settings", "email", str);
//AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
//AfxGetApp()->WriteProfileString("Settings", "email", );
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//UpdateData(FALSE);
return NULL;
}
HRESULT Cfirstw32mfcDlg::OnButtonCancel(IHTMLElement* /*pElement*/)
{
UpdateData();
if(m_EDIT1)
{
AfxGetApp()->WriteProfileString("Settings", "email", m_EDIT1);
}
else
{
m_EDIT1=_T("i failed");
UpdateData();
}
if(m_EDIT2)
{
AfxGetApp()->WriteProfileString("Settings", "password", m_EDIT2);
}
else
{
m_EDIT2=_T("i failed too");
UpdateData(FALSE);
}
//UpdateData(FALSE);
return NULL;
/*
GetElementText(_T("email"));
if(GetElementText(_T("email")))
{
EDIT1=_T("works");
}
else
{
EDIT1=_T("it doesn't work");
}
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
GetElementText(_T("password"));
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
OnCancel();
return S_OK;
//return 0;
*/
}
//HRESULT Cfirstw32mfcDlg::OnChangeEdit1(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// //AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
// //AfxGetApp()->WriteProfileString("Settings", "email", "gsdsgj");
//return FALSE;
//}
//HRESULT Cfirstw32mfcDlg::OnEnChangeEdit2(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// ///AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//return FALSE;
//}
|
|
|
|
|
You should be able to do all your data sets and retrievals within the DoDataExchange
similar to something like this:
void Cfirstw32mfcDlg::DoDataExchange(CDataExchange* pDX)
{
CDHtmlDialog::DoDataExchange(pDX);
// data TO controls, means LOAD strings with your existing data or default values
// you need to do this BEFORE the DDX_DHtml_ElementInnerText calls
if( !pDX->m_bSaveAndValidate ){
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
}
// these calls presumably set or get the data from the controls into your string variables
DDX_DHtml_ElementInnerText(pDX, _T("email"), EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("password"), EDIT2);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text1"), m_EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text2"), m_EDIT2);
// data FROM controls, means SAVE data from the controls to your storage
// you need to do this AFTER the DDX_DHtml_ElementInnerText calls
if( pDX->m_bSaveAndValidate ){
GetElementText(_T("email"));
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
GetElementText(_T("password"));
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
}
}
If the DoDataExchange is correctly implemented, you don't even need to have the OnOK handler, since the DoDataExchange will be called for you (I am pretty sure) and you definitely don't need the Cancel, because the UpdatData (and thus DoDataExchange) is not called at all.
|
|
|
|
|
How do you determine the column on a listCtrl when you say double-click on the list.
I use the following to find the row:-
POSITION p = m_cAList.GetFirstSelectedItemPosition ();<br />
int row = m_cAList.GetNextSelectedItem (p);
I did think the use GetSelectedColumn() but GetSelectedColumn() gives the error:-
c:\C_Example\GenericDlg.cpp(602): error C2039: 'GetSelectedColumn' : is not a member of 'CListCtrl'
I have the listCtrl setup as a table with grid lines on and was going to use:-
int col = m_cAList.GetSelectedColumn();<br />
int index = (row * 16) + col;
To obtain the position in the table.
Help?!?
|
|
|
|
|
Do you have a handler for the NM_DBLCLK message? If so, look at the iItem and iSubItem members of the NMITEMACTIVATE structure that is sent to the handler function.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Getting a bit lost here, Yes do have a handler for the double-click on the listCtrl:-
void CGenericDlg::OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
<br />
POSITION p = m_cAList.GetFirstSelectedItemPosition ();<br />
m_cAList.GetNextSelectedItem (p);<br />
int row = m_cAList.GetNextSelectedItem (p);
Just wanted to know how to get the column here.
But if I now do (I think this is what you suggested)
NMITEMACTIVATE *lpnmitem = (LPNMITEMACTIVATE) pNMHDR;<br />
<br />
int col = lpnmitem->iSubItem;<br />
<br />
int row = lpnmitem->iItem;
Here the col is OK but the row is always set to -1.
|
|
|
|
|
sweep123 wrote:
Just wanted to know how to get the column here.
ASAIK, you cannot find both row and column this directly. Use GetNextSelectedItem to retrieve the selected item index (the 'row') and the pNMHDR to retrieve the 'column' (as you did in your second method).
As for
sweep123 wrote:
Here the col is OK but the row is always set to -1.
-1 is the normal return value if you consider a subitem (see MSDN:
iItem Index of the list view item. If the item index is not used for the notification, this member will contain -1.)
-> you can only get information about one item _OR_ one subitem. Your list ctrl is not a grid, it is indeed a list.
~RaGE();
|
|
|
|
|
I did manage to get the row and col of a list control by putting the option LVS_EX_FULLROWSELECT on for the list control, but it looks a little messy with one whole row selected. When I turn this setting off I aways get -1 for the row (item) and thats with GetNextSelectedItem() and pNMHDR methods.
I dont know a better way to get both the row and col of a list control.
I am sure someone will know of a neater solution.
grahamfff
|
|
|
|
|
Hi all
How can remove window boarder,caption ,minimize maximize and close button.
infact i want to keep only and only client area of the window using win32 api.
can any body help me with code.
|
|
|
|
|
Are you using CreateWindow() ? Try using WS_POPUP | WS_VISIBLE as the third parameter.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi David.
well this code i think wil work for those window which will be created by createWindow().( i will check this in short while)
but my problem is not that .what iwant is i want to remove all these decoration stuff(caption,window freame , min,max,close etc) against any click .and again against some even i want these decoration should back.
and i have to implement this for any window either made my application or some othere application which is already runing .
After getting handler of other process window i want to implement this remove/add decoration functionality .
say for example :i want to add/remove decoration of WindowMedia player.
pl see if you can hekp me.
Regards.
Harris.
|
|
|
|
|
Not all styles can be added/removed at runtime.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hey Friends
I have created an application which dials out a number and plays a .wav file.Now i need to test the application but on my current premises, I do not have a Phone Line.
Is there any way by which i can test my application without Phone Line and Modem ?
|
|
|
|
|
You can use one of these.
www.teltone.com
http://www.teltone.com/products/simulators/tls3/home.htm
Teltone's TLS-3B is an inexpensive simulator that makes it easy to perform basic feature and performance testing of telecommunications equipment including:
Telephones
Modems
Faxes
Caller ID equipment
Anything that connects to a phone line!
The TLS-3B is Teltone's lowest-cost unit. You plug in a phone to one of the two ports, and you will think you are connected to the phone company! Dial the default or programmed phone number, and the other line will ring. It's like having a miniature public telephone network in a box.
The TLS-3B has programmable functions which allow you to configure features like caller ID, test tones, and hot line ringdown.
That's what I used to do.
|
|
|
|
|
Hi
I have some memory leaks in my application.
I found the functions which gives me memory dumps. I use _CrtDumpMemoryLeaks() function but it gives output on standard console...Where as I want it in one text file. Can any one help me how to do that....
Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Hello
I want to make a wizard like the once in Access where we can find the path and select a database then the table and then the fields we want to work with..Is it possible?
Like is there any kinda ActiveX controll or some software I really would like to know..So if you know please tell me..
Thank you very much..
Have a nice day!
|
|
|
|
|
Right here...
http://www.codeproject.com/property/simplepropertywizard.asp
|
|
|
|
|
I have created 2 sockets .
I fr my server application <192.168.2.20> port 80
I fr my client. IP Address assigned: 192.168.0.51 port 80
Both The applications reside on the same machine.
When I execute the server it runs fine
But when I run the Client , it shows error code : 10047
Yeah, After surfing the net I got to know that Protocol family not supported ...
But the problem iz........
Unless the Connection is not established between the two applications
how come it give such error.
What Can there be other possibilities?
The portion causing error is Enclosed.
With hope to recv earliest suggestions i Thnx in Advance.
int main()<br />
{<br />
::<br />
::<br />
sock_creation();<br />
::<br />
::<br />
}<br />
<br />
int sock_creation()<br />
{<br />
int rc,k;<br />
struct sockaddr_in addr;<br />
char *servername;<br />
struct WSAData wsaData;<br />
printf("\n Count 10 n Resume ...\n");<br />
int wsaret=WSAStartup(0x101,&wsaData);<br />
if(wsaret<0) <br />
{<br />
printf("Unable to Initialize Windows Socket Library");<br />
k=getch();<br />
exit(1);<br />
}<br />
<br />
else <br />
{<br />
printf("\n Initialized Windows Socket Library");<br />
<br />
}<br />
<br />
<br />
conn=socket(AF_INET,SOCK_STREAM,0);<br />
servAddr.sin_addr.s_addr=inet_addr("192.168.0.51");<br />
servAddr.sin_port=htons(u_short(8080));<br />
<br />
<br />
if(conn==INVALID_SOCKET)<br />
{<br />
printf("\n But Unable to Initialize Windows Socket");<br />
k=getch();<br />
exit(1);<br />
}<br />
else <br />
{<br />
printf(" \n Initialized Windows Socket As Well.....");<br />
<br />
}<br />
if(bind(conn,(sockaddr*)&servAddr,sizeof(servAddr))!=0)<br />
{<br />
printf("\n But Failed to bind !!! Error Code %d\n ",WSAGetLastError());<br />
k=getch();<br />
exit(1);<br />
}<br />
<br />
<br />
servAddrSrvr.sin_addr.s_addr=inet_addr("192.168.0.20");<br />
servAddrSrvr.sin_family=AF_INET;<br />
servAddrSrvr.sin_port=htons(80);<br />
<br />
return 0;<br />
}<br />
amit mishra
|
|
|
|
|
Seems you are trying to bind the client socket also at port 80 which is not necessary .You can not bind two sockets on a same port ( exceptions are there but you wont need it )
So do this way ...Create a server socket , bind it to port 80 of you IP and make it listen for incomin connections . Next create a client socket . *Dont* bind it toany port (or bind it to non-80 port ) and connect toserver at 80 ...
Dharani Babu S
redindian
|
|
|
|
|
Thnx fr guiding me . This being my fst attempt in socket prg.
Yeah i cud move ahead all bcoz of u , but caught again midway.
In my server program when i use recv() it gives the failed to bind and failed to listen errors. When i m trying to print the acceptance after the accept function it shows the connection. That <client ip="" address="" is="" connected="">
On other side When i use recv fn in Client application some garbage is printed in . I use it like
<br />
{<br />
<br />
char buff[512];<br />
servAddrSrvr.sin_addr.s_addr=inet_addr("192.168.0.20");<br />
servAddrSrvr.sin_family=AF_INET;<br />
servAddrSrvr.sin_port=htons(80);<br />
connect(conn,(struct sockaddr*)&servAddrSrvr,sizeof(servAddrSrvr));<br />
recv(conn,buff,sizeof(buff),0);<br />
printf("%s\n",buff);<br />
}<br />
Can u say me where i went wrong.
amit mishra
|
|
|
|
|
You're ignoring the length of received data (returned by recv() ), you're not checking if all data is read in a single call to recv() and you're assuming that the data placed in buf by recv() is zero-terminated.
|
|
|
|
|
Hi all! I am Alex and wanna get help for how to Open the binary data file in C++ through the code. Actualy, the information in these data files are in hexadecimal forms, so I wanna ask how to use code to convert hexadecimal number to decimal number!
Weclome for all help!
Thank you very much!
Alex
|
|
|
|
|