|
The definition of log(message) is in another file in the same project. In which I print this message...
Goes like..
log(string message)
{
cout<<message;
}
the above function is called like what I had given earlier. This function is defined outside the Logger class.
|
|
|
|
|
your function prototype doesnot match with the definition, since these are in different compilation unit and the compilation unit where you defined the function doesnot aware of the faulty declaration, compiler didn't shown error,
you need ti change like this,
string log(string message)
{
cout << message;
return message;
}
or change the prototype as
extern void log(string message);
and define as
void log (string message)
{
cout << message;
}
|
|
|
|
|
Thanks a lot it worked.. Thank you for your time.
|
|
|
|
|
and you can go for pass - by - reference.
|
|
|
|
|
hai,
i have written a code to created a status bar and i get the following error while i run the project,what's wrong with the code???
"Unhandled exception at 0x7837b7a8 (mfc80ud.dll) in kk.exe: 0xC0000005: Access violation writing location 0x00000014."
and the error is shown here:
void CStatusBar::SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth)
{
ASSERT_VALID(this);
BOOL bChanged = FALSE;
AFX_STATUSPANE* pSBP = _GetPanePtr(nIndex);
error-------->pSBP->nID = nID;
if (pSBP->nStyle != nStyle)
{
if ((pSBP->nStyle ^ nStyle) & SBPS_STRETCH)
bChanged = TRUE;
else
{
pSBP->nStyle = nStyle;
pSBP->nFlags |= SBPF_UPDATE;
SetPaneText(nIndex, pSBP->strText);
}
pSBP->nStyle = nStyle;
}
and my coding is
m_bar.Create(this);
CRect rect;
GetClientRect(&rect);
m_bar.SetPaneInfo(1,scan,SBPS_STRETCH ,0);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,
scan);
CString s;
s="scan";
m_bar.SetPaneText(0,s);
Raja
|
|
|
|
|
AFAIK panes are 0 indexed so if you only have one pane in your status bar, then your code will crash.
|
|
|
|
|
Hi,
I got XOffice source from net but when I create a print preview of any document it directily sends print command to printer. Can anyone tell us how to avoid this.
Another problem is with excel where this code does not provide "Freez Panes" in Window menu. This option is not available at all. How to include such functionality.
This architecture is based on OLE.
Any input will help.
Thanks
SNI
jhghjghj
|
|
|
|
|
on a single click how do i take a snapshot and print of currently displayed screen using VC++/MFC
|
|
|
|
|
There are lot of articles in the code project about capturing screen. Why dont you have a search?
|
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I have a MFC class which is derived from CWinApp. It has got two methods set and get. I have to use this set method in a Win32 lib. But when I include the header file of above MFC application. I am getting a compilation error like
C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> . Can I know how to solve this problem.
Thanks & Regards
|
|
|
|
|
what about using a wrapper function which doesnot include MFC headers in its declaration to get and set properties with CWinApp based class.
|
|
|
|
|
I use FILE to read datas from file.But it does not read full datas.
For Ex: if my file have 9 datas it reads only 6 datas then it jumped out from the loop.
when i see the YCS file.. it contains 9 datas, so no problem in writing.
Problem only in reading data. THis is my code...Whats the problem???Pls help me.
void ReadThermodata()
{
char FPath[] = "C:\\SelCompLst.YCS";
FILE *fp;
SThermoData pData;
if((fp = fopen((LPCTSTR)FPath,"r"))==NULL)
{
return;
}
int cnt = 0;
while( fread( &pData, sizeof( struct SThermoData ), 1 ,fp ) )
{
ThermoDataList.push_back(pData);
cnt = cnt + 1;
}
}
Anu
|
|
|
|
|
This is just a wild guess, try opening the file in "r+b" mode...
when the file is opened in text mode,there is possibility for the file to stop at ascii values like 26....
Hope this helps!
|
|
|
|
|
it seems its a binary mode data file, you need to open it with "rb", some value of data in binary mode is EOF in text mode.
|
|
|
|
|
We tried "rb" to open the file. But no use. It just read very few datas.
Anu
|
|
|
|
|
check what is the error, using ferror, _get_errno
|
|
|
|
|
Anu_Bala wrote: Whats the problem???Pls help me.
Have you bothered to use the debugger to step through the code?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I am looking for a image\video compression\decompression library to serve video over TCP\IP.
I get frames from my web cam in 320*240 resolution and RGB24 format so each frame is 320*240*3 = 230400 byte = 225 kbyte.
I am using Directshow to get streams from files or capture devices in server side. But I don't want use it also in client side. I am building my client in pure WinAPI. So I am looking for ANSI or only Win32 dependent open or closed free libraries for C\C++.
Can you suggest any ?
Best Regards,
Akin Ocal
|
|
|
|
|
Myphone[^] might give you good leads.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
This[^] might help you as well.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
i have a dialog with background color
when i minimize the dialog and maximize again i am loosing the color of the dialog
if i switch to another window and come back to same dialog the color will appear on the dialog again
whats the problem
i should not loos the color of the dialod when i minni mize and maximize
any message handlr i have to handle ?
|
|
|
|
|
How did you change the background color??
|
|
|
|
|
Seems like a paint issue.
Try overriding the OnEraseBkgnd() function.Write the code to put color on the screen there.
Hope this works out for you.(never tried this though...)
cheers!
PS:do comment or call the CDialog::OnEraseBkgnd( pDC ) first before putting in your paint code
modified on Tuesday, May 13, 2008 12:39 AM
|
|
|
|