|
How can I access the raw tcp packet? Any help is appreciated.
Thank you.
mweiss
|
|
|
|
|
Hi,
(I am a rookie, but trying to learn, very interested in everything. Now using Borland vc++ and M$ vc++.)
To keep it simple: I want to make a calendar with scheduled events.
I've been searching for the best ways to do this, but I still don't know what's the best way.
Simplest way is to make a timer-function that runs every minute so that a trigger-file(with the events(date/time/event) ) can be checked. This seems not a good option?
(I don't want to read/write/use the Task Scheduler in Windows.)
Any suggestions?
Thx in advance, Roland(Be).
|
|
|
|
|
Maybe I can run a function that sorts the triggers by time (sort of queue) and then just wait for the first timed event with sleep()...(?) where the function can be started again and removes the (first) event from queue(/file)?
It's a way to not-use the timer-function every minute...
|
|
|
|
|
I'd go for the one minute timer approach. The other solution is more elegant, so to say, but:- The load of the one minute timer is negligible,
- if next event happens in two hours, and the user inserts a new event popping out in an hour, what would you do (with the second approach)? Kill the timer and reset it? Things begin to get complicated.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hmm,
I think I'll do it like this;
1.
EVENT = Name of Event + Date/time + ...extra info(like recurring, etc.)
2.
If(EVENT change/new/del)<br />
{<br />
function(queue)-> This wil sort the queue with events and pick out the 1st that's upcomming to put this in memory/file.<br />
}
3.
Timer every minute-> That reads only the upcomming event. (this way the program also doesn't run function(queue) every minute.)
4.
Output...
And of course when program starts run function(queue) in case of bad data(ie. crash/powercut/etc)
|
|
|
|
|
|
Is it bad practice to have a "MyProjectHeaders.h" file that has the
#ifndef......#endif protection around a set of include statements ?
Then just include the "MyProjectHeaders.h" file in each source ?
I know compilation/linking will take longer and there will be redundant headers.
I played around with it and found that I had to include some specific headers in each source. The API includes do not seem to suffer from this (you can include an API header that has it's own include statements and access their functionality without including the specific file in the source).
Can anyone shed some light on this ?
Is it a VC++ 6.0 linking/settings issue ?
Cheers
If sex is a pain in the ass, then you are doing it all wrong!
|
|
|
|
|
It's not bad practice, it's a good practice; better would be to remove the header dependency by using forward declaration, or pointer to objects in your classes instead of "direct" class members
...
#ifndef _A_CLASS_H_
#include "AClass.h"
#endif
class CAnotherClass
{
CAClass m_AClass;
}
...
class CAClass;
class CAnotherClass
{
CAClass* m_pAClass;
}
In the long run, including headers in cpp files will not be as costly as including them in header files ( see "Large Scale C++ Software Design" by Lakos )
if you need to include a file in another header file, you'd better use #ifndef ... #end around the include directive to limit the damages.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
in regular c++, I usually follow the following steps to read the text file
1) #include <fstream.h>
2) ifstream inputFile("c:\\sometext.txt",ios::in);
3) inputFile.getline(aline,1024,'\n');
I created the project that contains the function to read the files. Then I updated to the .net by opening the project in the vistudio .net.
but fstream.h is unknown in .net and my function is failed since ifstream is unknown either.
I found the example in microsoft msdn
is FileStream, and it said I have to include namespace System::IO but I got error at that statement.
So how to read and write the text file in .net (c++)
thank you
|
|
|
|
|
fstream.h does not exist in VS.NET ? Good. it's not standard C++, and never was. Drop the .h from ALL your standard headers, in this case, include fstream, NOT fstream.h. You'll then find that everything is in the std namespace, so you'll need to either put
using std::ifstream
or use it like this:
std::fstream inputFile.....
Also, ios::in is the default mode for an ifstream, you don't need to put it ( and if you did, it will need std:: as well ). In the same line, getline also defaults to use \n ( and of course, you're not checking if the file is bigger than 1k ).
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
thank you Cristian..
but after I have add following statements as what you said, I got errors messages
"error C2039: 'fstream' : is not a member of 'std'"
"error C2873: 'fstream' : symbol cannot be used in a using-declaration"
code:
using std::fstream;
#include <fstream>
So I switch their position as shown below statements to check if errors get deliminated...
code:
#include <fstream>
using std::fstream;
Yes.. the above 2 errors disappeared but I got following errors
error C2065: 'ifstream' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'inputFile'
error C2653: 'ios' : is not a class or namespace name
error C2065: 'in' : undeclared identifier
error C3861: 'inputFile': identifier not found, even with argument-dependent lookup
error C3861: 'inputFile': identifier not found, even with argument-dependent lookup
error C2228: left of '.eof' must have class/struct/union type
|
|
|
|
|
pnpfriend wrote:
error C2039: 'fstream' : is not a member of 'std'"
Makes sense that you can't scope something before including it.
pnpfriend wrote:
using std::fstream;
pnpfriend wrote:
Yes.. the above 2 errors disappeared but I got following errors
using std::ifstream, NOT using std:fstream. An fstream can be used for input or output, and requires the ios::in or ios::out that I see you still used, and didn't put std:: in front of, as I told you to.
Basically, everything you're having trouble with is in namespace std, and needs either a using statement, or std:: in front of it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I got it.. I change "using std::fstream;" to "using namespace std;"
and it works..
Thank you
|
|
|
|
|
Does anybody know what is the maximum number of rows that can be added to a MS Flexgrid control !!!
Engineering is the effort !
|
|
|
|
|
Have you seen these two MSDN articles:
Q194653
Q253211
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
how can i load a bitmap file to device context ?
how can i save a bitmap file from device context ?
|
|
|
|
|
CDC.SelectObject(MyBitmap)
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
//Updating somebody else's window
// ( win32 SDK - VC6 - Win 98/2k )
Hi Friends,
How can I make a "forceful update" of a window created by
another process.I use EnumChildWindows() to get the HWND of
the window in question,has some BitBlt() done to is HDC,but after
these gimmicks, I couldnt restore the original .However if I resize
this window or maximized another window , the defaced window
looks normal as it should be. What would a better solution this problem?.
- Frienldy -Dracula
|
|
|
|
|
Invalidate(TRUE)
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Invalidate(...) function updates the window but it is really not a forcible update to my knowledge. Use UpdateWindow(...) for a forcible update of a window.
|
|
|
|
|
Hi everybody
I'm currently developping a Http 1.1 Client in C++.
I try to send chunk encoded data to a very simple http 1.1 CGI server
I have written in c++ for testing.
here the http request message the client sends :
POST http://MyHost/cgi-bin/MyHttpSrv.exe HTTP/1.1\r\n
Host: MyHost\r\n
Transfer-encoding: chunked\r\n
Content-type: text/plain\r\n
\r\n
2\r\ngo\r\n
0\r\n
\r\n
My problem is that the server never responds anything. It seems to be
blocked.
My configuration :
- Win2000 Pro + Personnal Web Server (IIS 5.0 reduced version)
I have reduced the CGI to the simplier ... and nothing happens.
Here is CGI source code :
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
cout << "Content-type: text/html\r\n" ;
cout << "Content-Length: 9\r\n" ;
cout << "\r\n";
cout << "Server OK";
return 0;
}
If I post the same request to an equivalent ASP page, the server runs
correctly !!??
Has anyone a suggestion ?
Tx
Lsa
|
|
|
|
|
Does anybody know SetTermsrvAppInstallMode() and TermsrvAppInstallMode()
from KERNEL32.DLL are not documented by Microsoft. They seem to be the only way to progmatically set or determine whether a terminal server is in install mode. They have been documented in several places on the net (search google groups) and seem to work. Should I use them or is there a more correct way of doing it?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I was asked to develop something that'll show the user's logon network id on the task bar so it's always visible. The user must not be able to close or terminate this app. Sounds simple. It probably is if you know how.
I'm not a C++ developer yet. In fact, I'll be taking a C++ course in a couple of weeks for this purpose. I am, however, been developing for some years now, mainly in Visual FoxPro. I also programmed in Pascal.
We have Windows 2000 workstations in a Novell network. The task manager is protected, meaning that the users cannot ask for the task manager by CTRL+ALT+DELETE keys.
Now the question. Someone mentioned that a Windows service might be a better way of doing this. Is that so? Does anyone have an idea of how I would go about accomplishing this? Some sample codes would greatly help.
TIA,
VagaBond
|
|
|
|
|
There are several ways of accomplishing this, but I first have to ask what is the ultimate goal here? To simply put the user's name in a window on the task bar doesn't sound really useful (which implies that surely there is a higher purpose). What happens when a dozen or more apps are running and the task bar windows are very small, thus obscuring the user's name?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The ultimate goal is that the network user id must always be visible. There are users in our company who have more than 1 network logon id's. Each logon id determines, among other things, network authorisations and drive mappings. Sometimes, users would call the help desk asking why they can't see certain files or folders, or why they can't delete a file, although they can open and view it. Actually, these problems are easy to solve. We'll just tell them which user id they used to log on and that's that. Easy, I said, but when it happens on a regular basis, then it's time to look for other solutions.
Showing it on the task bar was my idea. Our network id's are only 6 characters long. I figured it'll take a few open apps before the user id is NOT readable. It would also be nice if clicking on the user id on the task bar, a small window will open providing the user more than just his network logon id, his/her full name for example.
I hope this helps, David.
Regards,
Ed Bond
|
|
|
|