|
ok, thanks for that. it accepted passing CEdit variable into a function that takes a LPCTSTR string.
However, i still cant infile >> a LPCTSTR.
Ie, here's my code:
void function(LPCTSTR stringthing)
{
string filename = "stringdata.dat";
ifstream inFile(filename.c_str());
inFile >> stringthing;
}
this returns the error
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'LPCTSTR' (or there is no acceptable conversion)
i tried using inFile >> into a string variable, then setting my LPCTSTR = to that string contents...but that said it cant convert.
*.*
|
|
|
|
|
void function(LPTSTR stringthing)
{
string filename = "stringdata.dat", str;
ifstream inFile(filename.c_str());
inFile >> str;
strcpy(stringthing, str.c_str());
}
|
|
|
|
|
thanksa again, but that code returned an erro saying i cant convert from LPCSTR to char*.
i've foudn a way (the only way that my program can be run in another area of the code) where all i have to do is return a CString. but, this takes me back to teh beginning, because i cant use infile>> for a cstring object, i cant convert a string into a cstring if i try infile >> string, and i cant convert from a string to an LPCSTR if i try inFile >> string.
buggar this is annoying. why cant i just go
CString foo;
string bar;
infile >> bar;
foo = bar;
return foo;
*.*
|
|
|
|
|
I don't know what it is you are trying to do, but all of my suggestions have been tried and tested with positive results. I'm sure there are better ways of accomplishing the task but these are answers to your question(s) nonetheless.
void function( LPTSTR stringthing )
{
string filename = "stringdata.dat", str;
ifstream inFile(filename.c_str());
inFile >> str;
strcpy(stringthing, str.c_str());
}
void main( void )
{
char buf[1024];
function(buf);
printf("]%s[\n", buf);
}
When the answer appears to be wrong, don't discount the possibility that the wrong question was asked! - Anonymous
|
|
|
|
|
all done!
thanks david
*.*
|
|
|
|
|
I have a very basic DirectX app which just draws a number of surfaces on the screen from bitmaps. However if i don't first set a palette to the display, the colors are awfully messed up. I can then use CreatePaletteFromBitmap() to create a palette and attach it and then they are better. But the problem is that i'm drawing several piecies of an image seperately so they form one large image so i can only create a palette from one of these pieces, so other piecies can contain other colors so the end result will be that some colors still aren't perfect. How should i handle this? Should i make a small bitmap that has all the colors that are used in paint shop pro or something and create the palette from there? Or can you skip the palette, but do the bitmaps need a different color mode or something?
Kuniva
--------------------------------------------
|
|
|
|
|
Could somebody tell me what string's they have in this key....
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug
for 'Debugger' and 'PreVisualStudio7Debugger'.
I tried to get rid of the splash screen appearing whenever VS JIT debugging starts up, as described in Wintellect article[^]but whatever I've done, the debugger won't start up at all now. I'm using VC++6 in VS6 btw
Thanks,john
|
|
|
|
|
I don't have those values. Perhaps one of these MSDN articles will be of help:
Q103861
Q188296
Q175644
Q121434
Q172779
Q138786
|
|
|
|
|
Thanks David, got the info i needed in Q103861
|
|
|
|
|
For some reason, Visual Studio 6 is not recognizing the VK_* virtual key codes as being defined, even though they should be defined by default, and I added the line #include <winuser.h> and even added the .h file to my project... bah! What should I try? Thanks!
|
|
|
|
|
What key? Post the code and the error.
Kuphryn
|
|
|
|
|
I'm having trouble comparing two Floating Point Const at Compile time. Here is an example:
const Float64 EducationGoal_Original = 0.0;
const Float64 EducationGoal_1_0 = 1.0;
const Float64 EducationGoal_2_0 = 2.0;
const Float64 EducationGoal_CURRENT = EducationGoal_2_0;
.
.
.
#if EducationGoal_CURRENT != EducationGoal_2_0
// return error
#endif
So...basically if someone adds a new EducationGoal version i want to make sure he updated all the code associated with it.
For some reason, the #if will always return true with floating point #s
Any Ideas?
|
|
|
|
|
I'm not sure that the preprocessor can read into a value of a const... Anyway, try to replace the const definition by a #define. I know this is not the correct way to create constants, but use it to check if the #if works.
|
|
|
|
|
You can't compare like that. To compare in the preprocessor, you need to #define the constants. const float s are not recognised by the preprocessor. Their "value" is 1 if they exist, and 0 if they do not (I think, from memory). To get this to work, use:
#define EducationGoal_Original (0.0);
#define EducationGoal_1_0 (1.0);
#define EducationGoal_2_0 (2.0);
#define EducationGoal_CURRENT (EducationGoal_2_0);
.
.
.
#if EducationGoal_CURRENT != EducationGoal_2_0
#endif Even better would be to use integers, separated into major and minor version numbers, since floats are not accurate, and comparing them for equality is not a good idea.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
I have this big problem:
from an exe written in VB i call a function in a Dll written in VC++. This function must allocate an array of structs ant restitute it initializad to the calling process.
To be more clear I'll write what I would do if the exe is in C++:
The struct could be something like this:
struct _Data
{
int Data1;
VARIANT Data2;
};
In the dll there is a function like this:
extern "C" void WINAPI DLLReadArray(_Data **Array)
{
*Array= new _Data[10];
// For example I fill the array elements whith some data
}
from the VC++ exe I would do something like:
void CallDLL()
{
_Data *Array;
DLLReadArray(&Array);
// Some operations on the array elements...
delete[] Array;
}
NOW:
I do not have any idea on how to do the last thing if the exe is written in VB.
The structure in VB could be declared as a Type ???
Type Data
Data1 As Integer
Data2 As Variant
End Type
How to pass the DLL a "pointer" in VB ????
Please, any help would be very very appreciated !!!
thanks all.
Sorry for my poor english.
Carlo Comino
Italy.
|
|
|
|
|
The only method (that i'm aware of) to pass arrays between VB and VC is via SafeArrays. VB uses SafeArrays internally, so the work is on the C side to unpackage/use the data in this format.
onwards and upwards...
|
|
|
|
|
thank yuo very much for your fast replay !!;)
Do you also have an example of the C part ??
thank you again!!
Carlo.
|
|
|
|
|
Hi all,
i have an ATL project. i've created a dialog that inherites CAxDialogImpl.
in the resources of the dialog i've placed a list control.
is there a class that wrapps it in ATL? same as CListCtrl in MFC???
can any1 help?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Check the WTL header (AtlCtrls.h). There you should find a template <class TBase> class CListViewCtrlT which in turn will be specialized into a CListViewCtrl .
|
|
|
|
|
thanks man.....
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hello!
I have an application where different groups can do different things. E.g. Group Sales can add an customer. Group Pack can print out a pack order but not add a customer. etc...
I could of cause create my own control system but since Windows already has this kind of system and it is probably much better (security wise) than anything I could create.
How do I use Windows Access Control System in my own application?
I need to be able to create a number of groups and give them rights in my application.
TIA
Anders Eriksson
Sonork 100.21825
|
|
|
|
|
If this is a SQL Server app, I would suggest looking at the TSQL function IS_MEMBER ({'group' | 'role' }). This provides rights / membership checking of both WindowsNT groups and SQL Server Roles.
Otherwise, you can use the NetGroupXXX functions, but your app needs to be running under certain priviledges and this is a pain.
onwards and upwards...
|
|
|
|
|
|
|
Anyone know if there is some API for the zip features in XP?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|