|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Am working on VC 6.0, though have a small prob...
Suppose the declaration s like
classA[] obj = new classA[]{};
now when i try to access
int k = 0;
obj[k] = numeral;
it says array index out of bounds, tat means it needs a max size right?
so how do i define a max no of elements in the array size?
|
|
|
|
|
What about:
classA *obj = new ClassA[some_number];
obj[0] = numeral;
obj[1] = numeral;
...
obj[some_number-1] = numeral;
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Forgot to mention, have to dynamically increase/decrease the size of the array!
|
|
|
|
|
Why don't you use a vector from the standard template library ? It offers all this flexibility and is much more secure.
|
|
|
|
|
this is not VB, so no possible directly.
is you have to increase/decrease the size of your array you could either do it yourself :
- allocate a new array with the new size
- copy the elements to keep from the old array
- destroy the old array.
or use a library that already do that for you :
- std::vector<>
- std::list<>
- some other STL containers...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
For debugging purposes, I am going to be basically hijacking a function that handles a variable argument list. This function convers the Variable Argument List (VAL) into a va_list variable and passes it to another function to process the variable argument list (like how one would make a call to _vsntprintf ).
I can descern the number and types of arguments from other parameters passed to the function, so I want to be able to trace information on the parameters passed. My question is this - it is safe (not possible, but safe) to call va_start multiple times on the same va_list variable (in the same function) to reset the VAL?
I cannot find code that does this, nor information that details the safety of doing so.
Thoughts?
Thanks!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I've never encountered a mention of this scenario myself, but from the possibilities to implement this, it is OK. (the two implementation I've seen so far use a pointer to thestack, initialized by va_start, incremented by va_arg, and a do-nothing operation in va_end)
The question is: how portable do you need it?
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
There are no portability concerns here - this is, and always will be, a Win32 implementation. Only concerns would be compiler differences if/when this implementation is built on a newer version of the compiler.
My concern is one of works vs. correct. It might work, but is it correct to do so, so I will not expect any side-effects in the future.
I do not expect it to be a problem, because va_start just resets the internal pointer to the beginning of the argument list, and there seems to be no other state stored outside of calls to va_arg , but it is always worth asking to make sure noone else has tried this and bombed!
Thanks!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: but it is always worth asking to make sure noone else has tried this and bombed!
tell us if it does
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
Not only safe, it's part of the design. To be technically correct, you should use va_end before using va_start the second time, though in VC++, it doesn't really matter (since it allocs no memory.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
James R. Twine wrote: My question is this - it is safe (not possible, but safe) to call va_start multiple times on the same va_list variable (in the same function) to reset the VAL?
Yes. No problems at all. I've done it a few times. For safety, call va_end() in between, but in Win32, it's not required in any implementation I've seen. Other OSes might need it though.
Ryan "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"
|
|
|
|
|
I am geeting error
"cannot convert parameter 2 from 'char *' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast"
I think we need to change character set from UNICODE to MULTIBYTE( _MBCS instead of _UNICODE ) It gets compiled on VC6. The reason may be at that time the default character set wasn't Unicode.
I don't want to use _T() macro.
We can change character set through IDE this way-
Go to project properties, select ConfigurationProperties, General and you have an option called Character Set. The default is Use Unicode Character Set. Change it to Use Multi-Byte character set.
But how this can be done through command prompt. I need to use /d
to change option of cl.exe. But how exactly it is done?
Vaibhav
|
|
|
|
|
I am trying to build a project on VC2005. We work on command promt
Vaibhav
|
|
|
|
|
Hello to all. I am searching for information about how I can create an additional plugin that can be installed on a browser. If anyone has an idea from where I might read something about how this is done I'll be very grateful for the help.
Regards, Tsvetelina Ivanova
|
|
|
|
|
Search for browser helper object (BHO).
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Am a novice in Vc++, actually, i wanted to call a function which outputs the data in Byte for repeted no of times to set the output data in an array(such a array of bytes), but am having compilation error? am using a "for loop" to call the function for no of times, until the output data is stored in an array. what am doing is right?is it possible to do so?
shrin
|
|
|
|
|
please show us your code to see what you're doing wrong, and tell exactly what the compiler returns you as an error !!
ps: put your code within <pre></pre> tags...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
srija wrote: am using a "for loop"...
Have you seen here?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
hi,
i Create a application in ATL COM application,( for dll based application)
with simple get and set method for adding 2 nos
which is very similar to the link
http://www.codersource.net/atl_tutorial_events_properties.html[^]
but after build the appliaction i get error as
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class csimpleobj="">' : cannot instantiate abstract class due to following members:
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall ISimpleObj::total(void)' : pure virtual function was not defined
E:\templqw12\SimpleAtlCom\SimpleAtlCom.h(106) : see declaration of 'total'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class csimpleobj="">' : cannot instantiate abstract class due to following members:
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall ISimpleObj::total(void)' : pure virtual function was not defined
E:\templqw12\SimpleAtlCom\SimpleAtlCom.h(106) : see declaration of 'total'
C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class atl::ccomobject<class="" csimpleobj=""> >::CreateInstance(void *,const struct _GUID &,
void ** )'
SimpleObj.cpp
reply me
send reply
|
|
|
|
|
Dear All
Can anyone help me to run a process before winlogon?
I have already tried to get the handle of winlogon with FindWindowEx but failed.
Please Help me.
Mohiul
My name is Mohiul,Nick name Rony
|
|
|
|
|
I think that you need to write a device driver in order to get something that you know will start before other system processes (you need a disk driver loaded in order to load winlogon from disk).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
A service might be what you are looking for. It depends on what problem you want to solve.
More information about services and how to write a service you will find here[^].
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Thanx for Replies.
I already running my application as a service.
But It activated after the windows logon.
My Aplication is a Scanner based application which will do something in
logon screen.
So please help me how I get the handle of winlogon???
Mohiul Rony
Programming is better than a lover...
-- modified at 23:05 Thursday 23rd February, 2006
|
|
|
|