|
no idea can anyone else help her?
|
|
|
|
|
not necessarily.
if each line looks like this : 50 312 125 423 12 , you can easily read each entry (line) with a cin-like call.
<font style="color:blue;">int</font> id, speed, distance, time <font style="color:green;"> </font>;
file >> id >> speed >> distance >> time <font style="color:green;"></font>;
you now have all your values read in one line.
TOXCCT >>> GEII power
|
|
|
|
|
I am trying to avoid setting up the security auditing for each and eveyr PCs. Is monitoring the security event log the only way to do it? Any help is appreciated.
|
|
|
|
|
NetUserGetInfo() will return NERR_UserNotFound if the user account has not been created.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi David,
Thanks for the info. I think NetUserXXX suite of functions (including NetUserGetInfo and NetUserEnum) are for getting info about an existing resources. These functions maybe useful to poll against if a user has connect to your PC (this itself is a very useful info for my other project! Many Thanks!). However, having said it, I need to monitor in real time if any user a/cs has been created or modified. My aim is to protect against intrusion. As I have said, I could monitor the security event but I would need to set the auditing policy on each and every PCs (which I dearly would want to avoid the extra admin work).
More ideas?
|
|
|
|
|
hello i have a simple problem that i need to solve. i need to create a file, programmaticaly, with certain text. I am not sure if you can use static const char, but this is why i am asking. If anybody knows how to do this please help
I know i have to use CreateFile and WriteFile api but i need code that uses this
-Ryan M.
|
|
|
|
|
Ryan McDermott wrote:
need to create a file, programmaticaly, with certain text
Use WIN32 File I/O API functions CreateFile and WriteFile for this purpose.
Ryan McDermott wrote:
I am not sure if you can use static const char
Yes you can.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
#include <iostream>
#include <fstream>
bool WriteTheFile ()
{
std::ofstream ofs ( "MyFile.txt" ) ;
if ( !ofs )
return false ;
ofs << "My file contains this text" ;
return true ;
}
Since the data is copied out to the file any text that is valid at the time of the write (in this case the '<<') can be written.
IMO if you're writing in C++ then it's worth becoming familiar with the iostream part of the Standard Libary and reserving direct use of the Win32 API for special cases where you really need something non-standard.
Paul
|
|
|
|
|
Hi,
I'm currently experiencing quite an odd problem.
I have this dialog (CDialog) which, among other things, contain a tree control and a property sheet. That is, I create the CPropertySheet dynamically by doing something like this:
<br />
m_interactionSheet.Construct("HEHE", this);<br />
<br />
m_actionPage.Construct(IDD_ACTIONS);<br />
m_eventPage.Construct(IDD_EVENTS);<br />
m_interactionSheet.AddPage(&m_actionPage);<br />
m_interactionSheet.AddPage(&m_eventPage);<br />
<br />
m_interactionSheet.Create(this, WS_CHILD | WS_VISIBLE);
The above code works without any problems. However, if I try to show another dialog after having called CPropertySheet's Create() function, the application locks up. It's like it goes into an infinite message loop or something :S
If I comment out the m_interactionSheet.Create() part I can create and display CDialogs again.. otherwise not.
EDIT: I have reproduced the behaviour in an ordinary SDI application. PLEASE have a look at it here:
http://www.blacksmith-studios.dk/PropertyTest.zip[^]
The problem is in the CInteraction::OnInitDialog() function. (BTW, this is just a test program so everything might be messy and all.. this problem is just killing me )
Any idea what might be causing this as I'm all blank
Thanks,
|
|
|
|
|
m_actionPage
m_eventPage
are these member variables of type CPropertyPage or a class derived from PropertyPage.
If so , i dont think construct is required, you can remove all three calls to constructs.
Then try. see if it works.
God is Real, unless declared Integer.
|
|
|
|
|
Hmm.. you're probably right about the Contruct() thing since both m_actionPage and m_eventPage are classes derived from CPropertyPage.
However, it didn't work. The application still locks up if I try to display another dialog.
I did observe something strange though. If I comment out the m_actionPage part and only go for the m_eventPage part, everything works :S
I did just discover, however, that if I put controls on the property page dialog template THEN it locks up again.
What the hell is going on here?
|
|
|
|
|
humm, things are going out of my hand now, did you enable the propertypage as popup window.
God is Real, unless declared Integer.
|
|
|
|
|
Yes, no difference there
Do you mind if I add you to my MSN contact list? Just so we can discuss this more directly (if you have the time and want to, of course )
Thanks for your time so far!
|
|
|
|
|
Halloko wrote:
Do you mind if I add you to my MSN contact list?
no not at all, go ahead. my msn id is prakashnadar@msn.com
God is Real, unless declared Integer.
|
|
|
|
|
|
I have the following declaration
CMap<CString*, CString*, CStringArrayEx*, CStringArrayEx*> *m_EnhancementArray;<br />
What I am trying to accomplish is create a Map so I can take a string and get in return an array of other strings. I liked CStringArray but needed a copy constructor so that is what CStringArrayEx is all about.
The problem is when I set a value to this map using the following
m_EnhancementArray->SetAt(&returnVal, &EnhancementArray);<br />
returnVal is of course the string I have made as my key and EnhancementArray is my CStringArrayEx of strings. This call seems to work fine. When I iterate through the map, from the function where I called SetAt, I can see the data. However once I leave the function where SetAt is called, the data becomes corrupted in the CMap. I tried this without using a pointer and I still get the same thing to happen. Does anyone know what might be causing my data to disappear?
Thanks!
|
|
|
|
|
could you give a piece of your code so that we can see where could have been your fault...
TOXCCT >>> GEII power
|
|
|
|
|
In a sense, you kinda got it. I cut out the gory details cause they didn't make a shread of difference but I will try to put in the details I think would.
MyClassCls.cpp
<br />
CString CMyClass::StoreEnhancements() <br />
{<br />
<dd> CString returnVal = _T("");<br />
<dd> CString Description = _T("");<br />
<dd> CString Enhancement = _T("");<br />
<dd> int Enhanced = 0;<br />
<dd> int NumEnchs = 0;<br />
<br />
<dd> CStringArrayEx EnhancementArray;<br />
<br />
<dd> SQL.Format("SELECT * FROM MYTABLE WHERE TableCode = 1);<br />
<dd> if(m_pRs.Open((const char *)SQL))<br />
<dd> {<br />
<dd><dd> m_pRs.GetFieldValue("Enhanced", Enhanced);<br />
<dd><dd> m_pRs.GetFieldValue("NumEnhs", NumEnhs);<br />
<dd><dd> m_pRs.GetFieldValue("Description", Description);<br />
<br />
<dd><dd> if(Enhanced)<br />
<dd><dd> {<br />
<dd><dd><dd> SQL.Format("SELECT * FROM ENHANCMENTS WHERE TableCode = 1);<br />
<dd><dd><dd> if(m_pRs.Open((const char *)SQL))<br />
<dd><dd><dd> {<br />
<dd><dd><dd><dd> m_pRs.GetFieldValue("Enhancement ", Enhancement );<br />
<dd><dd><dd><dd> EnhancementArray.Add(Enhancement );<br />
<dd><dd><dd> }<br />
<dd><dd> }<br />
<br />
<dd> }<br />
<br />
<dd> returnVal.Format("[Enhanced] %s", Description);<br />
<br />
<dd> m_EnhancementArray->SetAt(&returnVal, &EnhancementArray);<br />
<br />
<dd> return returnVal;<br />
<dd>
}<br />
<br />
CString CMyClass::GetEnhancement() <br />
{<br />
<dd> FullDescription = StoreEnhancements();<br />
<dd> POSITION p = m_EnhancementArray->GetStartPosition();<br />
<dd> CString *Keys;<br />
<dd> CStringArrayEx *Values = new CStringArrayEx();<br />
<dd> m_EnhancementArray->GetNextAssoc(p, Keys, Values);<br />
<br />
<dd>
<br />
<dd> return FullDescription;<br />
}<br />
<br />
CStringArrayEx& CStringArrayEx::operator =(const CStringArrayEx& pCopy)<br />
{<br />
<dd> for(int i=0; i<pCopy.GetSize(); i++)<br />
<dd><dd> Add(pCopy.GetAt(i));<br />
<br />
<dd> return *this;<br />
}<br />
<br />
MyClassCls.h
<br />
class CStringArrayEx : public CStringArray<br />
{<br />
public:<br />
<dd> CStringArrayEx(){}<br />
<dd> virtual ~CStringArrayEx(){}<br />
<dd> CStringArrayEx(const CStringArrayEx &pCopy)<br />
<dd> {<br />
<dd><dd> operator= (pCopy);<br />
<dd> }<br />
<br />
<dd> CStringArrayEx& operator =(const CStringArrayEx& pCopy);<br />
};<br />
<br />
class AFX_EXT_CLASS CMyClass: public CObList <br />
{<br />
public:<br />
<dd> CMyClass();<br />
<dd> CMyClass(CString DatabaseFile);<br />
<dd> virtual ~CMyClass();<br />
<br />
...
<br />
<dd> CMap<CString*, CString*, CStringArrayEx*, CStringArrayEx*> *m_EnhancementArray;<br />
<br />
};<br />
I hope this helps.
|
|
|
|
|
something to add. I can now see the data when I am outside the function. I can iterate through and actually get the first key and the value associated with it. however when I try Lookup, it fails. The only difference I can spot is that when I iterate I am using a CString *var; When I am using lookup it is a CString var, however if you notice I am sending the address pointer Lookup(&stringVar, ArrayVar).
Does this make any sense?
Thanks
|
|
|
|
|
Why are you using CString* as the KEY and the ARG_KEY parameters of the CMap template. Declare it as CMap<CString, LPCTSTR, CStringArrarEx*, CStringArrayEx*> *m_EnhancementArray in your class declaration.
In your StoreEnhancements function, change m_EnhancementArray->SetAt(&returnVal, &EnhancementArray) to m_EnhancementArray->SetAt(returnVal, &EnhancementArray) .
And, in your GetEnhancement function, change CString *Keys to CString Keys .
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
It looks like that did it. Thanks! I actually did try changing the CMap to CString but I did for both parameters. I never thought of using LRCTSTR however.
|
|
|
|
|
I have this project which I worked on a year ago. I copy it from one CD to my PC, I make some modifications to the dialogs in the resource editor and I try to compile it and this is what I get:
e:\program files\microsoft sdk\include\iphlpapi.h(183) : error C2065: 'PMIB_ICMP_EX' : undeclared identifier
e:\program files\microsoft sdk\include\iphlpapi.h(183) : error C2146: syntax error : missing ')' before identifier 'pStats'
e:\program files\microsoft sdk\include\iphlpapi.h(183) : warning C4229: anachronism used : modifiers on data are ignored
e:\program files\microsoft sdk\include\iphlpapi.h(185) : error C2059: syntax error : ')'
The begining of the header file where iphlpapi.h is looks like this:
#include <stdafx.h>
#include <iphlpapi.h>
#include <ctype.h>
#include "MacNSn.h"
Can someone tell me where this error is coming from and what steps should I take to fix it? This project used to compile and run just fine.
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
may be iphlpapi.h utilizes types declared in some other header.
i suggest you to check APIs used by your app
and make sure that all necessary headers in right sequence are included.
|
|
|
|
|
|
hi everybody,
i wanted to test a functionnality of my own, and i nedded to open a file. as i was quite in a hurry, i decided to use fopen which is easy to use.
but i really don't know why, it doesn't want at all to open my file !
i tried this : FILE* src = fopen("source.txt", "r"); but it always returs NULL.
does anybody have an idea ?
thanks...
TOXCCT >>> GEII power
|
|
|
|