|
Check out www.securom.com, it'll give you a little while at least before the hackers get in. Doubt its free though. Personally I prefer silent copy protection methods, such as those in Championship Manager 4 and Unreal Tournament, where (in CM4) if a copied disk is inserted it allows you to play the game, but every game you play is fixed so you lose. This way will at least keep those people who buy one copy and share it amongst friends at bay from researching a hack because they aren't aware its the copy protection doing its job .
|
|
|
|
|
Thanks for the suggestions
|
|
|
|
|
Greetings All,
Is there an API call to find a string within another ?
How about with wildcard Chars
How about with wildcard char[] (i.e a wildcard that represents any number of chars) ?
Cheers
If sex is a pain in the ass, then you are doing it wrong!
|
|
|
|
|
API no, library yes, _tcsstr, strstr.
The wildcard stuff is a different issue. One way to do this is with regexp, although something that handles only ? and * is simpler.
Steve S
|
|
|
|
|
try this function. It should work
int Compare(const char* mask, const char* s)
{
const char* cp=0;
const char* mp=0;
for (; *s&&*mask!='*'; mask++,s++)
if (*mask!=*s&&*mask!='?') return 0;
for (;;)
{
if (!*s)
{
while (*mask=='*')
mask++;
return !*mask;
}
if (*mask=='*')
{
if (!*++mask)
return 1;
mp=mask;
cp=s+1;
continue;
}
if (*mask==*s||*mask=='?')
{
mask++, s++;
continue;
}
mask=mp;
s=cp++;
}
}
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Is there any code or Axcive X to send and recived datas via USB?
In win98 or XP or 200?
|
|
|
|
|
Click on the "search comments" link above, type "USB" and press Enter
|
|
|
|
|
There are commercially available generic USB drivers that can adjust to virtually any protocol, and support all relevant OS versions.
I am not aware of a free / cheap solution, or one provided with the OS.
"Dor säggsische Dialeggt eechnet sich wie keeen onderor für den Ausdrugg zäärdlischor Gefiehle."
sighist | Agile Programming | doxygen
|
|
|
|
|
I have an STL list, and I want to move on it from back to front. I am trying to use the reverse_iterator, but I am getting a compilation error. Here is my code:
typedef std::list<RECT> RectList;
RectList myList;
for ( RectList::reverse_iterator ri = myList.rbegin();
ri != RectList.rend(); ++ri )
{
*ri = *(ri + 1);
} I get the following errors in the last line:
error C2784: 'class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> __cdecl std::operator +(_D,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce template argument for '' from 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>'
error C2676: binary '+' : 'class std::reverse_bidirectional_iterator<class std::list<struct tagRECT,class std::allocator<struct tagRECT> >::iterator,struct tagRECT,struct tagRECT &,struct tagRECT *,int>' does not define this operator or a conversion to a type acceptable to the predefined operator
Hosam Aly Mahmoud
|
|
|
|
|
You can only increment or decrement iterators, not add a numeric offset to them.
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
But he can dereference them and use operators on the referenced object.
Provided that the operators are defined for the object.
Was it that what he tried: *r+1 ?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
His code is doing this:
<br />
*ri = *(ri + 1);<br />
i.e. he is trying to add one to the iterator, *then* dereferencing it.
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Thanks for your reply. But why can't I add to the iterator? According to MSDN[^], the reverse iterator contains operator+. What I don't know is what this operator takes as input.
Anyway, I changed my code to this and it compiled:
for ( RectList::reverse_iterator ri = myList.rbegin(), ri2 = myList.rbegin();
ri2 != myList.rend(); ++ri )
*ri = *(++ri2); Thank you for your help.
Hosam Aly Mahmoud
|
|
|
|
|
You get an error here, because you can not use '+' with an iterator.
If you want to assign the value of the next object to the current one, I would do:
{
RectList::reverse_iterator next = ri++;
*ri = *next;
}
If you want to access an iterator that is more than one step away, you can use std::advance() to step the iterator many steps.
If you intended to add a value to the value referenced by ri , you need to write:
*ri = *ri + value;
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Thanks for your reply.
Your code does the opposite of what I wanted. I would change it to:
{
RectList::reverse_iterator next = ri;
*ri = *(++next);
} Thanks anyway.
Hosam Aly Mahmoud
|
|
|
|
|
Hi,
how can I achieve this behaviour? I have an SDI-Application with CScrollView-derived View-class and I want to show the user a CStatic-derived control which shows a statistic. But this statistic should be permanent at the same place even if the user scrolls.
I prepared the control to be a Child from my CMainframe-class but then it gets overdrawn by the View. Then I wrote blah->Invalidate() in the OnDraw of the View to get the control to be drawn AFTER the View. But now I have the problem that there are "visual copies" (silly expression but I hope you understand what I mean...) of the control when I scroll...
has anybody an idea how to solve this problem?
(sorry for my English, I'm German...)
|
|
|
|
|
C will allow me to do this
char *names[]={"aaa","bbb","ccc"};
but what this doesnt work for ints
int *array[]={{1,2,3},{4,5,6}};
I need to get this clarified !
|
|
|
|
|
dear all,
this may seem as a weird problem but still i think its worth askin' in this forum of TOPGUN programmers. is there any way to create controls diagonally or at any given angle. Eg a button inclined at say 45 degrees wrt to the dialog.
i just wondered if this can be done in windows or any other programming environment.
regards,
rIsHaBh
|
|
|
|
|
I have never tried it, but may be using regions will solve your problem.
Hosam Aly Mahmoud
|
|
|
|
|
It is possible to output text at any angle. None of the existing win32 controls will allow you to edit text at an angle.
look thru MSDN for
Rotating Lines of Text
You can rotate TrueType fonts at any angle. This is useful for labeling charts and other illustrations. The following example rotates a string in 10-degree increments around the center of the client area by changing the value of the lfEscapement and lfOrientation members of the LOGFONT structure used to create the font.
On top of this you would need to draw a rotated control on a transparent window and deal with hit testing etc and passing mouse events to underlying controls 'shadowed' by the transparent window (which would still have normal horizontal and vertical orientation).
All in all not work the effort
|
|
|
|
|
it comes around to the same question....how do i create rotated control?
rIsHaBh
|
|
|
|
|
dear all,
i'm creating controls at runtime in my dlg based mfc application. the number of controls is unknown to me. the problem is i'm allocating memory to the controls in a function....so i've no idea when and where to free the memory coz the control variables are decalared and accessible within the function only. i've attached a snippet of my code :- plz. tell me how to make the code cleaner and get rid of memory leaks
<br />
void CRms::CreateControls()<br />
{<br />
int iCtr;<br />
CRect rcLabel, rcDtc; <br />
COleDateTime dt;<br />
dt.SetTime(0,0,0);<br />
for (iCtr = 0 ; iCtr < iMaxEmails; iCtr++)<br />
{<br />
CString sCtr, sLabel;<br />
CStatic *pText = new CStatic();<br />
CDateTimeCtrl *pTime = new CDateTimeCtrl();<br />
GetLabelRect(iCtr, rcLabel);<br />
GetDTCRect(iCtr, rcDtc);<br />
m_arrayStatic.Add(pText);<br />
m_arrayDTC.Add(pTime);<br />
sCtr.Format("%d", iCtr + 1);<br />
sLabel = LABEL_CAPTION + sCtr;<br />
pText->Create(sLabel, WS_VISIBLE, rcLabel, this, ID_LABEL + iCtr);<br />
<br />
pTime->Create(DTS_TIMEFORMAT |WS_VISIBLE , rcDtc, this, ID_DTC + iCtr);<br />
pTime->SetFormat("HH:mm");<br />
pTime->SetTime(dt);<br />
bControlsLoaded = true;<br />
}<br />
}<br />
thanx and regards
rIsHaBh
|
|
|
|
|
How about adding the "newed" Pointers to a list.. and in the PostNCDestroy - Handler (maybe OnDestroy would work too) you are deleting all the items in the list ? (or when you add new Controls and don't need the old ones lurking around)
in your header file:
#include<vector>
std::vector<CDateTimeCtrl*> controlList;
in your implementation file:
CreateControls:
after CDateTimeCtrl *pTime = new CDateTimeCtrl();
controlList.push_back (pTime);
PostNCDestroy (or OnDestroy)
for (std::vector<CDateTimeCtrl*>::iterator i = controlList.begin(); i != controlList.end(); ++i)
{
delete *i;
}
Not the most elegant solution, but it should work.
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
NOPES! didn't work
thnx anyways
rIsHaBh
|
|
|
|
|
Could you use an autopointer (like the shared_ptr from www.boost.org[^]?
An autopointer is a class that behaves like a pointer, but it calls delete on the object it points to when it goes out of scope.
With the boost autopointer, you can even use the STL vector or list , something you should never try with the std::autopointer that comes with the library!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|