|
3. It's part of the COM services (aka COM+) stuff.
Think it's part of the COM+ Catalog stuff (but not the admin interface)
Steve S
|
|
|
|
|
In a bit of a quandry here...
I have two constructors for a class:
CMatrix(unsigned int uiRows, unsigned int uiColumns);
CMatrix(unsigned int uiSize, bool bCreateIdentity);
Unfortunately when I call the constructor in the code:
CMatrix* aMatrix;
aMatrix = NULL;
aMatrix = new CMatrix(2,2);
The VS 6.0 compiler informs me:
<br />
error C2668: 'CMatrix::CMatrix' : ambiguous call to overloaded function<br />
Which, I suppose, leaves me with three solutions:
1.) Use BOOL in place of bool which
I wanted to avoid
2.) Use int instead of unsigned int which
would require changing alot of already existing code and which
is really not what I want to do (I prefer unsigned int )
3.) Add a 3rd dummy parameter to one of the constructors, but this
seems like a desperate hack
Has anyone run into this before and come up with a creative solution
they would be willing to share?
|
|
|
|
|
Does aMatrix = new CMatrix(2, 2U); help?
|
|
|
|
|
Ah, yes! Of course!
That's perfect. Thanks.
|
|
|
|
|
Actually, your use of the format specifier gave me
an idea. I tried this and it works also:
aMatrix = new CMatrix(2, static_cast<unsigned int>(2));
Unless this is safer, I prefer your solution - much shorter
and to the point.
Thanks again.
|
|
|
|
|
Just to comment on why you get this error... When the compiler sees the parameter 2 , it compares the parameter type (int ) with the param types of the available ctors. Since int can be implicitly converted, using language rules, to either unsigned or bool , the call is ambiguous. Changing it to 2U makes the parameter type unsigned , so the only possible choice is the ctor that takes an unsigned .
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
My situation is this:
I have made MFC program using CListView. Data
is listed very neatly, but now I would like
to be able to make reports of the data, maybe
print little bars & pies.
How can I open a new window with CScrollView
class as the view? I would also like to
be able to print the view.
I've tried a couple to things so far, but I
more or less lost. Would one possibility be to open
a window the same size as CListView, kind of like put
it on top of the CListView?
(Yes, I am a newbie
|
|
|
|
|
In a dialog based application I have to disable (lock) the enter-key until the dialog is closed. I think, using a keyboard-hook will be a good idea; does anybody have experiences concerning this method?
thanks in advance
|
|
|
|
|
You mean, you don't want your dialog to be closed when the user presses 'enter' ?
There is a much easier way to do that: just override the OnOk function: don't call CDialog::OnOk() !
(Create a button with id = IDOK and create a message handler)
Hope this helps
|
|
|
|
|
for my project , i have a CView contain a CTreeCtrl member. i want to cope with the tree notify message in the view.
for instance : msg: TVN_ITEMEXPANDED
CView::OnNotify(wParam , lParam , lpResult){
}
as far as i know wParam as idCtrl,
lParam as LPNMHDR strcut point.
but msdn says
TVN_ITEMEXPANDED
pnmtv = (LPNMTREEVIEW) lParam .
what really the lParam refer to??
help me.
love program
|
|
|
|
|
I'm not into MFC but pnmtv = (LPNMTREEVIEW) lParam means you're casting the lParam into a pointer to an NMTREEVIEW structure. That structure probably contains a TVITEM structure as well,. I would guess you need to examine the state of that TVITEM.
What's the difference between a C++ programmer and God? God knows he's not a C++ programmer :
anon
|
|
|
|
|
i see , as i digesting into the document. lParam is not only a pointer to NMHDR even more of that. we could change the type of it to proper struct pointer such as LPNMTREEVIEW.
thank you.
love program
|
|
|
|
|
Hi,
I have an MFC DLL plugged in to one of the exe.I have full control of the DLL.
My question is when i execute the exe can i pass command line arguments to the exe and access within the DLL.
Pls help
Thnks
|
|
|
|
|
Yes. If the EXE has a CWinApp -derived class, you can access the m_lpCmdLine member variable. If not, you can use the __argc and __argv global variables.
|
|
|
|
|
Hi,
thanks for reply but i don't have control on the EXE source.Its like a thrid party tool.I have full conrol of the dll. So in this case what to do.?Pls help
Thnks
|
|
|
|
|
You can still access the aforementioned objects from within the DLL.
|
|
|
|
|
HI everyone,
I'm working on a dialog box which I created without being really used to C++ :
my point is that I can't (or i don't know how to) use the char strings (and i'm not even sure there are characters...) i fill in the box.
Here is the kind of advice i'd like to get :
void CTestDlg::OnChangeEdit1()
The best thing would be to get a sample code using a dialog box. For instance, the box says 'enter your name' and depending on the name entered there woulde be a few code lines dealing about the name...
I hope i'm clear enough and that I'll get an answer !
Thank you very much to you all !!
|
|
|
|
|
Hari Seldon wrote:
Here is the kind of advice i'd like to get :
void CTestDlg::OnChangeEdit1()
This looks very much like an EN_CHANGE message handler.
Hari Seldon wrote:
I hope i'm clear enough
Yes and no. As I understand it, you want a dialog box with a label, an edit control and a few buttons. Yes?
+----------------------------------------------+
|Enter your name: ______________ +--------+ |
| | OK | |
| +--------+ |
| |
| +--------+ |
| | Cancel | |
| +--------+ |
| |
+----------------------------------------------+
|
|
|
|
|
You should buy a MFC programming book for beginners. The learning curve for MFC is about 6 months.
|
|
|
|
|
Hi everyone,
I'm brand nu with
|
|
|
|
|
Hi,
I have a dialog box with a button, which when clicked executes a program by using the CreateProcess command..
The problem is , though the program has been finished (execution complete), i still see it in the task manager. It disappears only after I close the dialog box itself. Is there a way out? Due to this, if I click it thrice, i see three instances of it running simultaneously. Can any one send a solution for this?
Regards,
Deepak Samuel
|
|
|
|
|
Hi
This is from the MSDN doc for CreateProcess
"The created process remains in the system until all threads within the process have terminated and all handles to the process and any of its threads have been closed through calls to CloseHandle. The handles for both the process and the main thread must be closed through calls to CloseHandle. If these handles are not needed, it is best to close them immediately after the process is created."
Which means you have to call CloseHandle on
PROCESS_INFORMATION::hProcess
PROCESS_INFORMATION::hThread
Magnus
|
|
|
|
|
Hi ,
I have a question here regarding how to use C to restart the PC.
situation:
I am using win2000 but however I would like to bootup using a win98 floppy disk to verify my systems settings. after checking I would like the PC to reboot so that it can boot from the HD into win2000. I am thinking of using autoexec.bat to help me to automate this process.
So how can I write a simple c program to reboot my pc automatically so that i can activate the program through autoexec.bat ??
Please advise! Thank you
bk
|
|
|
|
|
Use the ExitWindowsEx() function with the EWX_REBOOT flag.
Serge
|
|
|
|
|
You need to get priveldges first.Use rebootmysystem() to get priveledges.
Best of luck.;)
///////////////////////////
void rebootmysystem()
if(!ExitWindowsEx(EWX_REBOOT| EWX_FORCE ,0))
MessageBox("Couldn't reboot! Please do it manually.", "Installation Complete", MB_OK);
////////////////////////////
//to get priveledges
void rebootmysystem()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
AfxMessageBox("Cannot Proceed!. Please restart manually");
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
// Cannot test the return value of AdjustTokenPrivileges.
if (GetLastError() != ERROR_SUCCESS)
AfxMessageBox("Cannot Proceed!. Please restart manually");
// Shut down the system and force all applications to close.
}
|
|
|
|