|
Yeah... GetBuffer doesn't work.
But this works:
char* str = (char*)(LPCTSTR)str2
|
|
|
|
|
USAFHokie80 wrote: Yeah... GetBuffer doesn't work.
hum, correction : GetBuffer DOES work, but it's not there for that.
|
|
|
|
|
That's a horrible cast, and a good example why casts are bad. If you needed the
cast to get that to compile then you did something wrong.
It should be
const char* str = str2;
If your CString is always based on a "char" character type, then you
should be using a CStringA.
Mixing generic and fixed character types negates the usefulness of
generic character types (i.e. your code will fail on a Unicode build).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
toxcct wrote: Moreover, the OP seem not to really know what he wants that for, so instead of saying amen to a query-for-code, better understand why such a thing is asked for...
better understand stuff! BAH, we don't need no freakin understanding we just writ cods plezzzzz
led mike
|
|
|
|
|
lol... was it urgentz ? I didn't read so, so it means I had time to think about design !
|
|
|
|
|
Is there an easy way to search a CFile for a string and get the index?
|
|
|
|
|
USAFHokie80 wrote: Is there an easy way to search a CFile
No you have to search the file line by line
USAFHokie80 wrote: get the index
The index based on what?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
the index for a file position where the string begins.
|
|
|
|
|
|
Yes, assuming you put the contents of said file in a searchable buffer
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I want to check whether the current user has the rights to delete a file.
I've looked at two approaches. The first is to call CreateFile with the creation disposition flags set to OPEN_EXISTING. This would give the right answer most of time, apart from when the user has the delete permission explicitly disabled.
I've also looked at GetEffectiveRightsFromAcl. This looks as if this would do it for local files, but the documentation states A trustee's group rights are enumerated by GetEffectiveRightsFromAcl on the local computer, even if the trustee is accessing objects on a remote computer. This function does not evaluate group rights on remote computers. which implies that it's not going to be reliable on a network drive, which may be hosted on a different OS anyway.
Could someone suggest a better way of doing this?
|
|
|
|
|
Hello
I am doing computer engineering and i needed some guidance
regarding my project.
1st of all i want to know whether it is possible to disable usb ports
and CD rom "POWER" through VC++.
If yes then could you please guide me on it?
Thanks
|
|
|
|
|
I don't know about removing power but you can lock volumes with DeviceIoControl() with the FSCTL_LOCK_VOLUME which means that your process has exclusive access to that volume. Take a look at the documentation here. You could do this with the CD drive.
You can disable USB ports from the registry (which can be done programatically); take a look at this article for more info.
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
modified on Friday, August 22, 2008 8:44 AM
|
|
|
|
|
thank you so much for ur replies Perspx, Jijo raj and Vikas..
but r u sure that after disabling the ports from registry , the power to the port will b cut??
|
|
|
|
|
ameyakoshti wrote: 1st of all i want to know whether it is possible to disable usb ports
To disable USB ports, check this[^]. You have to programatically access the registry and set the key.
ameyakoshti wrote: and CD rom "POWER" through VC++.
I hope someone else will shed light on this.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Hello everyone,
I want to find some sample codes about how to do .Net passport authentication if I am writing a client using native unmanaged C++. But nothing found during search.
Does anyone have any referred samples or documents?
thanks in advance,
George
|
|
|
|
|
George_George wrote: But nothing found during search.
Does anyone have any referred samples or documents?
Well I don't and I am not going to do your Googling for you today. I have more interesting things to do.
led mike
|
|
|
|
|
Hi led mike,
I have Googled for quite some time but find nothing about prorgamming with .Net passport authentication (all I found is dealing with how to register a .Net passport), it is why I come here to ask for referred documents. Any ideas?
regards,
George
|
|
|
|
|
George_George wrote: I have Googled for quite some time but find nothing about prorgamming with .Net passport authentication
So did you find this yet George?[^]
led mike
|
|
|
|
|
Hi led mike,
Good document! Is Windows Live ID authentication the same as .Net passport authentication?
regards,
George
|
|
|
|
|
Hi led mike,
I read through the document and it looks like an SDK for a web site. But my application is not web site, it is a client side C++ program, which access some web page for data rendering, and I need to use the passport/Live ID to access the web page.
Any ideas or comments?
regards,
George
|
|
|
|
|
George_George wrote: But my application is not web site, it is a client side C++ program, which access some web page for data rendering, and I need to use the passport/Live ID to access the web page.
George, in my opinion explaining all this to you is beyond the scope of an internet forum conversation. Maybe you should spend some time studying the materials that Microsoft has made available to developers for integrating Windows Live Authentication.[^]
At the end of the day, these are all services provided by Microsoft and they work the way they made them work, period. That's what you must deal with rather than what you might want it to be. Obviously the most prevalent use of integration is for Web Sites. This does not necessarily mean that C++ integration is not possible but, if it is possible, you may have to develop it yourself rather than being provided with a function that does it for you.
"Web Authentication works by sending your users to the Windows Live ID sign-in page by means of a specially formatted link."
led mike
|
|
|
|
|
Thanks for your advice, led mike! For the link you provided, which one(s) are dealing with authentication? I checked a few, but not dedicated for authentication purpose. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: For the link you provided, which one(s) are dealing with authentication? I checked a few, but not dedicated for authentication purpose.
I don't that any are dedicated to authentication. You seem to need an overall better understanding of the Platform you are trying to interface with.
led mike
|
|
|
|