|
I've never done this and don't know how. What do you have to do to set it up?
|
|
|
|
|
I would recommend you do a search on the microsoft site for remote debugging in relation to the development platform your using. (Actually a straight google search for "remote debugging" should turn up what you need)
As the implementation of this has varied slightly over the years, I cannot give any direct description on how to perform it for your environment.If you vote me down, my score will only get lower
|
|
|
|
|
When I'm having issues that I cannot reproduce, then I use remote desktop/remote assistance to take control of the customer computer and install Windows Debug Tools (WinDbg).
WinDbg allows you to debug applications:
1) To see call stack while debugging then you need to upload Program Database files (PDB) generated with the EXE/DLL files.
2) To see source code then you need to upload the source used to compile the application.
3) To see values of variables (and not just addresses), then you need to compile the application without optimization turned on.
P.S. I would add the following to the problem line you have shown:
# Check that m_pRecentFileList != NULL
# Change m_arrNames to a proper container and check the size of that instead of using m_nSize
|
|
|
|
|
Yes, yes, and yes - thanks. I can see this is the direction I need to go.
I have WinDbg installed, but my knowledge of how to use it is minimal. I've used it to view crash dumps, but never for remote debugging and I don't know how that works. I need to google remote debugging for more detailed instructions.
Snakefoot wrote: I would add the following to the problem line you have shown:
# Check that m_pRecentFileList != NULL
# Change m_arrNames to a proper container and check the size of that instead of using m_nSize
Yeah, it's becoming clear to me that I need to check this pointer before trying to use it. The reason I didn't is that I didn't think there was any way it could be invalid after I'd made the call to LoadStdProfileSettings(4); . Could you tell me under what circumstances this structure might not be populated properly after this call? There's no return value to check with LoadStdProfileSettings.
I don't know what you mean by "change m_arrNames to a proper container". What is a "proper container". Confession: I learned to program in the pre-Windows DOS world (I am old) and I'm more adept with procedural programming than object-oriented programming.
|
|
|
|
|
A proper container is one that keeps track of its allocation like std::vector or MFC::CSimpleArray.
But I see that you are using CRecentFileList(), and it seems to be without such features.
|
|
|
|
|
I made a small change to the program, and now it's crashing on my own development system - which is sort of bad, but also sort of good.
The problem is not the line I quoted. It's crashing when it tries to run the app. I think I must have a buffer overrun somewhere, though I have no idea where. I looked at Bounds Checker but it costs $1500. Is there a cheaper alternative?
Geez - I am losing it, or I need more sleep or something. I deleted something crucial, that is all. Back to the original problem...modified on Wednesday, March 17, 2010 6:02 PM
|
|
|
|
|
Snakefoot wrote: A proper container is one that keeps track of its allocation like std::vector or MFC::CSimpleArray.
But I see that you are using CRecentFileList(), and it seems to be without such features.
I put in a check that the list exists, and for some reason I cannot fathom, it is not created properly on this one guy's system, though it works fine for everyone else.
I can't imagine what he can be doing on his computer that would prevent this standard MFC call from working properly. Does anyone know? I'd rather not do it all manually if I don't have to. I'd rather detect systems that don't support it, but I don't know of any reason why a system would not support it.
Can anyone make a guess on this?
|
|
|
|
|
I fixed the problem. I still have no idea why the standard call wasn't working on his system. But I changed this:
LoadStdProfileSettings(4);
to
CString strSection = "Recent File List";
CString strEntryFormat = "File%d";
m_pRecentFileList = new CRecentFileList(1, strSection, strEntryFormat, 4);
m_pRecentFileList->ReadList();
And voila! No crashes - it's working fine.
I can't believe I spent a week and a half of my life on this. On the plus side, my startup code is vastly cleaner after 10 days of intense scrutiny.
|
|
|
|
|
Hi,
NOTIFYICONDATA nid;
ZeroMemory(&nid,sizeof(nid));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = 0;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER;
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
(nid.szTip,"Double-Click To Maximize.");
I have successfully got my application to show in the system tray but I want to add menu items when the user right clicks on the icon in the system tray.
Thank you.Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: I have successfully got my application to show in the system tray but I want to add menu items when the user right clicks on the icon in the system tray.
You have to display the menu yourself. The CTrayIcon class in this article[^] encapsulates the display of a tray icon, and displays a menu in the OnTrayNotify method.Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi Andrew,
I hope this code will help you out.
What i normally do is first setup the basic funtionality for the try icon, something like this:
this->notifyIcon1->BalloonTipIcon = System::Windows::Forms::ToolTipIcon::Info;
this->notifyIcon1->Icon = (cli::safe_cast<System::Drawing::Icon^ >resources->GetObject(L"notifyIcon1.Icon")));
this->notifyIcon1->Text = L"Helios Options";
this->notifyIcon1->Visible = true;
this->notifyIcon1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::notifyIcon1_MouseDoubleClick)
<pre>
Then i create a funtion that takes a couple of arguments to write and display certain text:
<pre>private: System::Void DoNotify(System::String^ Titlex, System::String^ Message, int Timeout)
{
notifyIcon1->ShowBalloonTip(Timeout,Titlex,Message,System::Windows::Forms::ToolTipIcon::Info);
}
<pre>
I then use the funtion like this:
<pre>DoNotify("Helios Minimised","Helios is still running\r\nDouble click icon to maximise",5);
I then handle the form resize funtion, this will show and hide the main window
private: System::Void Form1_Resize(System::Object^ sender, System::EventArgs^ e)
{
if(FormWindowState::Minimized == this->;WindowState)
{
DoNotify("Helios Minimised","Helios is still running\r\nDouble click icon to maximise",5);
this->Hide();
}
else if(FormWindowState::Normal == this->WindowState)
{
}
}
Then finally i hadle the function we created a event handler for at the notifyicon:
private: System::Void notifyIcon1_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
this->Show();
this->WindowState = FormWindowState::Normal;
}
I hope this will help you a little more.
Let me know if there is anything else i can help with.
Louis
|
|
|
|
|
Is that C# code on the example or C++. Andrew McIntyre
|
|
|
|
|
|
NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(NOTIFYICONDATA));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = 1;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER + 200;
nid.hIcon = LoadIcon(NULL, IDI_INFORMATION);
lstrcpy nid.szTip, ("Test Tip");
Shell_NotifyIcon(NIM_ADD, &nid);
Hi Louis,
Can you help me fix this code so it can display the notify icon Title set as "Test" and in the code allow me to create menu items.
Thank you.Andrew McIntyre
|
|
|
|
|
Hi Andrew,
I have not used the Notifyicon in normall C++ yet, though the implementation thereof would not differ
much from C++/Clr i think. I could code something up for you, though are you only using C++? Cause this is all very simple using Clr. You simply add a Context menu strip and edit it via the normal GUI editor, and associate it then with your NotifyIcon from the editor or from code.
Louis
|
|
|
|
|
Louis,
I need it to be in C++.Andrew McIntyre
|
|
|
|
|
|
MrMcIntyre wrote: ...but I want to add menu items when the user right clicks on the icon in the system tray.
See here."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
NOTIFYICONDATA nid;
memset(&nid, 0, sizeof(NOTIFYICONDATA));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = 1;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_USER + 200;
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
nid.uTimeout = 5000;
nid.szInfoTitle, "BalloonTitle";
nid.szInfo, "TrayTip";
nid.szTip, "TrayTip";
Shell_NotifyIcon(NIM_ADD,&nid);
When I run this code the icon on the system tray the title does not appear or any of the input I want it to display when I hover over the icon. Please help.Andrew McIntyre
|
|
|
|
|
Hi Andrew,
I have had hassles using this:
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
i normally use;
nid.hIcon = LoadIcon(AfxGetApp()->m_hInstance, IDI_APPLICATION);
This could be at hassle
Louis
|
|
|
|
|
MrMcIntyre wrote: nid.szInfoTitle, "BalloonTitle";
nid.szInfo, "TrayTip";
nid.szTip, "TrayTip";
This compiles?
Does your app's icon show up in the taskbar notification area? When your mouse hovers over it, nothing shows up, correct?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi David,
I got the code to work in the end, however I still need help creating the menu when the user right clicks.
ThanksAndrew McIntyre
modified on Tuesday, March 16, 2010 1:17 PM
|
|
|
|
|
All of this is laid out in that code I've pointed you to.
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_MESSAGE(WM_USER + 200, YourMessageHandler)
END_MESSAGE_MAP()
LRESULT CMyDialog::YourMessageHandler( WPARAM, LPARAM lParam )
{
if (WM_RBUTTONDOWN == lParam)
{
}
return 0;
} "One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thanks for the code, its much appreciated.
See if I wanted to put menu items how would I do that like:
Help
Exit
About
Thank youAndrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: Thanks for the code, its much appreciated.
But did you look at it? All of what you are doing is in the code.
MrMcIntyre wrote: See if I wanted to put menu items how would I do that like:
Help
Exit
About
Create a menu resource. Load it in that message handler function."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|