|
I am using some code that is generated by a compiler generator (ANTLR[^]) and the generated code has a number of places wher it uses #line. I notice that I can comment this out and it still compiles/builds/runs. Why would anyone want to use #line ?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
For macros and inline includes, it is real handy. By using #Line, you can reference the line of the include file, rather than the source file that the macro has been inserted into.
onwards and upwards...
|
|
|
|
|
#line tells the compiler/preprocessor that the next line in the source file should be treated as though it came from another file/line. In the case of antlr (and lex and yacc and other compiler compilers) they use #line wherever they copy code from your source file into the output file, in the case of the rule actions. This is so if there is an error in your code, the compiler will indicate where in your source file the error was, rather than the line in the generated file, which probably means nothing to you.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Is there a way to debug another process, that the process I'm debugging has done a CreateProcess() call for. I can't figure out how to load the project for the other process into the workspace for the project that I'm debugging. I'm using version 6 of Visual Studio. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
|
Thanks Chris.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
A lot of people know class CHtmlView. I had found pretty functions
FIndText() and FindText2(), written by Marc Richarme (http://www.codeproject.com/miscctrl/CHtmlView_Search/CHtmlView_Search_demo.zip),
that allow to find text on loaded(!) web-page.
Now I'm making project. One of main its functions is finding text on several(!) pages.
I do not know any other way to do it excepting using function FindText2() ( or FindText() ).
Actually, it is possible to find text in several web-pages, using, for example, FindText2() for every page separately.
But this function can't be applied until web-document isn't loaded.
So, I decided to organize cycle. Each page will be loaded in every other cycle.
I mean something like this (in abstraction):
<br />
<br />
for (int i=0; i<number_of_pages; i++)<br />
{<br />
...<br />
this->Navigate2( _urls[i], NULL, NULL );
....<br />
...<br />
}<br />
<br />
My problem is concluded in follow: the FindText2() function in my code called every time before new web-page will be loaded
completely. That's why FindText2() works with old page-url, finding text on it
Having poor English level, I repeat: FindText2() forestalls loading page.
So, I would like to know have can I define when my page is loaded, and then I'll call for FindText2().
Thanks in advance, I tried to explaine my problem very exactly.
|
|
|
|
|
|
I'v just tried. But have no success.
I decided to search for text using direct reading from file. Maybe you know, is there any class to organize searching in *.txt file for concrete text?
Thank you for answering
|
|
|
|
|
I have a constants.h file that I would like to use to store constants and such.
When I include the file in a class in my project I keep getting Link Error:2005: "already defined in" errors when I try to declare a string constant in the constant.h file.
How do I create global string constants that I can use througout my app?
// constants.h: defines constants to be used througout application.
//
//////////////////////////////////////////////////////////////////////
#if !defined(APP_CONSTANTS_0209051212)
#define APP_CONSTANTS_0209051212
//no problems here
const APP_PATH_STRING_LENGTH = 255;
//link errors when using these
char* app_data_path = "data\\";
char* app_charts_path = "c:\\CHARTS\\";
#endif // !defined(APP_CONSTANTS_0209051212)
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
I made the strings static, which appears to have solved my problem. Is this the best way to handled such a problem?
char* app_data_path = "data\\";
char* app_charts_path = "c:\\CHARTS\\";
to:
static char* app_data_path = "data\\";
static char* app_charts_path = "c:\\CHARTS\\";
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
kshaff03 wrote:
Is this the best way to handled such a problem?
nope.
the best way is like this:
foo.cpp:
#include "foo.h"
const char* app_data_path = "data\\";
const char* app_charts_path = "c:\\CHARTS\\";
foo.h
extern const char* app_data_path;
extern const char* app_charts_path;
making them static just means that every .CPP will get its own private copy of the strings.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
Thanks Chris,
As usual, your the best.
-Kevin
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
I am using Microsoft Visual C++ 6.0 and i need to execute a program (Ctrl+F5) passing it same arguments (as command line arguments), where can i put the arguments ?
Thanks.
|
|
|
|
|
You can pass any command line arguments to your program in the projects settings, under the Debug tab, in the Program arguments edit box.
I Dream of Absolute Zero
|
|
|
|
|
It will use the same arguments that you setup in the project settings.
Project->Settings->Debug
Program arguments field
NOTE: This is the same path for both release and debug builds
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
|
How to program proxy chains software?
Love is the law, love under will.
|
|
|
|
|
can any1 help me?
Love is the law, love under will.
|
|
|
|
|
I'm a "seasoned" SQL, SQR, COBOL, Easytrieve programmer teaching myself Win32 programming.
I'm creating a Wheel of Fortune type game using a dialog box. I've got the alphabet across the top of the screen, I can accept a letter choice and blank it out if it's not in the puzzle.
But here is the problem...can I use a dialog box to put random EDITTEXT boxes on a page that represent the puzzle?
For Example: PUZZLE 1 ___ ___ ___
___ ___ ___
PUZZLE 2 ___ ___ ___ ___ ___
Don't know how my resource script file can handle a random number of EDITTEXT boxes? I'm just trying this to get a feel for message based programming. Is a dialog box the wrong approach?
Thanks,
dC
|
|
|
|
|
Dialog box is probably okay for a learning program such as this.
You can CreatWindow on the fly and generate the edit boxes.
There is typically (or used to be) limit of 255 controls in one window.
I don't suppose you need that many, though, for your game.
You can create them in the desired lcoation, or use MoveWindow to position them.
If you make a dialog reosurce template, you could use ShowWindow and EnableWindow to show/hide enable/disable the ones your puzzle does not need at the time.
|
|
|
|
|
Ah, the lightbulb comes on!
I could just set up a whole slew of EDITTEXT boxes (or just limit the puzzle answers to say 20 characters) in my .rc file. Once I pull the randow puzzle I can just "show" the boxes I need with something like "SetWindowText(hwndLtr1, "______");"
Thanks,
dc
|
|
|
|
|
Yes, and to make it look more like the game, you can HIDE and DISABLE the edit boxes that don't match the current puzzle.
|
|
|
|
|
Blake Miller wrote:
There is typically (or used to be) limit of 255 controls in one window.
Ummm nope, there never was. Visual C++'s dialog editor has a limit on how many controls it supports on a dialog (255), but the limit as to the number of controls Windows supports is limited only by physical memory and the number of available window handler.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I beg to differ.
A BYTE was used, previously, to store the control's identifier, thus limiting the number of child windows to 255 in the resource template. Since most people used dialog templates and not in-memory dynamic resource tempaltes, they were 'essentially' limited to 25 controls on a single dialog.
Of course, if you are just building windows on the fly, you are limited only by memory or GDI resources, or some other commodity you will eventually deplete.
Another thing is, even though the current windows systems are typically entirely 32 bit environments, there are still many 'window identifiers' passed around as the upper or lower 16-bits of various window messages, so you are, in some cases, limited to 65535 windows, depending upon your circumstances.
As far as 'child controls' the window control child identifier is a 16 bit number, so even if you made more than 65535 child control windows, you would only be able to distinguich 65535 of them from each other. And you would also run into the messaging LOWOR/HIWORD problem. Just see the wParam of the WM_COMMAND message, and I quote MSDN:
The high-order word specifies the notification code if the message is from a control. If the message is from an accelerator, this value is 1. If the message is from a menu, this value is zero.
The low-order word specifies the identifier of the menu item, control, or accelerator.
|
|
|
|