|
but what does it mean....?
|
|
|
|
|
|
A reference for something means that it can be used anywhere the original can be used, AND any changes to the reference are reflected in the original.
So for instance:
void func( int a, int& b )
{
a ++;
b ++;
}
int foo = 5, bar = 5;
func( foo, bar );
In this example, foo will remain unchanged because it was passed by value to the function, however, bar will reflect the increment because it was passed by reference.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Hello,
It's similar to pointer to pointer (char**).
Regards,
|
|
|
|
|
I want to host a NotifyIcon control inside my MFC dialog box. The dialog box remains hidden, and the NotifyIcon will be the app's only UI.
The problem is that when I want to Show a context menu for the NotifyIcon, it requires me to pass in the handle to a Windows::Forms:Control.
Since my app does not have a Windows::Form, but rather an MFC dialog, how can I force it to show the context menu on demand?
I thought about just creating a temporary Form, but it won't work if the Form is invisible!
How can I force it to show the context menu inside my MFC dialog?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
This question should be posted on the Visual C++ / MFC[^] board.
I'm confused ... you should be able to show a popup menu anywhere on the screen you want.
You say the dialog remains hidden but you want to "show the context menu inside my MFC dialog"??
By "NotifyIcon" you are referring to an icon in the "tray", right?
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Thanks for your response.
This is a legitimate C++/CLI question because I am building a mixed-mode application.
Inside the MFC dialog, I am trying to host the .NET class "NotifyIcon".
But there is no method to tell the NotifyIcon to show its ContextMenu, so I hope someone knows how I can accomplish this.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Fair enough
I'm not sure how you'd accomplish this. In an MFC window (Windows OS window) you provide a
popup menu and display it typically in response to the user clicking the tray icon.
Seems to me (since ContextMenu.Show() requires a form) you need to maybe call the windows
TrackPopupMenu() API using the HMENU obtained from the ContextMenu (Menu.Handle property).
Pass the dialog's HWND - the dialog will receive the command messages.
Maybe?
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Mark, I think you are right.
I think I won't be able to get MFC and .NET to "play nice" in this particular instance, and I will have to revert to my native implementation of the tray icon.
Thanks for your thoughts.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I had created class in one classes.h file. I included this file in Form1.h, created Class^ c = gcnew Class(); and call one of function. When I wanted to run my procjet I get error LNK2005: "public: void __clrcall class::Prepare(class System::String ^)" (?Prepare@class@@$$FQ$AAMXP$AAVString@System@@@Z) already defined in Myproject.obj
Where could I do wrong?
|
|
|
|
|
As error suggest its due to defining class::Prepare in more that one place.
If this definition is inline, make sure, your header is guarded by multiple inclusion.
i.e. We use #pragma once is native.
|
|
|
|
|
I added #pragma once in first line of classes.h but I still get that error
|
|
|
|
|
I dont know if this is the same linking error that I encountered once, but any way try to delete the debug folder from your project, you will find 2 debug folders inside your project, delete the inner one then rebuild your solution.
|
|
|
|
|
hi,
I am trying to develop a programme to let the user key in their name, then compare their name to the input file i have created using a notepad. Can anyone suggest me how to check the name key in by the user to the names in the input file? The programme which i am trying to develop is some sort like a programme to identify the user and hence tell them what class do they need to attend,when,where.
THANKS.
|
|
|
|
|
URGENT doesn't really help.
Is this a a C++/CLI program, or are you in the wrong forum ? File.ReadAllText will read your file for you.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I use InstallShield for my project. My project has database, i put it to Install Shield's "Application Folder", although i changed the connection string "c:\Documents and Setting\bla bla bla\xxx.mdb" to "xxx.mdb" (software runs my computer well with this string), i don't run it correctly on an another computer after installed it. It crashed when program tried to reach database. An error generated like this "c:\Documents and Settings\........\xxx.mdb couldn't be found". I don't understand Why it didn't work although i changed the connection string? Can anybody hel me please ?
-- modified at 5:00 Saturday 31st March, 2007
|
|
|
|
|
|
Thanks for your reply. I tried to do your suggests. I find that the problem is dataset. However i changed the connectionstring in the forms, connectionstring in dataset remains. What i can do for it? Can i write a function to dataset.h? like
"
String^ path = Application::StartupPath;
this->oleDbConnection1->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\""+path+"\\xxx.mdb\"";
"
|
|
|
|
|
Ok..Finally i solved the problem. If anyone has the same problem, just replace the whole path (eg. "C:\Documents and Settings\XYZ\My Documents\Microsoft Visual Studio 2005\Projects\Release\") ConnectionString in Dataset Header with |DataDirectory|
this->_connection->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"|DataDirectory|\\xxx.mdb\"";
and if you have connection in form, write a simple code in Form_Load event, replace ConnectionString with something like :
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
String^ path = Application::StartupPath;
this->oleDbConnection1->ConnectionString = L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\""+path+"\\hasta.mdb\"";
}
|
|
|
|
|
I get an ASSERT(::IsWindow(m_hWnd)) when i try update a CEdit item in from another class like
Myclass c; c.OnUpdate();
what do i need to do to solve this issue?
Any sugestions appreciated.
|
|
|
|
|
FredrickNorge wrote: what do i need to do to solve this issue?
IsWindow() is returning false because the m_hWnd HANDLE is not a valid HANDLE. Windows have to be "Created" before a HANDLE exists. In MFC look at something like CWnd::Create(.....)
If you are just starting Windows programming you should in use a tutorial and/or invest in book(s).
led mike
|
|
|
|
|
such as.... VERIFY(m_dlg1.Create(Main::IDD, this));
EDIT:
the dialog is already drawn and past OnInitDialog, however i am using tabing so all dialogs are visible at the same time.
-- modified at 18:20 Friday 30th March, 2007
|
|
|
|
|
FredrickNorge wrote: however i am using tabing so all dialogs are visible at the same time.
I don't understand the significance of that.
FredrickNorge wrote: such as.... VERIFY(m_dlg1.Create(Main::IDD, this));
Well that's an example but even an edit control is a window that must be created. Are you creating controls dynamically? Another reason MFC m_hWnd doesn't work is when you try to use them from worker threads.
led mike
|
|
|
|
|
Hello,
I have a COM DLL using 2D safearrays. I want to use the Interface in C# and managed C++ and need to marshall the 2D array somehow. Can anyone help me with the syntax please?
Regards,
|
|
|
|
|
How can I go about making a c++ program that will read a file in hex, search for a particular hex value, and replace it?
Thanks.
|
|
|
|