|
1) do a manual clean, ie exit VC, delete .\Debug and .\Release dirs, *.aps *.clw *.ncb *.opt *.plg files (dont worry they will be regenerated)
2) *Maybe* also *.scc to drop your SourceSafe-links. I would do it. You can recreate them later.
3) Make sure all files and directories in question are writable/delete'able
4) Check the date/time of all files so that they aren't set to future dates/times
5) Be 100% sure that you know what file you are compiling. Search the disk so you haven't inadvertendly duplicate files on your disk and are compiling something else than you think.
6) Uncheck option 'project/settings/c++/customize/suppress startup banner'. Do same for Link tab.
7) Do a REUILD-ALL for both yor debug and release projects. Dependent projects first.
8) Check the output. Make sure all fles are compiled.
DO this and I guarantee that it will work. 100%. All the time. No magic. Promise.
/Peter
|
|
|
|
|
yah likewise
i usually delete the ncb file too and dont use hard breakpoints as it seems the actual address of the breakpoint gets remembered regardless of whether its on a line of code in the new build
tedious but again i seem to always be able to fix it with a full rebuild
good luck
frustating tho huh
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Hi Josh,
Sometimes the VC++ compiler buggers up the .PDB file. Depending of how observant
you are you might notice that it almost doubles in size. Additionally VC++
fails to fix this problem when you do a rebuild all! Isn't that annoying!
So you need to delete the .PDB and compile.
BTW: If you are writing a component that other are going to use (eg: dll) AND
you provide them with the binary, it is a good idea to also provide them
with the source code and the .PDB. This way they can step into your code!
Groovy hey.
It also encourages code reviews and shared testing.
Jules
|
|
|
|
|
You win....Solution found!!!
I deleted the *.pdb file as suggested, rebuilt the project, and was finally able to step through my code correctly.
What a pain in the ass!!!!
But now I know, and knowing is half the battle!!!
Thanks
Josh
josh@schroff.com
|
|
|
|
|
Cool! What exactly did I win again ?
:-j
|
|
|
|
|
/*--------------------------------------------------------------*/
/*This function displays the captured bitmap in the window.It */
/*uses the palette of the captured bitmap so that colors are */
/*correct. */
/*--------------------------------------------------------------*/
void Paint(CDC* pDC,HPALETTE hPalette,HBITMAP hBitmap,LPRECT lpRect)
{
CDC * hDC;
CDC MemDC;
CPalette m_Palette;
CPalette * m_pPalette;
BITMAP bmInfo;
CBitmap m_Bitmap;
CBitmap *m_pBitmap;
hDC = pDC;
static int x=0;
//Get the BITMAP message of the hBitmap;
GetObject(hBitmap,sizeof(BITMAP),&bmInfo);
//Create the compatialbe bitmap for the m_Bitmap;
if(!m_Bitmap.CreateCompatibleBitmap(hDC,
(lpRect->right-lpRect->left),
(lpRect->bottom-lpRect->top)))
{
::MessageBox(NULL,"Error!","Error",MB_OK);
}
//Set the HBITMAP to the hBitmap;
if(m_Bitmap.FromHandle(hBitmap)==NULL)
{
::MessageBox(NULL,"Error--FromHandle!","Error",MB_OK);
};
if(MemDC.CreateCompatibleDC(hDC))
{
if(hPalette)
{
m_Palette.FromHandle(hPalette);
m_pPalette=(CPalette *)hDC->SelectPalette(&m_Palette,FALSE);
// RealizePalette(hDC);
}
m_pBitmap = (CBitmap *)MemDC.SelectObject(&m_Bitmap);
if(m_pBitmap==NULL)
{
::MessageBox(NULL,"Error--SelectObject!","Error",MB_OK);
}
int x=bmInfo.bmWidth;
int y=bmInfo.bmHeight;
//The flowing will occur a error.
//But i can't find out why.
if(!hDC->StretchBlt(lpRect->left,lpRect->top,
(lpRect->right-lpRect->left),
(lpRect->bottom-lpRect->top),
// &MemDC,0,0,x,
// y,SRCCOPY))
&MemDC,0,0,bmInfo.bmWidth,
bmInfo.bmHeight,SRCCOPY))
{
char tt[266],tmpstr[10];
char * p;
strcpy(tt,"Error--StretchBlt!");
p=_itoa(x,tmpstr,10);
strcat(tt,p);
::MessageBox(NULL,tt,"Error",MB_OK);
x=0;
}
else
{
x++;
}
// StretchBlt(hDC,ps.rcPaint.left,ps.rcPaint.top,
// (ps.rcPaint.right-ps.rcPaint.left),
// (ps.rcPaint.bottom-ps.rcPaint.top),
// hMemDC,0,0,bmInfo.bmWidth,
// bmInfo.bmHeight,SRCCOPY);
if(hPalette)
hDC->SelectPalette(m_pPalette,FALSE);
//Detect whether the CDC work.
// CBrush br(RGB(0,255,0));
// hDC->FillRect(lpRect,&br);
}
// EndPaint(hWnd,&ps);
}
This articles come from Code Project.
Thank you in advance!
|
|
|
|
|
I'd love to help, but it would be a lot easier if you posted the error you are getting. The StretchBlt call looks perfectly legal to me, so I need to know what error you are getting to look further.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
The flowing is my right code.
The cause of the error is that i call CreateCompatibleBitmap to create the compatible bitmap without the bmInfo.bmWidth and bmInfo.bmHeight.And there are other causes.
The right code is:
void Paint(CDC* pDC,HPALETTE hPalette,HBITMAP hBitmap,LPRECT lpRect)
{
CDC * hDC;
CDC MemDC;
CPalette m_Palette;
CPalette * m_pPalette;
CPalette * m_tmpPalette;
BITMAP bmInfo;
CBitmap m_Bitmap;
CBitmap *m_pBitmap;
CBitmap *m_tmpBitmap;
hDC = pDC;
static int xx=0;
//Get the BITMAP message of the hBitmap;
Sleep(1000);
GetObject(hBitmap,sizeof(BITMAP),&bmInfo);
//Create the compatialbe bitmap for the m_Bitmap;
if(!m_Bitmap.CreateCompatibleBitmap(hDC,
bmInfo.bmWidth,
bmInfo.bmHeight))
{
::MessageBox(NULL,"Error!","Error",MB_OK);
}
//Set the HBITMAP to the hBitmap;
if((m_tmpBitmap=m_Bitmap.FromHandle(hBitmap))==NULL)
{
::MessageBox(NULL,"Error--FromHandle!","Error",MB_OK);
};
if(MemDC.CreateCompatibleDC(hDC))
{
if(hPalette)
{
m_tmpPalette=m_Palette.FromHandle(hPalette);
m_pPalette=(CPalette *)hDC->SelectPalette(m_tmpPalette,FALSE);
}
m_pBitmap = (CBitmap *)MemDC.SelectObject(m_tmpBitmap);
if(m_pBitmap==NULL)
{
::MessageBox(NULL,"Error--SelectObject!","Error",MB_OK);
}
hDC->SetStretchBltMode(COLORONCOLOR);
if(!hDC->StretchBlt(lpRect->left,lpRect->top,
(lpRect->right-lpRect->left),
(lpRect->bottom-lpRect->top),
&MemDC,0,0,bmInfo.bmWidth,
bmInfo.bmHeight,SRCCOPY|DSTINVERT))
{
char tt[266],tmpstr[10];
char * p;
strcpy(tt,"Error--StretchBlt!");
p=_itoa(xx,tmpstr,10);
strcat(tt,p);
::MessageBox(NULL,tt,"Error",MB_OK);
xx=0;
}
else
{
xx++;
}
m_tmpBitmap->DeleteTempMap();
MemDC.SelectObject(m_pBitmap);
if(hPalette)
{
m_tmpPalette->DeleteTempMap;
hDC->SelectPalette(m_pPalette,FALSE);
}
}
}
This articles come from Code Project.
Thank you!
|
|
|
|
|
I need I SuperGrid. What is this ? A Grid that I can put some ComboBox in the cells, or a checkBox and something like this.
Does anybody have this supergrid ?
Thanks
|
|
|
|
|
Have you looked at Chris's Grid?
http://www.codeproject.com/miscctrl/
http://www.codeproject.com/miscctrl/gridctrl.asp
|
|
|
|
|
I have created an access db file using access and when I create an application with Class Wizard using DAO it reports that it doesn't recognize the file type. In ODBC it does however. The reason I wanted to use DAO is so that I can compact the database.
Any help would be appreciated, or how can I compact the database using ODBC.
Thanks in advance
Happy programming!!
|
|
|
|
|
G'day Wolfram,
What version of Access did you use to create the database?
If you used Access 2000, you might try converting the database
to an Access 97 format and see if that works.
Tools->Database Utilities->Convert Database
I've also had similar problems on occasions using DAO to open
an Access database, and I've found repairing the database
normally helps.
Hope this helps,
Steve
--------------------------------------
Steve Driessens
|
|
|
|
|
Sounds like a problem I had with 2000, there is a known issue.
Before you open the file add these two lines.
// These lines are required to access Access 2000 databases
AfxGetModuleState()->m_dwVersion = 0x0601;
AfxDaoInit();
If you search the MSDN site you will find the explaination.
http://support.microsoft.com/support/kb/articles/Q236/9/91.ASP
and
http://msdn.microsoft.com/library/periodic/period00/c++0100.htm
I added the above lines and it allows me to read both 97 and 2000 files.
I have not done much testing though.
|
|
|
|
|
Hi,
My application while starting is placed in the systray as a icon. When i double click the icon, i get a Dialog. If i execute my application again, i get one more icon in the systray and similarly if i double click the icon twice two dialogs appear on the screen. I want to have only one icon on the systray and even if i click the icon again ( ie double click ) it should show only the previous dialog and not the new one.
ie I want to have only one instance of my application at any time.
Can anybody help me in doing this.
Thanks in advance
VMJ
|
|
|
|
|
Hello,
In first line of InitInstance method of the Your application class, put the following code,
APP_NAME -- is the DialogWindow Title.
if(AfxGetMainWnd( )->FindWindow(NULL, APP_NAME))
{
AfxMessageBox("Application Already running");
exit(0);
}
If any suggesstions let me know.
Thanks ,
- Kannan.A.;)
|
|
|
|
|
Hello,
it works fine, but if you have open another window with the same name (e.g. explorer window or application with the same name) your application won't start.
Better way is to create some kernel object (MS suggest mutex) when your application starts and destroy at ending. Before creating you simply try to open such object and if succeded it means that your application is already running.
Regards
Bartek
|
|
|
|
|
I've created a class that's not an MFC one, its a graph that need to be refreshed in a concrete time lapse.
I would like to use a timer in that class, but I don't know how to do it:
SetTimer(...) asks for a window parameter or for a pointer to a function... Here is where I don't know how to continue.<
Could you give me some advice or help?
a little example would be great.
Thank you in advance.
|
|
|
|
|
If your graph class is derrived not from CWnd (thus not wrapping Windows window object - identified by HWND) you could call SetTimer(NULL, nIdEvent, uElapse, fnTimer), where fnTimer is a method from your graph class. What is important that you should declare this method as static (at compilation time you use its physical address - so compiler should know it ).
Regards
Bartek
|
|
|
|
|
This still won't work if you don't have a window. Timers require a message pump and window to operate, even the callback method.
More likely, what he wants is a either a waitable timer, or simply to use the Sleep function to wait a specific amount of time.
|
|
|
|
|
Yep - it's my fault ...
Hope Sleep() helps.
Regards
Bartek
|
|
|
|
|
Does anyone know of or have any similar code to creating a ticker of a song name or some string using iamages from a bitmap as your text.
Joshua
|
|
|
|
|
Hej Joshua.
This code is quite simple. All you have to do is prepare picture image (in resource editor) and write a procedure which will take a string as a parameter, traverse this string, compute offset of image corresponding to each letter and blit it. Simple, eh?
It remainds me old times - low level assembler procedures, demos, scrollers, vectors, amigas
Regards
Bartek
|
|
|
|
|
|
Suppose that you know make sounds, use this to manipulate the time:
The time in seconds is the value returned by the clock function, divided by CLOCKS_PER_SEC. CLK_TCK is equivalent, but considered obsolete.
#include <time.h>
#include <conio.h>
clock_t start, end;
void time_start()
{
start = clock();
}
int time_trans()
{
end = clock();
return((double)((end - start) / CLOCKS_PER_SEC) );
}
|
|
|
|
|
Hello,
I have a Cable/Dsl Linksys Router and was wondering how I could get the IP address it is using with the Internet provider. I know I can get it manually from the configuration but was wondering how it could be obtained programmatically.
Any thoughts will be appreciated.
Thanks,
Todd
|
|
|
|
|