|
You'll need to provide your own GINA DLL, thus replacing Microsoft's (MSGINA.DLL).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is it possible to have reference to a reference varible.
Why?
KIRAN PINJARLA
|
|
|
|
|
It is possible to have reference to a reference variable. But reference to a variable and reference to the reference variable will point to the same location and they will have same value.
i.e.
int i = 5;
int& ii = i;
int* p = ⅈ
int* p1 = &i;
the p and p1 will have same value after executing the above code.
Manoj
Never Gives up
|
|
|
|
|
Aha, you are counting a reference and two pointers.. Generally speaking, pointers are also references
--
=====
Arman
|
|
|
|
|
I guess you mean "a reference refering to another reference refering to a variable". If so, impossible. A reference is initialized and never changes its referee; no assignment to change the referee later. So no way to initialize smth with a value that is being initialized [by other value] at the same time. Funny.
--
=====
Arman
|
|
|
|
|
kiran.pinjarla wrote: Is it possible to have reference to a reference varible.
Sure:
#include "stdafx.h"
#include "iostream"
int _tmain(int argc, _TCHAR* argv[])
{
int i = 5;
int& ri = i;
int& rri = ri;
std::cout << i << ri << rri << std::endl;
rri = 6;
std::cout << i << ri << rri << std::endl;
return system("pause");
}
kiran.pinjarla wrote: Why?
Hmm. To not make up a special case by not allowing it?
After all, an int& is supposed to be like an int in all respects. It is just another name for a variable.
Failure is not an option - it's built right in.
|
|
|
|
|
|
Hi,
Why dont you try to check value of the "kon" after the
IplImage* kon=mycam->capture(); //it would return a IplImage*
line. If every thing is fine the the value of kon should be not null.
Otherwise you need to check the capture function for creating the image successfully.
Manoj
Never Gives up
|
|
|
|
|
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.
|
|
|
|
|
I saw an interest thing on the C++/CLI forum,I saw some C++ questions on that fourm and some CLI questions on the C++ forum.
|
|
|
|
|
Not sure of understanding but, anyway,...
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.
|
|
|
|
|
C++ questions on the CLI forum and CLI questions on C++ forum
|
|
|
|
|
OK it is called (managed)C++/CLI forum. Isn't (managed) C++ representative of C++ ? Or do you wish to separate (managed) C++ forum off CLI one?
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.
|
|
|
|
|
Yeah I know,and no I dont.
|
|
|
|
|
I've written an activex control using MFC in VC6. Its based on a dropdown combo box, but I subclass the edit control (and listbox). As you type in the edit box, it goes out to the database and fills the dropdown. The "leave" event is triggered by killing focus in the edit box. I check to see if the entry is legal, and if its not, I put up an error message
I'm trying to test it in a simple dialog.
Here's the problem. If I type in (or select) something "legal" and then hit tab, I go to the next control in the tab order just fine. But if the user types in something illegal and I put up the message box, I seem to lose my place in the tab order and go back to the first control in the dialog.
Oddly enough it works fine in a VB dialog (the opposite of the problem I've had in the past.)
I've set the WS_EX_CONTROLPARENT style in Precreatewindow for the main control.
Any help would be appreciated!
|
|
|
|
|
hi all,
I am not much familiar with COM and COM dlls, Neway i am trying to use a COM dll (that is written in Vb) in a VC++ win32 application. I used the functions CoInitialize(), CoCreateInstance() etc.
Now in order to invoke a member function of the class, what should i do? suppose the method has 2 params ,one a string value and the other an integer.
Sample code is here, pls suggest the corrections:
//*************start*************************
if(CoInitialize(NULL)==S_OK)
{
HRESULT hr;
IDispatch* pIUk;
CLSID clsid;
CLSIDFromProgID(L"MyDll.MyClass", &clsid);
hr=CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDispatch, (void**) &pIUk);
if(SUCCEEDED ( hr ))
{
DISPID dispid;
DISPPARAMS dispparameters;
//invoke method "MyMethod"
char filename[]="D:\\FrameWork.xls";
int count=1;
char FAR* szMember = "MyMethod";
hr = pIUk->GetIDsOfNames(IID_NULL,(unsigned short **)&szMember, 1, LOCALE_SYSTEM_DEFAULT, &dispid);
pIUk->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dispparameters, NULL, NULL, NULL);
pIUk->Release();
}
CoUninitialize();
}
//*************end****************************
I am confused about filling the DISPPARAMS structure and lot more doubts ...
Thanks in advance
SYAMLAL
|
|
|
|
|
Actually, COM is very hard though not impossible to learn and use.
About the DISPPARAMS structure [about what are your concerns]. The declaration of DISPPARAMS looks like this;
struct DISPPARAMS {
VARIANTARG* rgvarg;
DISPID* rgdispidNamedArgs;
unsigned int cArgs;
unsigned int cNamedArgs;
};
Let's exclude the second and forth fields; we do assign NULL and 0 to them respectfully. These are to support so called named parameters that are applicatble in VB. In C++ rarely can they be useful so let's do not bother with them [in C++ - I mean when calling via IDispath].
The first field is an array of VARIANTS [VARIANARG is the same as VARIANT]. Here we should put our real arguments. A VARIANT is a union of several types such BSTR, int, float, DATE. You are restricted with those types only; no type outside of VARIANT could be applied.
Suppose your function takes a single argument of type string. So first you prepare the VARIANT object like so;
BSTR bstrMyArg = L"some text";
VARIANT var;
::VariantInit(&var);
var.vt = VT_BSTR;
var.bstrVal = bstrMyArg;
Now it's time to initialize DISPPARAMS;
DISPPARAMS dispparameters;
dispparameters.cArgs = 1;
dispparameters.rgvarg = &var;
dispparameters.cNamedArgs = 0;
dispparameters.rgdispidNamedArgs = NULL;
Then invoke your pIUk->Invoke.
And a minor note. No need for FAR; you are not in Win16.
char FAR* szMember = "MyMethod";
--
=====
Arman
|
|
|
|
|
Do you really need to pass through IDispatch::Invoke ?
Usually COM objects expose the so called dual interface . that allows automation client to use IDispatch . On the other hand, C++ clients can take advantage from VTBL binding. I suggest to you to use VTBL binding (is simpler and more efficient).
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.
|
|
|
|
|
Pls explain ur solution.
SYAMLAL
|
|
|
|
|
Usually a COM component exposes its functionalities not only with IDispatch interface but with other ones, oriented towards VTBL binding.
Your client can ask such an Interface (via QueryInterface method of IUnknown interface) and call directly its exposed methods (this way is simpler and more efficient).
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.
|
|
|
|
|
hi all,
i want write into the file wchar_t* and want to save it as UNICODE. tmp is wchar_t* and is a xml file.
my code is:
FILE* f = _wfopen(m_sFilespecW.c_str(),L"w");
size_t no = fwrite(tmp,sizeof(wchar_t),size,f);
fclose(f);
but it shows garbage.
when i change the code to:
FILE* f = _wfopen(m_sFilespecW.c_str(),L"w");
while(*tmp)
{
fputwc(*tmp,f);
tmp++;
}
fclose(f);
it saves the file but in ANSI format. it then fails to load in other function as that function only loads unicode files.
help me i want to save it in UNICODE.
|
|
|
|
|
sandeepkavade wrote: size_t no = fwrite(tmp,sizeof(wchar_t),size,f);
What is tmp and size ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi
In the code bottom I want to create a new dialog box when a condition is provided.But it failed because all threads deadlocked.How can I create a new dialog box in a worker thread?
Thanks for your help.
UINT threading(LPVOID p)
{
CMyClass * me = (CMyClass *)p;
if(something happen)
me->threading();
return 0;
}
void CMyClass::threading()
{
CDlg *dlg = new CDlg;
dlg->Create(IDD_DIALOG2,this);
dlg->ShowWindow(SW_SHOW);
}
|
|
|
|
|
But it failed because all threads deadlocked
Why so? It is too bad. I guess your UI threrad is locked ..? So try to redesign the app logic. Never do make the UI thread wait [IOW minimize it as much as possible]. Instead, for waiting purposes do create a working thread.
It is possible to create and show a dialog from a worker thread, I do not encourage such a thing though. Put the following inside the worker thread;
CMyDlg dlg;
dlg.DoModal();
Again, try to redesign the things. You should not have the UI thread blocked.
--
=====
Arman
|
|
|
|
|
iayd wrote: How can I create a new dialog box in a worker thread?
As Arman suggested you should re-evaluate your design.
What problem are you trying to solve by creating a secondary thread, i.e. why do you think you need it?
Could the dialog box be modeless and created from the main thread instead?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|