|
Hi,
I am writing a small utility to automate the backing up and restoring of databases from within my software using 'RESTORE DATABASE' and 'BACKUP DATABASE' through CDatabase::ExectueSQL. Adding 'WITH STATS = 10' causes SQL to return 10% completed, 20% completed etc etc.
I was wondering, if it was at all possible to get the completed amounts out and using them for a progress bar? I know ExecuteSQL does not return anything, but maybe calling oSQL with an output file set?
Many thanks in advance.
|
|
|
|
|
Hi,
I derived a class from a CScrollview and implemented OnPaint event by filling the area with the black color but it causing flickering ..can anyone help me how to make it flicker free...here is the code attached..
class MyScrollView : public CScrollView
{
public:
MyScrollView();
virtual ~MyScrollView();
private:
CDC m_dc;
protected:
virtual void OnDraw(CDC* pDC);
virtual void OnInitialUpdate();
void DrawBitmap(void);
public:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
void MyScrollView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
void MyScrollView ::DrawBitmap()
{
CSize sizeTotal;
sizeTotal.cx = 10000;//198450000;
sizeTotal.cy = 200;
SetScrollSizes(MM_TEXT, sizeTotal);
CRect rect;
GetClientRect(&rect);
CClientDC dc(this);
CBitmap bmpTemp;
CBitmap *lpOldBmp;
m_dc.CreateCompatibleDC(&dc);
bmpTemp.CreateCompatibleBitmap(&m_dc,rect.Width(),rect.Height());
lpOldBmp = m_dc.SelectObject(&bmpTemp);
m_dc.FillSolidRect(&rect,RGB(0,0,0));
}
void MyScrollView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
void MyScrollView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(&rect);
dc.BitBlt(0,0,rect.Width(),rect.Height(),&m_dc,0,0,SRCCOPY);
}
i added this class in a dialog box like below
m_MyScrollView = new MyScrollView;
CRect scrollRect(10,10,rect.Width()-50,rect.Height()-50);
m_MyScrollView->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,scrollRect,this,NULL);
m_MyScrollView->DrawBitmap();
Thanks in advacne
suresh v.
|
|
|
|
|
Invalidate your window area, but exclude the area where the bitmap will be drawn (calculate ahead of time) and then you will not get the flicker where the bitmap will go. Your background would only be 'erased' where the bitmap will be missing. Otherwise, if you bitmap always fills the window area, then override the OnEraseBAckground and don't erase the background at all, or manually only erase where the bitmap is missing.
|
|
|
|
|
Respected All
Regards!
The article from Hermann about Print is
"Easy to use class for ScreenCapture to printer"
I used it and working well and i bcome able to take print while using this class brillient work by him but the always the print did not come on the center of the page and that's start print from the Top Left corner of the page, now i want to take Print at the center of the page.
the link of the page is
http://www.codeproject.com/printing/prntscreen.asp
please guide for possible change in this class so that i may able to take print at the middle of the page while printing.
Regards
David
david
|
|
|
|
|
Hi,
I am creating a shell namespace extension to show FTP files. I implemented cut / copy and paste using CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR. I implemented IDataObject and IStream for this. After copying, when I choose to paste the files, I am getting all the files, But the problem is that, the directory structure is not retained.
If I am copying a folder say "Test", which contains 2 files
1. a.txt
2. b.txt
When I choose paste, I am getting 2 files ( a.txt and b.txt ) and a folder ( Test ) in the same place. In fact it should have been folder "Test" and the two files inside "Test". But that is not happening.
I believe I am missing something here...
Could somebody please help me in resolving this.
Thanks and Kind Regards
Jugs
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hi,
My project uses a telephony hardware which comes with its own initializing software. Each time i run my app, i've to run the said s/w for initializing the h/w. So, i think it'll be better if my app itself runs it on startup. I've lookd up the MSDN and ended up on Createprocess( ). I burnd my head a lot, but its not workin, probably, the parameters i passd r incorrect.. plz help me out.
thanks,
-- ano
-- modified at 0:38 Friday 25th November, 2005
|
|
|
|
|
Hi,
Use ShellExecuteEx
Bye
Cool Ju
Dream Ur Destiny
|
|
|
|
|
hi
you can use create process as follows.
suppose app u want to run is saved on c: and its name is app.exe
then u can try this
STARTUPINFO si={0};
PROCESS_INFORMATION pi={0};
if(!CreateProcess(NULL,"c:\\app.exe",NULL,NULL,FALSE,CREATE_NEW_CONSOLE,NULL, NULL,&si,&pi))
{
printf("\nError in creating the process");
}
else
printf("\nBe happy");
sanket patel
|
|
|
|
|
Hi
Does anyone know how to get IShellBrowser interface of a open file dialog in Ms-office applications . I set up a hook and handle the message WM_GETISHELLBROWSER . But i dont know the lparam and wParam values of the message . Can anyone Please help me in this regard
|
|
|
|
|
|
The second parameter can be used as a string. It is an LPVOID, so you can easily pass a char* pointer there.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
|
Kixdemp wrote: How can I read the contents of a file? I got the ReadFile() function, but none of it's parameters is a string! Does anyone know?
if it normal text file... better use CStdioFile class
"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
|
|
|
|
|
|
I use the CreateProcess() in VC.At frist, I defined a CString to get the filepath and filename.for example :
CString SelectedFile;
CFileDialog FileDialogBox(TRUE,NULL,"*.dxf",OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,szFileFilter,this);
if(FileDialogBox.DoModal()==IDOK)
{
SelectedFile=FileDialogBox.GetPathName();
}
Then in the CreateProcess() ,I want to run another programmer called "draw.exe".
My question is ,how the CreateProcess() get the value of SelectedFile when run the "draw.exe".
My purpuse is specifying the filepath and filename fristly ,and runing the "draw.exe" to load it.
Thank you
|
|
|
|
|
Pass SelectedFile as the second parameter.
CreateFile("draw.exe", SelectedFile, ...);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you for your help.
I have worked it out.The second parameter shuould turn to the (LPSTR)type. So it may be (LPSTR)(LPCTSTR)SelectedFile.
Thank you.
|
|
|
|
|
Hello everyone!
OK, I finally tried the VC++ 2003 Everett I had in my closet and it worked!
I want to make a program now, but it requires code generation... I know how to do the code, but how do I compile it? In C# we used the CodeDom class if I remember correctly and it compiled it for us, but how do I do it in MFC? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
You can't. Any machine that runs .NET has a compiler in the framework. That is not true of C++, which compiles to native code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
It just plain does not work that way. You could try to use gcc if you're compiling standard C++, but I'd say that your best option is to use C++/CLI and then use .NET to generate code on the fly.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
My overall opinion is that you're screwed here. I have no idea what GCC files you need, and once you have them, they will create an exe that you can run. You're not going to be able to compile code within the process that you're running.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
How many characters can a CEdit Control can obtain. In my App if I keep store data into CEdit, Cedit won't display data after a certain amount of time.
Thanks
|
|
|
|