|
I'm writting one for fun and i've only just began to realize that it's quite a tricky process. The implementation i have used is probably not the best(nor is it finished) so i would like to here how maybe more experienced programmers have tackled similar tasks.
(is my lingo correct???)
I basically parse the statement into the following token categories:
1) Command token (SELECT, CREATE, etc)
2) Fields token (mytable.name, etc)
3) Tables token
4) Expression token (mytable.name = 'test')
5) Misc token(s) (ORDER BY, LIMIT, etc)
Once the statement is parsed into the following categories some tokens are further parsed by another parsing engine, like expression tokens will later be passed to an Expression evaluator where again it will be broken down into smaller tokens like < = > + * /, etc...
Anyways, from whats been said, does it sound like i'm on the right track???
Oh yeah, heres another important part:
I start parsing by extracting the COMMAND from the original string
So: SELECT * FROM temp WHERE name = 'Test'
Becomes: * FROM temp WHERE name = 'Test'
This is accomplished using the function CParse::ExtractCommand()
Then I would call CParse::ExtractFields() and so on...
Is there another way to accomplish this???
Any ideas???
Thanks
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
I have written parsing routines a couple of years ago to parse circuit descriptions, and let me tell you that it gets really tricky. At that time I remember that I started doing some readings on parsers, compilers, etc and they would use graph theory which I must say I have no clue how to use it. I mean I kind of know the basics from my math classes but that's about it. However, the approach that you are using for your SQL parsers is something that works just fine because most of us (my friends and I) followed the same logic to parse circuit descriptions.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Interesting...
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
little question.
is there a chance to get a pointer back to the application.
and to use the functions of the application?
or to get data from the application.
or is the only way to send messages?
how could i communication between the dll and the application.
i could call a dll function.
but how is it if a export a view and wanna call a function from the mainframe or from
the document class?
any ideas?
|
|
|
|
|
The DLL has a message queue. Handle the incoming message.
Kuphryn
|
|
|
|
|
Well you can pass a pointer from the app to the DLL and then it can use that. If the functions are in your CMainFrame class et.all. then you can use MFC functions in your DLL to get a ptr to these.
Another alternative is "Calling an Exported Function in an EXE from Within a DLL" http://codeguru.earthweb.com/dll/ExportingFromExe.html[^]
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
As you import functions from DLL to your application, and not the other direction, application-defined classes should not be called by the DLL.
Use MFC extension DLL to export a view class for your app's framework.
Regards,
BB
|
|
|
|
|
thats ok, and how did i got a pointer back to my app? and (myApp*) AfxGetApp() ??
|
|
|
|
|
1. Thou shalt not include CMyApp definition in a DLL.
2. You may use AfxGetApp() to send messages to your app, but I personally don't like such solutions - this is not what DLLs are for.
Regards,
BB
|
|
|
|
|
i know it.
but i need to get pointers back to my app.
and messages are a bad way. but the only way that i know
|
|
|
|
|
Another question. How can I get the ethernet card number of a computer because I've read somewhere that that number is unique and I would like to explore the possibility of using it at a unique identifier to protect my software. That's why I want to read BIOS info too, because I can get the motherboard number etc. I have seen DiskId32 but that was too confusing and frustratting enough for me I couldn't find any of the macros, data structures, and functions used by the software.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Check this out:
http://tangentsoft.net/wskfaq/examples/getmac-netbios.html
They also show 2 other methods that don't rely on having NetBIOS.
|
|
|
|
|
Thank you very very much Philnessosity.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Can someone direct me to a website where I can learn how to read BIOS information using API or MFC, or even Win32 Assembly, please?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I'm not totally sure, but I think under WIN32 you would raise an exception when you tried to access BIOS while running under protected mode. Protected mode is what applications all run under. When apps need resources like perhaps what your requesting, a device driver is needed and a task switch is performed (i believe) where for a small period of time the device driver code gets to run in a un-restricted environment (Starting with the 80x386/286??? CPU's could run in several different states, virtual, protected, etc...it's been a while since I glanced at my assembly books please forgive any technical discrepancies )
Anyways...I recall reading in a book once that bios parameters were accessed using the IO asm instructions IN/OUT and for some reason PORT 78h or something rings a bell...so you might wanna check that out.
I'll dig through my library and try and find the book i have that actually shows you how to read from the bios, however it will only work under DOS.
Cheers
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
Thank you Hockey. I just needed a confirmation. I had tried in the past to access hardware directly by using interrupts but I learned the hard way that that is impossible in Windows, while in DOS that's easy. I just wanted to make sure that there are no BIOS data structures provided by MS, because I have seen some source code where they use IOCTL (I think) macros which don't seem to exist anywhere. And they would access the hardware. I really don't know anything about windows devices so for now I guess I will have to postpone my BIOS reading project, until I develop some skills in VxD.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Toni78 wrote:
I guess I will have to postpone my BIOS reading project, until I develop some skills in VxD.
This will only work in windows 9X. Windows NT, 2000 and XP will use device driver .sys
John
|
|
|
|
|
John M. Drescher wrote:
This will only work in windows 9X. Windows NT, 2000 and XP will use device driver .sys
I am confused...
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Toni78 wrote:
I guess I will have to postpone my BIOS reading project, until I develop some skills in VxD.
I was just saying that a VXD will only work in windows 9X.
John
|
|
|
|
|
Hi!
I've got trouble when I try to use another Mailing Program than Outlook or Outlook Express (i.e. Incredimail, ...).
I'm using the Win32 API's functions (MAPISendMail, MAPISendDocument).
The message field is not the one I expect, and I can't attach any files. Incredimail adds "--------------Boundary-00=_U8SLQL80000000000000
Content-Type: Text/Plain
Content-Transfer-Encoding: " in the message field before my text.
Does anyone know how to fix these issues, or have another solution to send mails using Visual C++ 6?
Thks in advance!
Appstmd
http://www.appstmd.com
|
|
|
|
|
I have opened from my program IE6
How tu send message and press button eg. text in "search"and press "Go"
thanks
|
|
|
|
|
Use Spy++ to get the handle of the "Go" button. Get the parent of button and use SendMessage(parent_wnd_of_go_button, WM_COMMAND, 0, id_of_Go_button);
I think it would work... hope....
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rather than manipulate IE with simulated keystrokes and such, why not just use IE Automation. You get way more functionality.
|
|
|
|
|
Hi,
I am trying desperately to print a report in Landscape
Mode with VC++, but even I try with "hDevMode" ... it
still always print in Portrait Mode:
<br />
CPrintDialog printDlg(FALSE, PD_RETURNDEFAULT | PD_RETURNDC);<br />
<br />
if (printDlg.DoModal() == IDCANCEL) return; <br />
<br />
<br />
HGLOBAL m_hDevMode;<br />
HGLOBAL m_hDevNames;<br />
<br />
PRINTDLG pd;<br />
pd.lStructSize = (DWORD) sizeof(PRINTDLG);<br />
<br />
DEVMODE FAR* pDevMode =<br />
(DEVMODE FAR*)::GlobalLock(m_hDevMode);<br />
LPDEVNAMES lpDevNames;<br />
LPTSTR lpszDriverName, lpszDeviceName, lpszPortName;<br />
HANDLE hPrinter;<br />
<br />
if (pDevMode) <br />
{<br />
pDevMode->dmOrientation = DMORIENT_LANDSCAPE;<br />
<br />
lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);<br />
lpszDriverName = (LPTSTR )lpDevNames + lpDevNames->wDriverOffset;<br />
lpszDeviceName = (LPTSTR )lpDevNames + lpDevNames->wDeviceOffset;<br />
lpszPortName = (LPTSTR )lpDevNames + lpDevNames->wOutputOffset;<br />
<br />
::OpenPrinter(lpszDeviceName, &hPrinter, NULL);<br />
::DocumentProperties(NULL,hPrinter,lpszDeviceName,pDevMode,<br />
<br />
pDevMode, DM_IN_BUFFER|DM_OUT_BUFFER);<br />
<br />
::ClosePrinter(hPrinter);<br />
::GlobalUnlock(m_hDevNames);<br />
::GlobalUnlock(m_hDevMode);<br />
}<br />
<br />
<br />
CDC dc;<br />
CPrintInfo Info;<br />
CFont oFont;<br />
<br />
dc.Attach(printDlg.GetPrinterDC()); <br />
dc.SaveDC(); <br />
dc.m_bPrinting = TRUE;<br />
<br />
CString strTitle; <br />
strTitle.LoadString(AFX_IDS_APP_TITLE);<br />
<br />
DOCINFO di; <br />
::ZeroMemory (&di, sizeof (DOCINFO));<br />
di.cbSize = sizeof (DOCINFO);<br />
di.lpszDocName = strTitle;<br />
<br />
BOOL bPrintingOK = dc.StartDoc(&di); <br />
....................................<br />
....................................<br />
Can any one know why? To show you my problem I can
send "my small project" if you provide me your Email
address
I appreciate a lot anyone try to help me here
Thanks
|
|
|
|
|
From MSDN:
<big>CWinApp::GetPrinterDeviceDefaults
BOOL GetPrinterDeviceDefaults( PRINTDLG* pPrintDlg );</big>
<br>
Example<br>
void CMyApp::SetLandscapeMode()
{
PRINTDLG pd;
pd.lStructSize=(DWORD)sizeof(PRINTDLG);
BOOL bRet=GetPrinterDeviceDefaults(&pd);
if(bRet)
{
DEVMODE FAR *pDevMode=(DEVMODE FAR *)::GlobalLock(m_hDevMode);
pDevMode->dmOrientation=DMORIENT_LANDSCAPE;
::GlobalUnlock(m_hDevMode);
}
}
Give it a try...
Paolo
------
Why spend 2 minutes doing it by hand when you can spend all night plus most of the following day writing a system to do it for you? - (Chris Maunder)
|
|
|
|