|
You need to create a second pointer, set it to equal attTypes[0], then add strlen(attTypes) to it every time you copy.
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
|
|
|
|
|
I wrote an MDI application using MFC. It is an application to build proprietary (in-house format) documents using a form. This application also has a feature to taking such a document and transform it to another format understood by a third-party application.
I would like this feature to be able to run on the command line, for example:
c:> MyMIDApp /i:infilename.xxx /o:outfilename.yyy
The advantage of this is being able to automate the task of transforming the document from a script. We could really use such a feature.
Is there a simple way to do this?
tx
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
|
So if the application realizes that the parameters tell it to run from the command line, do I simply exit before the call pMainFrame->ShowWindow(m_nCmdShow); or do I return FALSE before the above line of code?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
You can move the command line checking even before the MDIDocTemplate is created and return without creating it, if you do not want the windows. When you run the line that creates the DocTemplate, that is when the MainFrame, Doc and Views are created and linked together.
<code>
if (ProcessCommandLine())
{
m_pMainWnd = NULL;
return TRUE;
}
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MDITYPE,
RUNTIME_CLASS(CMdiDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMdiView));
AddDocTemplate(pDocTemplate);
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
</code>
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
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++!
|
|
|
|