|
|
In the InitInstance of your application, you have access to the CCommandLineInfo, so derive a new class from it, and override the ParseParam method to handle the parameters on your command line.
Max.
|
|
|
|
|
What is the easiest way to update a pane in a status bar from within a view? I would really just like to access the main window's or CMainFrame m_wndStatusBar member from within my view and call the SetPaneText method as opposed to using any update command handlers. If anyone knows how I could do this I would appreciate it.
|
|
|
|
|
I usually create a public function in CMainFrame to do the updates.. Then call that function from the view or doc... Not sure if this is the best solution but it works for me.
Rob
|
|
|
|
|
Hi,
i have following problem, i have application which is linked with
ddao35.lib (ddao35.dll) (change table properties, like validation rule)this was org. built for a access 97 database.
now i like to update my application for usage access 2000 together with access 97
so with SP 5 for visual studio 6.0 a project (ddao.cpp) was shipped, new dll ddao36.lib (ddao36.dll) could be built
now i linked my application with ddao36.lib and everything goes well for a
access 2000 database, but for access97 database is code still running but
after opening the database in access97 i see that some modifications are not done
a function like this, won't work for access 97 (running without errors)
void ChangeTableValidation(CString strDBFileName, CString strTableName, CString strFieldName, CString strValidation)
{
CdbDBEngine dbEngine;
CdbDatabase dbDatabase = dbEngine.OpenDatabase(strDBFileName, FALSE);
CdbTableDef dbTableDef = dbDatabase[strTableName];
CdbField dbField = dbTableDef[strFieldName];
dbField.SetValidationRule(strValidation);
}
perhaps has somebody any idea about this,
Dan O
|
|
|
|
|
Hello all,
I've a large Access database !
What's the best algorithm for opening the database ?
How Microsoft Access open the .mdb very fast ?
(i'm using DAO)
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
hi,
it depends what you want, (do you need all records)
do you use requery (views) or access direct to your tables
if you use tables normally you could go for something like
CTableNumbers tableNumbers
tableNumbers.Open()
or
CString strSQL;
strSQL = "SELECT * FROM [Numbers] WHERE Number > 10000 ORDER BY Number ASC";
TRY
{
tableNumbers.Open(AFX_DAO_USE_DEFAULT_TYPE, strSQL)
//do something
tableNumbers.Close()
}
CATCH( CDaoException, error )
{
//do handle your error
}
END_CATCH
but access is slow anyway,
you could think about opening the database tables at startup of your programm and of course at the closing your app close the database also
hope it helps,
|
|
|
|
|
Thanks for reply
In fact my problem is the program speed at start up
When i open the database at start up it's like interupt
And yes i need all data in the table.
Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hadi_Rezaie wrote:
And yes i need all data in the table.
If there's lots of data there and you need it all, then you just have to wait for it. One option you could use, which I used in a similar situation, is to use a worker thread to get the data, and distract the user with something while it happens ( I used a login screen, which was appropriate for my app, and while you logged in, it was already reading the data. The other option is a progress bar, but that would slow down things more, because you'd have to do lots of queries instead of just one, so you could increment it.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Yes, I'm agree with you about using Thread.
How can i use thread to open the database ?
Do i have to check database is open or not in the thread ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I forget the API calls I used, but I opened the database and populated my table in another thread.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Please remember it and tell me
Best Regards !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have a 2d graph that I render to the clipboard for copy/paste, but I have a seperate legend that is a listctrl. My question is: How do I render text to the clipboard over the image I already have there? Or is there a way to redirect the print function (which does render the text) to a "Clipboard DC" rather than the printer DC? Any info will help. Thx!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
|
Well... I'm kinda getting a pre-rendered metafile. Here's the code:
CPicture mypic = pGraph->ControlImage();
::OpenClipboard(NULL);
::EmptyClipboard();
HGLOBAL hGlobal = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(METAFILEPICT));
LPMETAFILEPICT pPict = reinterpret_cast<LPMETAFILEPICT>(::GlobalLock(hGlobal));
pPict->hMF = ::CopyMetaFile(reinterpret_cast<HMETAFILE>(mypic.Handle), NULL); pPict->mm = MM_ANISOTROPIC;
pPict->xExt = 22862;
pPict->yExt = 5078;
::GlobalUnlock(hGlobal);
if ( ::SetClipboardData(CF_METAFILEPICT, hGlobal) == NULL )
{
AfxMessageBox( "Unable to set Clipboard data" );
CloseClipboard();
}
if ( !::CloseClipboard () )
{
AfxMessageBox( "Unable to close Clipboard" );
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Sorry, but I have to say I do not know the best method to do this.
But this is what i can think of.
Create a CMetaFileDC.
Call PlayMetaFile on this dc.
Write all the stuff from the legend using GDI functions.
Save Metafile to a disk file
Reload the metafile to clipboard.
There may be a better way to get the metafile data to clipboard from the DC though. This is all I could come up with instantly
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
thanx. I'll let you know what I come up with if you're interested...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
|
I hope someone can figure this one out for me!
I have a simple function that takes 400 double values and graphs them in the client area. I run this about 25 times per second to give 25 FPS. This works fine however it uses up all the memory in my computer after about ten minutes!!! In the "Windows Task Manager" the mem usage just keeps increasing until my computer crashes. I'm sure it is this function that is causing the problem because when I leave it out this doesn't happen.
Any ideas?
void function3 (HWND hwnd, double a[], int iLength)
{
HDC hdc;
PAINTSTRUCT ps;
int i;
hdc = GetDC(hwnd);
Rectangle(hdc, 0, 0, 400, 256);
MoveToEx(hdc, 0, 256, NULL);
for (i=1; i< 400; i = i++)
{
int p = (int)a[i];
LineTo(hdc, i, 255-p);
}
EndPaint (hwnd, &ps) ;
}
Thanks in advance,
Paddy
|
|
|
|
|
Paddy wrote:
hdc = GetDC(hwnd);
You have to call ReleaseDC() if you've called GetDC()
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Thanks thats makes a big difference, I'm only losing a couple of Kb per minute now.
|
|
|
|
|
Paddy wrote:
void function3 (HWND hwnd, double a[], int iLength)
{
How often do you call this fcn? the double a[] with no bounds checking seems kinda shady... If I can recall, every time you call this fcn, you will make a copy of a[]. I would get the for loop out of this fcn, and pass a as a const reference. Also, why even use a double if you're casting to int And also, where do you set the size of a[]? I'm not a guru, but the whole thing looks a little shady.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I'm calling this function about 25 times per second, I know the code is a bit of a mess but I'm just worried about the increasing memory problem. I have included ReleaseDC(hwnd, hdc); now and it has made a significant difference but I'm still losing a bit of memory! I can't actually get rid of the for loop because I'm using this to draw lines between each point on the graph.
Thanks for the help.
|
|
|
|
|
Try:
void function3 (HWND hwnd, <code>double& a[400]</code>, int iLength)
{
HDC hdc;
PAINTSTRUCT ps;
int i <code>= 0</code>;
hdc = GetDC(hwnd);
Rectangle(hdc, 0, 0, 400, 256);
MoveToEx(hdc, 0, 256, NULL);
for (i=1; i< 400; <code>i++</code>) <code>
{
<code>
<code>LineTo(hdc, i, (255 - static_cast<int>(a[i]));</code>
}
EndPaint (hwnd, &ps) ;
}
It may not solve all the memory issues, but may speed you up some and maybe ease it a little.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Thanks I have it fixed now, there was another part in my app where I was creating a colored pen over and over again using
hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
and not deleting it when I was finished. Just stuck in
DeleteObject(hPen);
and it's all sorted now!
Thanks for the help,
Paddy
|
|
|
|