|
Mark_Murphy wrote: needed to wait 3 seconds
Use Sleep(3000);
1 milli second=(1/1000) seconds
However, avoid using Sleep(/*time interval*/).
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Ahhhhhhh
Thanks AnShumAn
Tried the Sleep earler but was using the (s) in lower case instead of upper.
Cheers for the help, just need to read things better next time.
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
Hi there,
I created a dummy MFC app in VS2005. All I want to do is to paint the view black color. When I resize the window, the view is flashing white color all over. I thought painting to an off-screen DC then calling BitBlt could avoid that. Can someone please tell me how? Thanks a lot!
This is my OnDraw function.
void CtestView::OnDraw(CDC* pDC)
{
CtestDoc* pDoc = GetDocument();
if (!pDoc)
return;
CDC offScreenDC;
CBitmap offScreenBitmap;
CBitmap * pOldBitmap = NULL;
CRect clientRect;
GetClientRect(clientRect);
if (offScreenDC.CreateCompatibleDC(pDC))
{
if (offScreenBitmap.CreateCompatibleBitmap(
pDC,
clientRect.Width(),
clientRect.Height()
)
)
{
pOldBitmap = offScreenDC.SelectObject(&offScreenBitmap);
}
}
CBrush brush;
CBrush *pOldBrush = NULL;
if (!brush.CreateSolidBrush(RGB(0, 0, 0)))
return;
pOldBrush = offScreenDC.SelectObject(&brush);
offScreenDC.FillRect(clientRect, &brush);
pDC->BitBlt(
clientRect.left,
clientRect.top,
clientRect.Width(),
clientRect.Height(),
&offScreenDC,
0,
0,
SRCCOPY
);
offScreenDC.SelectObject(pOldBrush);
offScreenDC.SelectObject(pOldBitmap);
}
|
|
|
|
|
Override OnEraseBkgnd and do nothing, return simply true.
like this;
void CtestView::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}
|
|
|
|
|
Great! I'll try that tonight and report the result. Thanks!
|
|
|
|
|
Awesome, it works like a charm! Thanks so much!
|
|
|
|
|
My pleasure.
|
|
|
|
|
Hi,
By using MFC Appwizard I have created a project.
Say FirstApp as an SDI application and chosen the Header files only as databasesupport.
I wrote a function in FirstAppView class to get the database connection.
After that I have inserted another Dialog resource and added a few controls for it and then added a new class for it.
Now I want to invoke the function which I wrote in FirstAppView class.
Can you plz say How can I do that?
Thanks in advance.
|
|
|
|
|
Does this help;
AfxGetMainWnd()->GetActiveView()->YourFunction();
|
|
|
|
|
Hi Prasad,
Actually I tried this way but I got an error saying that my application class is not derived from CWnd.
Can u say how to overcome it.
Thanks in advacne.
|
|
|
|
|
Can you show some code?
I assume your application is SDI with Doc/view support. and you have a dilaog class from which you want to access a function in view class, isn't it?
|
|
|
|
|
tejaswini.g wrote: Now I want to invoke the function which I wrote in FirstAppView class.
create extern object of that Class and call the required function using taht object!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thank you very much for both of you.
I have another doubt shall i ask you?
I wrote code like this.
while()
{
.....
.....
//a query to insert data into database.
....
}
I want to stop the execution for sometime say 2milli seconds after insert query.
How can I do that?
Can I use sleep() method here?
|
|
|
|
|
tejaswini.g wrote: I want to stop the execution for sometime say 2milli seconds after insert query.
How can I do that?
Can I use sleep() method here?
any particular reason to use While Loop!...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes I am reading data from a .txt file and inserting it into the database.
|
|
|
|
|
Hi, I need to read 5 rows by 5 columns of numbers from a text file into a 2D integer array.
How do I do it in C++?
e.g
10101
00011
10111
01110
10010
I've already created a 2D array and the necessary statements which are used to read from a text file.
i.e
int data[5][5];
ifstream inClientFile("Data.txt", ios::in);
|
|
|
|
|
first read all data in any string then reterive useful text from it!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
And it seems he needs to convert string to int atoi
|
|
|
|
|
How to create a setup.exe to install MySQL_5.0.exe and MySQL_Query_Browser.exe in a single click?
MySQL_Query_Browser.exe setup must start after the complete installation of MySQL_5.0.exe .
can any one help me ?
Thanks in advance
JAYARAJ
|
|
|
|
|
J5121982 wrote: ow to create a setup.exe to install MySQL_5.0.exe and MySQL_Query_Browser.exe in a single click?
download INNOSetup!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
Hello everyone!
After working out a bit since my last post (don't worry - you don't have to read it to understand this one...), I got some different errors... It tells me I've redefined 3 specific symbols 6 times each... 2 of them are on one file, one is on another file... The include guards all seem correct, I can't see what's wrong... Hm, I've been thinking it could be the way I include files - I made a Includes.h file that includes all my headers plus all the C++ headers I need and I include that in all my headers... Maybe that's the problem? Here's the file:
#ifndef _INCLUDES_H_<br />
#define _INCLUDES_H_<br />
<br />
#include <iostream><br />
#include <string><br />
#include <stdlib.h><br />
#include <time.h><br />
#include <vector><br />
#include <string><br />
using namespace std;<br />
<br />
#include "SDL.h"<br />
#include "SDL_image.h"<br />
<br />
#include "Defines.h"<br />
#include "Structures.h"<br />
#include "HelperFuncs.h"<br />
#include "Vehicle.h"<br />
#include "ErrorHandling.h"<br />
#include "MapHandling.h"<br />
#include "Player.h"<br />
#include "Game.h"<br />
<br />
#endif // _INCLUDES_H_<br />
Can anyone tell from that what the problem is, or should I include some more code? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Can you show exact error message ?
|
|
|
|
|
|