|
Lynniz wrote: I have written a cgi script using C++, which it is going to be executed on a web browser.
Not sure what are you really trying to do, but cgi scripts are executed on a server, not on a web browser.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
This is what I have right now:
I have made a HTML page that contains an image map and a form. When I click on the image map, it is going to pass the coordinates of the clicked point to a cgi script. The cgi script is used here to parse the string and get the coordinate values and update the the original HTML page with the new coordinate values filled in in the form.
What I did in the cgi script was I made a copy of the orginial HTML page and saved it under a different name. After parsing the string and get the new coordinate values, I open up the new HTML as a text file and go in to update the form with new coordinate values. After I am done with that, I am trying to open the new HTML page in the same browser where the original HTML page is at. So this way it looks like to the viewer that the original HTML is beind updated. That is why I was trying to use a system command to call the new HTML page. I was able to call the new HTML page on the commandline, but I wasn't able to call it when I am using the server to execute the cgi script. Last thing, this is in a Linux enviroment.
I am probably doing it the harder way. Does this sounds more clear to you?
Thank you.
-- modified at 7:52 Monday 12th June, 2006
|
|
|
|
|
A graph was drawn using a CDC on a class derived from CWnd. This was done in OnPaint(). I want to clear this graph when the user presses a button. What code do I ned in the button press?
thanks,
sb
|
|
|
|
|
You don't clear the CDC, you just 'ask' for a repaint, that will erase everything. You can call Invalidate() for that.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Cedric Moonen wrote:
just 'ask' for a repaint, that will erase everything
We all know what you meant but what you typed is a different story
I'm just reading it from the thread issuer's view and if they take you literally, they'll just call Invalidate() in their button pressed handler which will ultimately generate the call to the OnDraw which drew the graph in the first place effectively redrawing it once again.
I'm guessing what you meant to say was in the button pressed handler, set some member variable to false like...
// declaration
BOOL m_bDrawGraph;
// constuctor
m_bDrawGraph=TRUE;
// On button pressed handler
m_bDrawGraph=FALSE;
Invalidate();
// OnDraw
if (m_bDrawGraph) {
// Draw the graph, etc...
} else {
// OnEraseBackground already cleared the background
// but you are free to draw something else here etc...
}
/* Don't forget that what goes up, must come down. Make sure to
provide some mechanism, such as another button and another handler
to set the m_bDrawGraph=TRUE when you want to see the graph again.
Don't forget to Invalidate() to force a redraw.
IMPORTANT: Remember that OnDraw gets called frequently, even when
you did not explicitly call Invalidate(). OnDraw needs to know what
to draw in your client area at any moment when someone drags
another window over your window which effectively wipes out part
of the graph so Windows politely Invalidates for you to "redraw"
the graph.
*/
Anyway, I apologize for the clarification but I hope it helps a little.
|
|
|
|
|
Normally stack overflow is not a problem unless you have a lot of recursive functions within threads.
I'm looking for any kind of suggestion,articles, methodes,api to detect and prevent stack overflow on releases.
None MFC if possible but even MFC is fine.
Thanks
G_S
|
|
|
|
|
G_S wrote: I'm looking for any kind of suggestion,articles, methodes,api to detect and prevent stack overflow on releases.
Global variables.
Stack-based arrays.
Passing structures to functions by value.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm putting together a framework for Win32 consoles (to make it easier to change font, background color, change title, and to teach myself Win32) and I was curious if it would be possible to define my own escape sequences using C++ (like \n, \t, etc), to change the font, clear the screen, or do custom formatting. I already know how to change the font under Win32 but it would be convieniant if I didn't have to clutter up the code with function calls. Any ideas?
|
|
|
|
|
CoffeeAddict19 wrote: I already know how to change the font under Win32 but it would be convieniant if I didn't have to clutter up the code with function calls. Any ideas?
How would you prefer to do it?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
There would be maybe 3 classes defined and 4 involved. 2 classes (one for each buffer, and duplicates of each other) do the actual low level Win32 function calls for their respective buffers. They would use this function to change the font, change the buffer size, the cursor position, and the window size:
void SetBufferInfo(int NewXCord, int NewYCord, PrintColorType ForeColor, PrintColorType BackColor, SetBufferType BufferAction); //sets buffer info
Another class which contains both of those buffer classes as private members acts as an interface between the client and the other two low-level buffer classes. It uses a set of of functions to change the title, change the font color, clear the screen, switch the active buffer so I can do double buffering, etc.
Another class (the client in this case) would set it up so that certain escape sequences, when read from a stream, would invoke the functions in the interface class described above.
-- modified at 14:18 Friday 9th June, 2006
|
|
|
|
|
CoffeeAddict19 wrote: Another class (the client in this case) would set it up so that certain escape sequences, when read from a stream, would invoke the functions in the interface class described above.
If you define a reader to look at each charater (or set of characters) before displaying them, you can do anything you want. What you are basically doing is writing your own markup language in that case.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
CoffeeAddict19 wrote: Another class (the client in this case) would set it up so that certain escape sequences, when read from a stream, would invoke the functions in the interface class described above.
So what's the problem? When those special characters are encountered, call the appropriate functions.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Would using an if statement to check each character encountered (to see if it's a tag) slow the program down signifigantly?
|
|
|
|
|
Not based on what you've told us so far.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Within the language, no, you cannot define your own. The escape sequences are standard.
However, if you want to write your own markup (or use an XML data file), you can wrap the calls to do such formatting into a single function to make it easy for you to write your code.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I've found, reviewed and implemented several TabCtrl examples...but I've run into a snag I hope you experts can help me with!
I need to dynamically update the controls in the child dialogs (from common controls from the parent TabDlg) but since the called dialogs are initialized during creation they do not update!
How do I 'refresh' the dialogs as global's (in the TabDlg) change which will modify objects in the called dialogs (MyDlg1, MyDlg2...)?
Effectively my application will periodically receive updated information which will modify the states of these tabbed child dialogs such that they must be updated periodically as well. How do I create a function to 'refresh' the dialogs? E.g. A button control on a dialog is visible by default but when a user changes a setting (with a ctrl on the tabDlg) this button should be invisible (or disabled)). Or alternative e.g., a 'default' buttonCtrl on the TabDlg should be able to set all controls on all dialogs back to a known state. Right now the child dialogs get set on initialization (creation) and I while the controls on these dialogs can perform actions, controls on the parent do not effect change on these dialogs.
Basically, parent Dialog control must effect changes to the child dialogs and the parent Dialog (TabDlg) must be aware of selections/settings of the child Dialog controls.
Thanks MUCH for any help/insight you can provide!
...an embeddedDude swinging into the VC++ world!
|
|
|
|
|
Hi there!
I'm developing a windows service (or should I say trying...), that needs to access data in some database.
I have already a library (in a separate dll, with static linking) that uses ADO via the COM Interface, to access data.
Also, I’ve started by looking at some samples here at CodeProject, specially the article by PJ Naughter and he’s library CNTService framework.
Now the problem: the service is installed correctly, but it will always fail to start, and it reports the error: 1053 – “The service did not respond to the start or control request in a timely fashion.”
Can anyone tell me what the problem might be?
Tanks in advance for your time.
ALMC
|
|
|
|
|
Hello People
I need help with a linker problem that I can’t solve. I am working on a project that is comprised of 3 static libraries and the main application. Workspace is comprised of 4 projects, 3 corresponding to the libraries and one project for the main application. When I compile and run in Debug Mode everything is fine. When I try to compile for Release mode, I get linker errors as follows:
CVGw32Doc.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CVGw32Doc::OnSaveDocument(char const *)" (?OnSaveDocument@CVGw32Doc@@UAEHPBD@Z)
CVGw32Doc.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CVGw32Doc::OnOpenDocument(char const *)" (?OnOpenDocument@CVGw32Doc@@UAEHPBD@Z)
CVGw32Doc.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CVGw32Doc::MyEmptyDatabase(void)" (?MyEmptyDatabase@CVGw32Doc@@QAE_NXZ)
All the errors are related to the document object in the main application. The first two errors are related to the virtual functions that have been overwritten and the last function is a public member of my own code. I have read all the online help of MSDN for this error and nothing at all seems to make sense, especially as two of the functions are part of standard library.
I have no idea why the linker can not find the code from the libraries supplied as part of the compiler. The same error persists in VC++ version 6 and the 2005 edition. I even made an application and added all files to a single application instead of using the libraries and the same thing still happens. All classes are there, nothing is missing. I have no idea what is happening.
Any help is appreciated.
Fariborz Nouri
|
|
|
|
|
Some things to check for:
1) See if a Rebuild All (or a Clean-then-Build) will fix it. Sometimes incremental builds have issues that show up when linking.
2) Check the version of the libraries each of your libraries is using. That is, make sure that if you are using MFC (which it appears you are), all apps and libraries using MFC have the "Using MFC" selection checked in your Project Settings. Also, check the code generation to make sure they are all using the same type of threading library (linking a library that uses a single-threaded library to an app that uses the multi-threaded library gives weird linking errors).
3) Finally, if neither of those worked, try comparing each and every setting between your Debug and Release build configurations. Try copying all the debug settings over to your release build and slowly undoing them 1-by-1 to find which setting is causing the differences.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
I'm migrating a project from VS 2003 to VS 2005. As always, exporting templates (instantiations of them) is a hard work. The problem is that I'm exporting an std::iterator implementation and, to avoid warnings, I have to export also its base classes, for example: _Iterator_base. The problem is that in release, this is a struct, and in debug this is a class!!! Do you know if there's a workaround other than doing another #ifdef...??
I'll really appreciate any clue!
Thanks in advance,
Federico
|
|
|
|
|
I have a dialog box that I would like to increse a variable everytime a button is pushed, but instead once the button is pushed the variable is set to 2376868 everytime. Using message boxes to debug a little I determined that the variable seems to randomly increse in the WM_COMMAND part of my message loop. My dialog procedure looks something like:
BOOL CALLBACK dlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
int number;
switch (msg)
{
case WM_INITDIALOG:
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_REGISTER:
number += 1;
EndDialog(hwnd, 0);
break;
}
break;
case WM_CLOSE:
EndDialog(hwnd, 0);
break;
default:
return FALSE;
}
return TRUE;
}
Any thoughts on how to fix this? Thanks
-Matt
|
|
|
|
|
number has not been initialized.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
case WM_INITDIALOG:
number isn't initialized but the value is stored from an INI file within WM_INITDIALOG
|
|
|
|
|
Then you must change it from auto to static .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You number variable is a non-static local one (in addition, it is not initialized), therefore its value will be lost after you exit the dialog procedure.
If you need it only within the function, declare it as static, and initialize:
BOOL CALLBACK dlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int number = 0;
...
}
If you need it outside, then move it on file level.
|
|
|
|
|