|
Hello all,
I've downloaded Visual C++ Express Edition for the first time and I enjoy programming with it. I have a question that I can't seem to figure out. Everytime I start a new C++ project, I have to constantly write the preprocessor directive "#include <iostream>" in my programs. How do I go about starting new projects with this directive already included in my programs? Thanks!
|
|
|
|
|
You can't. Having to put that through your files is part of C++. You may be able to create an appwizard that has the includes you tend to use in your main cpp file, but that's about it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have a grid (Chris Maunder's MFC Grid) on a formview in one pane of a CSplitterWnd object. The formview has a function called Refresh(). Inside of Refresh(), I call a function of the grid (SetRowCount(1)). Within SetRowCount() it checks to see if 'rows' that I sent in is equal to GetRowCount() like so:
ASSERT(nRows >= 0);
if (nRows == GetRowCount())
return bResult;
This works fine when Refresh is called from anywhere else within the form itself. The Refresh() function is public and from another pane I get the CMainFrame* (which has a pointer to the Form that has the grid) and I call the Refresh() function and I get an Access Violation error on this line:
int GetRowCount() const { return m_nRows; }
which is being called from the code above in SetRowCount(). Does anyone have any idea what the ^&*( is going on?
Thanks,
|
|
|
|
|
before you make that call to GetRowCount, what does the pointer to the Grid look like ? is it the same value you see when you call Grid functions that don't cause AVs ?
cause, that sounds a bit like a bogus pointer problem...
|
|
|
|
|
BlackDice wrote: Does anyone have any idea what the ^&*( is going on?
Is this NULL or a dangling/invalid pointer? Sounds like it...
--
Secreted by the Comedy Bee
|
|
|
|
|
I found out what it was. I've got 5 different panes that all call back to CMainFrame with functions like SetLeftView(), SetRightView(), etc. I called SetRightView() instead of SetLeftView(), but I'm surprised it even made it that far.
Thanks,
|
|
|
|
|
Hi all.
I'd search in the board how an can get text that is at the coordinate x,y (I have a flexgrid on external program and want to get the text of some row/column by its x,y coordinates.
I didn't found nothing. Can someone help me?
Please, help me.
Thx in advance.
Best Regards,
Marco Alves.
|
|
|
|
|
capture the window as a bitmap, then do some OCR to try to figure out what the text is
|
|
|
|
|
<sarcasm>Yeah, that's what he was looking for</sarcasm>
led mike
|
|
|
|
|
that's wasn't sarcasm. text isn't stored on-screen anywhere as text. by the time the output of TextOut gets to the screen, it's just brightly-glowing dots. the only way to know what text is at x,y is if you keep track of that info as you draw it. but if you're not the one drawing it...
|
|
|
|
|
Chris Losinger wrote: that's wasn't sarcasm.
My reply wasn't sarcasm?
led mike
|
|
|
|
|
i guess i mistook the direction of your sarcasm.
|
|
|
|
|
He may be able to get the text as text (without OCR) for a specific control (in his case a flexigrid). I agree that a general solution that works for any control would need to use OCR however. Active Accessibility is also an interesting possibility for controls that support it.
Steve
|
|
|
|
|
Stop cross-posting all your questions please.
led mike
|
|
|
|
|
can u please tell me something about threads any link
Thanks
|
|
|
|
|
Google: MSDN C# threads
led mike
|
|
|
|
|
Sir,
Please send any article if possible.
Very Thanks.
|
|
|
|
|
I have written a C++ program and I wish it to be able to be started by dragging a file icon onto the program icon in windows explorer. The program name is prog.exe, the file name is file.syx, they are both in folder "H:\folder". When the file is dragged onto the program icon in explorer and starts, the value of _argc=1 with _argv[0] being "H:\folder\prog.exe" and _argv[1] being "H:\folder\file.syx" as expected. I then use this information to open file.syx.
However, if the program and file are moved to a folder with a space in the name such as "H:\copy of folder", then when I drag file.syx onto prog.exe I get these unexpected results. _argc=3 with _argv[0]="H:\folder\prog.exe", _argv[1]="of", _argv[2] = "folder\prog.exe H:\copyof~2\file.syx".
If I just double click "H:\copy of folder\prog.exe" I get _argc=3 with _argv[0]="H:\folder\prog.exe", _argv[1]="of", _argv[2] = "folder\prog.exe ".
I have tested this program on windows98 and windowsXP with the same basic results. If anybody knows how to consistently get the name of a file that is ‘dragged onto a program icon to start that program’ from inside that program then I would appreciate the help.
|
|
|
|
|
If this is a Windows application, why aren't you using the standard drag&drop interface instead of argc/argv?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
this program also has drag&drop where a person could drag a file onto the open window of the program to open that file. I wish to be able to open the file as the program starts up. I beleve this would also let me set the file extenshion (.syx) to that double clicking a .syx file would open that file in this program.
|
|
|
|
|
If double-clicking a .syx file is not working, then you need to adjust its registry setting by surrounding the %1 parameter in double quotes.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have went to folder options and set .syx to open H:\copy of folder\prog.exe Now when I double click a .syx file , it opens prog.exe but I do not know how to get the information about the opening file other than to us _argv, and it gives strange results. I beleive I am missing somethin since standard programs such as notepade and others do this with no apparent problem.
|
|
|
|
|
Do you have a console or a Windows application?
Look in the registry for your .syx extension and note what you see. How is %1 being handled?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am curently using windows98. I have open regedit and did a search for .syx and did not find anything with %1 in it. I am afraid you may be going over my head. i.e. i'm lost.
|
|
|
|
|
hlmechanic wrote: I am curently using windows98.
Which matters not.
hlmechanic wrote: I have open regedit and did a search for .syx
It should be near the top of the HKEY_CLASSES_ROOT hive with all of the other file extension types.
For example, if you look for .txt, you'll see it has a default value of txtfile. Looking further down the list for txtfile, you should find:
HKEY_CLASSES_ROOT\txtfile\shell\open\command
Does the same sort of thing not exist for your .syx extension?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|