|
it is there in the projectDlg.h file
|
|
|
|
|
It should go in the stdafx.h file.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Plus using classwizard I am not adding all the zillion classes within Excel . I am adding the classes that I need . Would that be a problem ?
|
|
|
|
|
i am doing some Excel automation stuff and needed to convert a char * to a VARIANT
SysAllocString needs a unsigned short * which doesnt convert correctly from a char *
Is there a function that will allow me to assign a char * value to a VARIANT ?
|
|
|
|
|
Take a look at the _variant_t wrapper class.
|
|
|
|
|
I need to pass a pointer to a _com_ptr_t object (as created by the #import directive), but I can't take the address of it, since the & operator is overriden by the class to return the underlying interface pointer.
eg:
void f( ADODB::_RecordsetPtr *pRs1, ADODB::_RecordsetPtr *pRs2 )
{
if ( NULL != pRs1 )
{
}
if ( NULL != pRs2 )
{
}
}
ADODB::_RecordsetPtr pRs;
f( &pRs, NULL ); Yes, I can pass it by reference, but I want a pointer since the object is allowed to be NULL if it is not required.
Any ideas?
Thanks!
|
|
|
|
|
Always pass smart pointers by value; it's cheap and that is what they are there for. You can test the smart pointer for NULL just like a regular pointer: if it hasn't been set to anything, converting to bool will return false. (you can just use
if ( ptr )
which implicitly converts to bool)
|
|
|
|
|
Wait a second, I think a light just came on in my head...
I need to CreateInstance on the pointers that I need and then pass those to my function. Any pointers that have not had CreateInstance called on them will be false, so I know I cannot use them...
Hmmm... that will work, but I was hoping to be able to get my function to call CreateInstance on the smart pointer if it was not NULL, thereby creating it for me.
Thanks for the insight!
|
|
|
|
|
I am porting a C++ app written on Unix over to Windows using VS. It balks at a function declared and defined in the h file:
template <class T>
T *
s_file::port_data (unsigned int line) {
return ((T *) _port_data + line * _port_samples);
}
I am going to have to write overloaded functions to replace this, but is there a simpler resolution? Apparently VC does not like a template fn embedded in a class ??
Thanks,
Appreciate your help,
ns
|
|
|
|
|
try to resend it and watch for < and >, you're in HTML
Which VC you use for the compilation, the VC6 have only limited support for templates, VC2003 (7.1) supports nearly all features.
I normally used template functions in a class, so there shouldn't be a problem (VC7.0 and 7.1)
|
|
|
|
|
The < > signs in your post were swallowed by HTML. Modify your post and click on the "Do not treat ..." checkbox.
Also, exactly what error message(s) are you getting?
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Sorry:
template <class T > T * s_file::port_data (unsigned int line) { return ((T *) _port_data + line * _port_samples); }
THe compiler complains that this function port_data has not been declared (though this inline is in the .h file....).
Thanks
ns
|
|
|
|
|
Try putting the function definition with the declaration inside the class definition. One less thing for VC to be confused about. I have done similar things in VC 6 so you ought to be able to get it to work.
|
|
|
|
|
Nope. Just tried it..same error:
"_p_data' is not a member of of s_file..........
Thanks though. You can see my overloading workaround dilemma in my next post if you like:
Many thanks,
ns
|
|
|
|
|
It didnt recognize this as a function belonging to the class in which it is defined (in the h file).
(BTW I also tried putting the template function body in the cpp file....no go)
template <class T>
T *
s_file::p_data (unsigned int line) {
return ((T *) _p_data + line * _p_samples);
}
so I since know that T can be either unsigned short or unsigned int in this program I thought I'd overload.but the argument list isnt unique!! So obviously these wont work:
unsigned char *
s_file::p_data (unsigned int line) {
return ((unsigned char *) _p_data + line * _p_samples);
}
unsigned short *
s_file::p_data (unsigned int line) {
return ((unsigned short *) _p_data + line * _p_samples);
}
so I need to make something different in each argument list, but what? _p_data is a void*, and _p_samples is an int (both members of the class s_file..........
Thanks,
ns
|
|
|
|
|
How about adding a second dummy parameter of type T? :
template <class T> T * s_file::p_data (unsigned int line, T)
{ return ((T *) _p_data + line * _p_samples); }
Then you just pass some dummy value (and cast it if necessary) so the compiler will know which version to call.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Thats a great idea!
Appreciate your help,
ns
|
|
|
|
|
I don't have any roblems with my account ( administrator), but as of a couple of months ago the limited accounts cannot access their personal files ( My documents, My Pictures, Control Panel, etc...)When they try to they get a error message that says..
Microsoft Visuall C++ Runtime Library
Runtime Error
Program C:\Windows\Explorer.EXE
This application has requested the Runtime to
terminate it in an unusual way.
Please contact the applicant's support team for more
information.
I have ran a sfc/scannow and searched and searched for information on how to fix this problem. We have had this Dell computer with Windows XP already install by Dell for more than two years. I hope that someone can help me out so that my son can start using his own desktop again.
Thanks
Diane
|
|
|
|
|
Out of curosity, why is it that STL header files don't have a .h extension?
thanks
|
|
|
|
|
|
I don't want that window pop out a login window automatically.
so help needed.
Hardware-OS-Software
===== Bridge =======
|
|
|
|
|
Are you looking for LogonUser() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
You cannot use LogonUser to log on to a remote computer.
NetUseAdd? But I don't know how to use this function exactly.
Hardware-OS-Software
===== Bridge =======
|
|
|
|
|
wheregone wrote:
You cannot use LogonUser to log on to a remote computer.
It helps to specifiy all of the requirements when seeking help!
Anyway, I could not get NetUseAdd() to work.
USE_INFO_1 ui = {0};
ui.ui1_local = NULL;
ui.ui1_remote = L"\\\\pbssvr\\ddrive";
ui.ui1_password = L"password";
NET_API_STATUS nStatus = NetUseAdd(NULL, 1, (LPBYTE) &ui, NULL); I kept getting an access violation. I did get WNetAddConnection2() to work, however.
NETRESOURCE nr = {0};
nr.dwType = RESOURCETYPE_ANY;
nr.lpLocalName = NULL;
nr.lpRemoteName = L"\\\\pbssvr\\ddrive";
nr.lpProvider = NULL;
DWORD dwStatus = WNetAddConnection2(&nr, L"password", L"userid", 0);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
I am having a EditBox in my dialog box and I want to print out (in a AfxMessageBox for example)the value I typed in it.
I did the following but it didnt work (obviously!!)
I inserted a Edit box and in the Add member variable dialog box i gave it name and chose "control" under category and in the variable type it was CEdit.
I am not quite sure about the functions I have to use but I tried using GetSel() and such functions but they didnt work out..
Can anyone help me in it..any sample code would be great!!!
Thanks and Regards
Deepak Samuel
|
|
|
|