|
If it's an SDI application, you'll never have more than one document open at a time anyway, so a File/Open operation will close the current document before opening a new one. If it's an MDI application, this sounds a bit counterintuitive to me.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It is an MDI application, my program has to open a document file automatically at a specific time and close it at a specific time too. Thanks.
|
|
|
|
|
You can use the following code snippet to close the active document. Since you are wanting to close a specific document, you'll need to provide a way of finding it.
CMDIFrameWnd *pWnd;
pWnd = (CMDIFrameWnd *) GetMainWnd();
if (NULL != pWnd)
pWnd->MDIGetActive()->DestroyWindow();
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Iwant to read some data from gif file. Dont know how to go about it. Can anyone help.
Thanks
|
|
|
|
|
According to what you want to do, one option could be to use OleLoadPicture and the IPicture interface. Have a look to the sample 218972[^] from MSDN.
HTH,
K.
New, what do you own the world?
How do you own disorder?
|
|
|
|
|
i would like to set my USB memory stick as a removable media so that it can autorun. does anyone know how to achieve this thru vc++?
can it be done?
if not, how about getting windows to look for the specific USB serial number and 'force' it to autorun?
thanx in advance
m
|
|
|
|
|
Is there anyone know how to do coding which can register an application to Microsoft Sti. From microsoft web site i found this command "IStillImage::GetSTILaunchInformation " but don't know how to apply it. Even I read thru the article but still cannot make it.
I will be happy if source is given.
Thank You
|
|
|
|
|
I like to write lines of code that are very short and very simple to understand. Is there a way that I can communicate this in a shorter more compact form?
CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT);
char cinput[255];
idcinput->GetWindowText(cinput, 255);
CString sinput = cinput;
Thank you,
Eric Sepich
|
|
|
|
|
don't use C string when using MFC.
replace with
CEdit *idcinput = (CEdit *) GetDlgItem(IDC_INPUT);
CString sinput;
idcinput->GetWindowText(sinput );
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
esepich wrote:
I like to write lines of code that are very short and very simple to understand
If you made the edit control a member variable, then your code could be accomplished with:
CString sinput;<br />
m_EditCtrl.GetWindowText(&sinput);
|
|
|
|
|
Or declare a CString member variable of the IDC_INPUT in ClassWizard
and call
UpdateData(TRUE);
m_strYourdata; //your data already being updated and m_strYourdata is ready to be used.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
CString sData;
GetDlgItemText( IDC_INPUT, sData );
|
|
|
|
|
I'm about to attempt to write my own parser/compiler which would have to translate a certain language into specific machine codes or whatever. The thing is though i don't have any experience on this, but i'd just like to learn how to write parser code already. Like.. something that can check syntax and keywords and all that, but i would just make a mess, so if anyone can point me to a tutorial or example where they show how to do this in a structured way i'd very much appreciate it
thx
Kuniva
--------------------------------------------
|
|
|
|
|
Ah, this is brings back fond memories... One of my MS theses (circa 1984) was a virtual computer that included a parser for a (very simple) high level language. The compiler generated assembly language code which was run thru the virtual machine's interpreter.
Anyway, to answer your question, here are the basic steps you'd need to take:
- Define the grammar for your language
- Write a lexical analyzer that spits out language tokens
- Write a parser that creates a parse tree from a stream of tokens
- Write a code generator that translates a parse tree into machine instructions
- Optional: write an optimizer to optimize the machine instructions
I strongly recommend looking at a decent book on the subject. I used the Dragon Book[^] eons ago.
Writing a compiler is a labor of love and imho, a necessary part of learning and appreciating Computer Science. (Learning assembly language is like learning geometry - we do it because it teaches us how to think).
Good luck and have fun!
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
I used the Dragon Book[^] eons ago
Aaah! the Dragon Book does bring back memories !!!
This[^] might also be useful...
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Are you taking a class on compiler construction at a college?
Check out these books on compiler construction.
The Dragon Book by Aho
Crafting a Compiler by Fisher and LaBlance
Kuphryn
|
|
|
|
|
Nope not yet, it's only my first year, we are learning Oberon now but.. blech :P
Kuniva
--------------------------------------------
|
|
|
|
|
|
|
I quite like Modern Compiler Design[^].
Most courses and texts cover simple parsing algorithms such as LL(1), LL(k) and LALR(1). These algorithms are powerful, but you really have to structure your grammar carefully to make them work - you tend to have to compromise your language, designing it around the parsing algorithm.
Famously, Bjarne Stroustrup did not do this, with the end result that C++ cannot be parsed by an LALR(1) algorithm (you must typically feed back into the lexer).
Generalised LR parsing algorithms are beginning to perform nearly as well as LALR parsers generated by yacc or bison . If you just want to parse your language and be done with it, consider the Elkhound[^] parser generator.
|
|
|
|
|
I'm using the system() command to call a batch file - This is done from a dialog box based program and the system() command is used within a loop - Each iteration causes the command.com window to get focus and control (the window pops up in front of whatever program I'm working with) - How can I minimize the window each time it is called, and if necessary, leave the focus with whatevery window has it ?
|
|
|
|
|
Try START /MIN application
|
|
|
|
|
I'll try this asap - Thanks
|
|
|
|
|
Use CreateProcess() instead of system(). This gives you far more control.
Here is some code I use in ED.
BOOL
Execute_OS_Program( char* pszCommandLine, char* pszWorkingDir, const int Run_Opts, int* const pnErrorCode )
{
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
DWORD dwCreationFlags = 0x00;
bool stat;
ZeroMemory( &siStartInfo, sizeof( STARTUPINFO ) );
siStartInfo.cb = sizeof( STARTUPINFO );
siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
siStartInfo.wShowWindow = SW_SHOWNORMAL;
dwCreationFlags = CREATE_NEW_CONSOLE;
ZeroMemory( &piProcInfo, sizeof( PROCESS_INFORMATION ) );
stat = CreateProcess( NULL,
(char*)pszCommandLine,
NULL,
NULL,
FALSE,
dwCreationFlags,
NULL,
pszWorkingDir,
&siStartInfo,
&piProcInfo
) != FALSE;
if ( stat )
{
CloseHandle( piProcInfo.hThread );
*pnErrorCode = 0;
if ( Run_Opts & SE_WAIT )
WaitForSingleObject( piProcInfo.hProcess, INFINITE );
}
else
*pnErrorCode = GetLastError();
return stat;
}
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks - I'll take a look at this method today
|
|
|
|