|
Hi everybody! I am developing an application in visual c++ (windows form application), and i want to set some of the parameters of my wireless card thru ndis (for instance the infrastuture mode). Can I do that ? how? any idea?
thaks!!!
Gloria.
|
|
|
|
|
how to write a code in VC++ for acquiring an image from the camera through activedcam card
|
|
|
|
|
jjvr wrote: how to write a code in VC++
What's going on? Did someone just outsource this project to you? What are the requirements?
led mike
|
|
|
|
|
!
Bram van Kampen
|
|
|
|
|
Hello again!
Using MFC, I am trying to implement an EDIT BOX and to print the content of it into a file.
I have associated a variable to the EDIT BOX, and that is CString varName.
When writing this variable into a log file, LOG.Write (varName, <not yet sure what length> ); , i get the result:
- for input: Shpid3r => S<square>h<square>p<square>i<square>d<square>3<square>r<square>.
I think that this is because using UNICODE character set, and every character in the CString is using 2 bytes, whilst using it into the Write() method, converts the string byte-by-byte.
Setting to use ANSI, creates an error (not finding a header file)... anyway my application should support unicode character set, even if logging will not meet unicode characters.
How should I do in order to get a proper logging?
Thank you!
|
|
|
|
|
You may:
- Convert your string to an ANSI one before writing it to the log (check out the T2A macro [^]).
or just use (a usually annoying feature of C++ )
- wofstream object to print the string (no need to convert it) to the log file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
grid consists 10 rows. i want to sort only 5 rows based on the column selected. how to do that.
|
|
|
|
|
Member 4157987 wrote: grid...
Which one?
"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
|
|
|
|
|
Member 4157987 wrote: i want to sort only 5 rows based on the column selected. how to do that.
Find out what colum is selected, and sort accordingly. Just ALWAYS make sure that you have more than one thing to sort!!
Bram van Kampen
|
|
|
|
|
I do'nt know what grid are you using : anyway I think in most cases you will
have some sort of callback of the type :
int onCompareTwoRows(int row1,int row2,int columnIndex){
}
where you define your comparision mechanism that would then be called by the sorting algo, in the grid implementation you are importing.
based on the column selected (columnIndex) you can just apply the comprarision on the 5 desired rows only :
int onCompareTwoRows(int row1,int row2,int columnIndex){
if(columnIndex==theColumnIwant){
if(row1 && row2 are in the 5 chosen rows set){
return -1,0 or 1 accrding to context..
}
}
else
return 0;
}
"The Awaited Saviour", Mohammed Baqir Al Sadr
|
|
|
|
|
I'm trying to override the global new operator:
void* __cdecl ::operator new(size_t nSize)
{
...
}
It is called for almost all cases. However in case of std::string allocation it does not work. The internal allocator of the std::string object still calls the default (CRT) global new allocator.
Any idea why?
Thanks,
Abyss
|
|
|
|
|
Maybe the STL authors want to control the allocation process just as you are trying to do.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Not sure, because for std::vector my new operator is called. And in some cases for the std::string too. In the particular case the given std::string calls my new operator, however my delete operator is not called. This of course is toxic, because the default CRT delete tries to release my pointer and the application crashes. My delete operator is defined as:
void __cdecl ::operator delete(void* ptr)
{
...
}
Not sure what is wrong here...
Thanks,
Abyss
|
|
|
|
|
You do know you have the ultimate documentation, don't you?
(That would be the source code)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Bram van Kampen
|
|
|
|
|
|
It means:
You designed the Software, and You wrote the Code, so You are the best person in the world to know what's it supposed to do or not do in the firstplace. None of us are in that priviledged position.
Bram van Kampen
|
|
|
|
|
Hello evryone.
How can I pass arguments call info + simple function address to a certain code that would
then be able to succefully call that function ???
For example I have a function like :
void sendHello(char* hello,int destID);
I want to pass to a certain code block A, the address of that function by mean of a void* variable, and
also pass someother "metadata" about arguments order and types, so that the code block A can
succeed to callback that function.
Is there sort of something that would like :
A::storeFunction( void*, metadata??)
such for example I can easily call :
A::storeFunction(sendHello,{{"byString","hello"},{"byInt","destID"}});
before the code block A can somehow, at a certain time needed succed to call the function he stored ??
??
Thank u in advance.
"The Awaited Saviour", Mohammed Baqir Al Sadr
|
|
|
|
|
I'm not sure if I fully understood your question but it would be interesting for you if you serach for "functors" or "function objects". Instead of working with functions directly, you wrap then into a class so that it is easier to manipulate.
|
|
|
|
|
Thank you Cédric for the reply.
I took a look at functors yesterday.
Unfortunately the problem is not solved : (The code below uses functor implementation found in
cppfunctor.sourceforge.net) :
Using functors then I suppose to declare a variable in block A such :
event< void, char*, int> functorObj; in order to be used as wrapper for the
void sendHello function (void sendHello(char* hello,int destID)) (see example in first msg).
then I would set it as :
functorObj.assign( mkFunctor<void,>::create(sendHello) );
OK This is good, but as you notice the code block A that holds the functor declaration presupposed the prior information of the function arguments (their type and order).
The functors would help me avoid the case where I would need to define a type for each function pointer :
typedef void (*Type1) (char*,int);
typedef void (*Type2) (char*,char*);
..etc
instead just worry about the arguments number, types and order at the object instantiation :
event< void, char*, int> functorObj1;
event< void, char*, char*> functorObj2;
But this is exactly not what I want. Instead I'd like to remove the hypothesis that the code block A have the prioir information about functions arguments types and orders.
..
"The Awaited Saviour", Mohammed Baqir Al Sadr
|
|
|
|
|
hINTModuleState wrote: Instead I'd like to remove the hypothesis that the code block A have the prioir information about functions arguments types and orders.
That's something really strange: when you want to 'execute' a function, you always knows which arguments you have to supply to the function.
So in your case you are telling me that somewhere you 'define' a function (code block) but leave the arguments definition for later. That feels strange because how could then your block of code receive anything if it is not known at that time ?
|
|
|
|
|
hINTModuleState wrote: I want to pass to a certain code block A, the address of that function by mean of a void* variable, and
also pass someother "metadata" about arguments order and types, so that the code block A can
succeed to callback that function.
I Don't know if I understand your question correctly, but it occurs to me that you want to:
1) Declare a pointer to a function taking an Argument;
2) Refer to that pointer later by calling the code the function pointer refers to, using the arguments supplied.
You quote Class or Structure Member functions, Their'e unbeleavibly more tricky. Best first get familiar with global functions:-
As Follows:-
<br />
typedef void (*PFN_MYFUNCTION)(LPCSTR pStr);<br />
<br />
PFN_MYFUNCTION mf=puts;<br />
mf("Hello World");<br />
<br />
Bram van Kampen
modified on Monday, November 3, 2008 9:59 PM
|
|
|
|
|
Thank you for your reply.
Unfortrunately your solution is not sufficient.
OK It is good as far as I'd like only to remove the hypothesis that the code block A knows the exact implementation of the function : ie just declare a pointer like you put, then an external code block
B would arrive and bring the "puts" function and pass it as a value for the pointer mf in A.
What I'm much worried to do, instead, is to also remove the prior information about arguments' types and order.
In your solution : PFN_MYFUNCTION is a type for the (void)(LPCTSTR) functions only.
Instead how can develop a code block A where may be I would only store a void*, then externally
set that void* with functions of any type with the only possiblity to pass arugument info metadat at exection time ??
Thank you in advance.
"The Awaited Saviour", Mohammed Baqir Al Sadr
|
|
|
|
|
well, If I understand correctly, you could create structures to hold the arguments. Pass as argument a pointer to such a structure, and inside your function recast to a pointer to the correct type of structure.
Another possibility is:
<br />
typedef DWORD (*PFN_MYFUNCTION)(int Type,...);<br />
There Type specifies the type of argument list to expect. You must however be able to have the calling context and the callee agreeing on the argument list.
Bram van Kampen
|
|
|
|
|
Hello everybody,
a certain external library or object in memory disabled sometimes my CDialog Application.
I like to handle this message, so i can write into a log file some informations
to find out what time or why this disable is executed.
a if(pMsg->message == WM_ENABLE) into the PreTranslateMessage don't fire if i execute
manually a EnableWindow(FALSE);
Is there a possibility?
Big thanks for help
|
|
|
|