|
The string in buffer is the value. It's stored in an encoded form, as described here[^]
|
|
|
|
|
Hi,
I would like to use bitwise operators (specifically, & and |) on a pair of std strings of equal length. At the moment I am simply iterating through both strings and carrying out the operation on each byte individually. However this seems a little inefficient to me, and I would prefer to use the bitwise operator on the whole string, as a chunk of memory.
Is it possible? Is there a more efficient way of doing it that iterating through the strings? The strings in question are quite long, a few thousand bytes.
Thanks for any ideas
Mick
|
|
|
|
|
mellib wrote: However this seems a little inefficient to me, and I would prefer to use the bitwise operator on the whole string, as a chunk of memory. mellib wrote: Is there a more efficient way of doing it that iterating through the strings?
The only efficiency you'll gain is in lines of code - the performance would be exactly the same - the only way you can apply a bitwise operator to a memory range is to iterate through it. You could iterate through the strings a longword at a time instead of a byte (although the only way of doing that probably makes unwarranted assumptions about std::string implementation details).
Seriously - measure the performance and determine if it has a serious impact on your code before trying to optimise.
|
|
|
|
|
Hi
I want to read cookie value for a particular site from VC++.My
project is an IE Toolbar which is using ATL,COM and not using MFC.I
need to get the cookie value for a site.I have tried with
internetGetCookie function,but everytime it is returning false.Can
anybody plz help me with some sample code?
|
|
|
|
|
Hi
I have developed an IE toolbar in ATL,COM,WTL and without using MFC.This toolbar is for a particular site.This is having a sign in button on clicking which user will be navigated to sign in page of our site.After signing in the toolbar will be changed,means it will be having some extra buttons on it.when the user will click logout,the toolbar will be back to its previous state.Means this is like yahoo toolbar.Upto this part I have made it perfect.I have done MySql database connectivity from my toolbar.Now the problem what I am facing is that:
if any user logs in our site and then he dose not do anything in the site for 20 minutes his session expires,means nothing will work in the site after idle 20 minutes,the user needs to sign in again.Now in that moment also I need to change the toolbar(I need to get the the toolbar in signed out state).How can I do it?Can anybody plz help me with some sample code?
|
|
|
|
|
Hello all,
Please help me..
I am trying to compile a code.
In debug mode compilation it is not showing any error.
but if I compile it in win32 Release MinDependency mode it is showing below errors..
mfcs42.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MainHook.obj
mfcs42.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MainHook.obj; second definition ignored
Creating library ReleaseMinDependency/MSNdll.lib and object ReleaseMinDependency/MSNdll.exp
ReleaseMinDependency/MSNdll.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
please let me know what I have to do? Please...............(^_^)..........
Rahul Vaishnav
|
|
|
|
|
Rahul Vaishnav wrote: mfcs42
implies you're on the wrong discussion board (this one ain't for MFC). But here's a hint - you don't define DllMain for MFC projects - you override InitInstance of your CWinApp-derived class.
|
|
|
|
|
Hi Rashmi,
I don't know much about MMCSnapin...
but i have used below function for getting key press event in VC++(MFC,Dialog Based application)
May be it will help you...use Asci of F5 key VK_F5
BOOL CMyClass::PreTranslateMessage(MSG* pMsg)
{
if((pMsg->message==WM_KEYDOWN))
{
if(pMsg->wParam==13)
return FALSE;
if(pMsg->wParam==VK_ESCAPE || pMsg->wParam==VK_F5)
pMsg->wParam=NULL ;
}
return CDialog::PreTranslateMessage(pMsg);
}
Rahul Vaishnav
|
|
|
|
|
Hi Rahul..
Thanks for ur reply...
actualy m working in ATL....this post doesn't help me much..but yes...I got a clue from ur post that helped me much to proceed in a right direction,,
thanks again
|
|
|
|
|
STDMETHODIMP CTryoutATL::ConcatenateString(long count, BSTR *ReturnVal)
{
// TODO: Add your implementation code here
BSTR outputTempString;
BSTR outputString = new OLECHAR[30];
BSTR tempString = new OLECHAR[30];
swprintf(tempString,L"The KILLER ");
BOOL bFirstTime = TRUE;
for(long i =1; i < count ; i++)
{
BSTR tempString = new OLECHAR[30];
swprintf(tempString,L"This Ilanthendral kills %ld\n",i);
outputTempString = new OLECHAR[30*i];
if(!bFirstTime)
{
wcscpy(outputTempString,outputString);
wcscat(outputTempString,tempString);
}
else
wcscpy(outputTempString,tempString);
bFirstTime = FALSE;
delete [] outputString;
delete [] tempString;
outputString = outputTempString;
}
*ReturnVal = outputTempString;
return S_OK;
}
for thendral
|
|
|
|
|
- The outer
tempString will always leak one allocation. - If
count == 0, outputString will not be deallocated - If
count == 0, outputTempString will never be assigned to, so you'll return an indeterminate value
In addition - these aren't valid BSTR s. BSTR s contain more information than just raw characters (for example, string length), so should always be allocated using SysAllocString , SysAllocStringByteLen or SysAllocStringLen and deallocated using SysFreeString .
I'd suggest you read the documentation for CComBSTR or _bstr_t and then use one of them rather than BSTR . These BSTR wrappers make BSTR management much easier. BSTR management much easier.
|
|
|
|
|
Hello,
Has anyone any experience with Forward Referencing in Attributed COM programming in Visual Studio 2005 ?
In Visual Studio 2003, I was using the following to forward reference an interface.
[export] __interface IMyDefinitions;
This basically used to insert a line in the IDL file "__interface IMyDefinitions", for forward referencing.
But it no longer works in Visual Studio 2005. No such line is inserted, and hence it fails during IDL compilation.
Thanks & Regards,
Arun Gupta
|
|
|
|
|
I want to use the set and map templates for fast log(n) search (using lower_bound, equal_range).
To do that i have to ensure that my containers are sorted.
Now here is my first question:
Do i have to call sort myself or does the containers sort themself?
If they sort themselves: When do they sort? Upon insertion (When i call insert(), etc)? or upon access (When i call lower_bound(), equal_range(), etc)? or upon deletion (erase(), etc)?
If they do not sort themselves: When should i sort? After insertion or before search()?
Wich sort function should i use? (sort or stable_sort())?
Now here is my second question:
I am using the set and map to contain pointers to my "GameObject" class (such as "wall", "room", "enemy" etc) - so how should i define a function-object or function to sort them out? Thought of sorting them by memory adress (bad idea)? And is there a default sort function for pointers?
/Jimmy
-- modified at 18:29 Monday 17th September, 2007
|
|
|
|
|
JimmyAberg wrote: Do i have to call sort myself or does the containers sort themself?
The containers keep themselves ordered.
JimmyAberg wrote: If they sort themselves: When do they sort?
On insertion
JimmyAberg wrote: I am using the set and map to contain pointers to my "GameObject" class (such as "wall", "room", "enemy" etc) - so how should i define a function-object or function to sort them out? Thought of sorting them by memory adress (bad idea)? And is there a default sort function for pointers?
By default, pointers used as keys will be sorted on address.
As for what sort function to use...well, what's the key? What attribute of your class are you going to use to look for an object? Name? Unless you can work that out, you might just as well use a std::vector to hold your objects.
Anyway - the function object should be defined like this (the bits in italics should be replaced by your own code):
struct YourOrderingFunction : public binary_function <KeyType, KeyType, bool>
{
bool operator()(const KeyType& _Left, const KeyType& _Right) const
{
return true if _Left is less than _Right;
}
};
PS - if you're doing a lot more lookups than insertions, you may find that you get better performance using a sorted std::vector that you search with std::lower_bound , std::equal_range or std::upper_bound .
PPS - if you have multiple keys, do yourself a favour and look at the Boost Multi-Index Containers[^].
|
|
|
|
|
I am having a issue with tab order for controls in a WTL dialog. The dialog in which controls are present is a child dialog which sits in a parent dialog. I've tried using the tab order layout but that is of no use.
Can anybody help me on this?
Thanks in advance.
Sam
|
|
|
|
|
Hi all
I have prepared an MMC..i have to set image for scope pane item and as well as same image for items shown in resultpane...so what functions shuld i use...
plzz help me its very urgent...
thax in advnace
|
|
|
|
|
Hi All
I have to add comboboxes in a listcontrol while initializing a dialog containing that list control.if anyone can expalin using some code ..how to perform this..this wud me very helpful to me....thanks to all in advance..
|
|
|
|
|
I have made a toolbar for a website and what i want is when the user login's in the website with a username and password i want to establish a database connection to MYSQL database and execute query for retrieving data.
Can anyone give me the code. I am USING WIN32 and NOT MFC.
Thanks in advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
I'd suggest you look at the appropriate MySQL documentation:
Those should tell you how to connect to a MySQL database.
|
|
|
|
|
thanks for the link you gave me for the tutorial.
I am able to connect to MYSQL database from my win32 application and also able to query the database.
Thanks for your help.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
hi
i am working with VS2003 and i got a problem with accessing to list member functions.
i have :
<br />
class company<br />
{<br />
public:<br />
CString comapany_name;<br />
int Number;<br />
list<worker> work;<br />
<br />
public:<br />
time_of_work(int ID);<br />
company(void);<br />
virtual ~company(void);<br />
}<br />
and
class worker
<br />
{<br />
public:<br />
CString name;<br />
int ID;<br />
int hours<br />
<br />
public:<br />
get_name(int ID);<br />
worker(void);<br />
virtual ~worker(void);<br />
}<br />
when i try to get the member function from the a company iterator that don't work:
<br />
list<company>::iterator comp;<br />
comp->..... it give me just a list of company methods and variables<br />
and if i try the dot('.')
<br />
comp. i can get {iterator, operator+,operator-,operator*,operator= }<br />
how can i get the list of the member functions ?
|
|
|
|
|
Your question isn't clear - for which class do you want a list of methods?
|
|
|
|
|
Can a Key in a map contain the combination of two variables?
Tough Time Never last, but Tough People do.
|
|
|
|
|
I think yes! through pair
|
|
|
|
|
Can you be more specific?
Steve
|
|
|
|