|
Derive a class from CEdit.(CMyEdit->CEdit). Override the WM_RBUTTON Click. Create an object of CMyEdit .
CMyEdit m_MyEdit.(Associate this with the edit control in which you want to show the menu when right button of the mouse is pressed)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If I want to ignore the mouse right click, what should I do?
Please help!
|
|
|
|
|
Just override the right button click and do nothing in the function. If you are asking them in context to what would happen with the other edit boxes you can associate a CEdit type of control variable and leave them as they are with default functionalities
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thank you very much!
It's alright now!
|
|
|
|
|
If you derived from each class for controls you have a most power than to use in the standard case
|
|
|
|
|
Hi
I use CreateProcess to run a program. I need to find the windows that the main thread of the process opens (using EnumThreadWindows and from the PROCESS_INFORMATION parameter which I send to the API).
Everything is fine, but I have to wait (using Sleep API) to give time to the process to make its windows before enumerating them.
This is for sure not a good way since different processes take different times to start up.
I want to see, if there is a way to wait until process initialization is finished? maybe some API in the same manner with WaitForSingleObject just to wait for the initialization of the process?
I am really stuck in this...
Thanks in advance
|
|
|
|
|
If you wrote the other process, the best way is to pass it an event handle and have it signal the event once the init is done. The parent process can then wait on the event. If you can't change the 2nd process, check out WaitForInputIdle()
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks for your helpful answer.
I havn't written the other process but WaitForInputIdle was exactly what I was looking for.
Thans again.
|
|
|
|
|
Hi,
I have a CFormView-based application in which I am having a weird window sizing problem. On startup, my view window is very large vertically. It is so large that I can't see the top or the bottom of the window - it is completely off the screen. In the CView::OnInitialUpdate(), I get the window size by calling GetWindowRect(), then calling OnSize() with the width & height of this rectangle. For some reason, these values are very large (or negative) so that the OnSize() method creates child windows that are way off the screen.
Any ideas for helping me get this fixed would be appreciated.
Thanks,
Royce
|
|
|
|
|
If you use GetWindowRect and ScreenToClient then size from your window isnt right
|
|
|
|
|
RoyceF wrote: For some reason, these values are very large (or negative)...
Wouldn't that be expected since the window starts out too large for the screen?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have been able to change the background color on my Dialog box, but the background colors are still white on my text boxes and other controls. How does one change the background on those items?
Thanks for your assistance.
John P.
|
|
|
|
|
For edit box
in onctlcolor
OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
if( CTLCOLOR_EDIT == nCtlColor )
{
pDC->SetBkColor( RGB(250, 0, 0 ));
}
}
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
Thanks for the assistance!
John P.
|
|
|
|
|
In WM_CTLCOLOR message handler set background mode as transparent and return a null brush. This will make the background colour of the controls same as background colour of your dialog
|
|
|
|
|
Thanks for the help!
John P.
|
|
|
|
|
|
|
You can use WM_CTLCOLOREDIT like this
<br />
LRESULT CMyAnswer::OnCtlColorEdit(WPARAM wParam, LPARAM lParam) <br />
{<br />
HDC hdc = (HDC)wParam;<br />
SetBkMode(hdc,0);<br />
SetTextColor(hdc,TextColorEdit);<br />
return (LRESULT)(m_pBrush->GetSafeHandle());<br />
}<br />
|
|
|
|
|
I'm getting a really wierd error. I started it as an empty .NET project, and everything is posted here but the int main() file:
The program compiles without any errors or warnings reported by the debugger, but when it runs, I get this error:
"An unhandled exception of type 'System.NullReferenceException' occurred in NumberConversion.exe
Additional information: Object reference not set to an instance of an object."
It points to this line inside memcpy.asm:
mov [edi],al ;U - write second byte to destination
The code:
Implementation file:
#include "Menu_Class.h"
#include "CommonStructDefs.h"
#include <iostream>
#include <string>
using namespace std;
Menu::Menu()
{
NumMenuOptions = 2;
InitializeMenuOptions();
}
void Menu::PrintOptions()
{
cout<<"Availible menu options:"<<endl;
for(int i=0; i < NumMenuOptions; i++)
PrintMenuOption(i);
cout<<"Please enter a menu option: [1-"<<NumMenuOptions<<"]: ";
}
void Menu::PrintMenuOption(int MenuOption)
{
cout<<MenuOptions[MenuOption].OptionNumber<<". ";
cout<<MenuOptions[MenuOption].OptionName<<": ";
cout<<MenuOptions[MenuOption].OptionDescription<<endl;
}
void Menu::InitializeMenuOptions()
{
for(int i=0; i < NumMenuOptions; i++)
MenuOptions[i].OptionNumber = i + 1;
MenuOptions[0].OptionName = "Decimal -) Binary";
MenuOptions[1].OptionName = "Binary -) Decimal";
MenuOptions[2].OptionName = "Exit Program";
MenuOptions[0].OptionDescription = "Convert a base 10 number to a base 2 number.";
MenuOptions[1].OptionDescription = "Convert a base 2 number to a base 10 number.";
MenuOptions[2].OptionDescription = "Exit the program.";
}
Specification file:
#include "CommonStructDefs.h"
#ifndef MENU_CLASS_H
#define MENU_CLASS_H
using namespace std;
class Menu
{
public:
Menu();
void PrintOptions();
void PrintMenuOption(int MenuOption);
protected:
private:
void InitializeMenuOptions();
int NumMenuOptions;
MenuOptionType MenuOptions[2];
};
#endif
Defenitions:
#include <iostream>
#include <string>
using namespace std;
#ifndef COMMON_STRUCT_DEFS_H
#define COMMON_STRUCT_DEFS_H
struct MenuOptionType
{
string OptionName;
string OptionDescription;
int OptionNumber;
};
#endif
Any help would be appreciated.
-- modified at 16:55 Monday 7th August, 2006
|
|
|
|
|
CoffeeAddict19 wrote: MenuOptions[2].OptionName = "Exit Program";
CoffeeAddict19 wrote: MenuOptionType MenuOptions[2]; //structure of menu options
|
|
|
|
|
Hello all,
I have a simple server written in MFC as a dialog box application. I find the page fault to increase and rapidly and this inturn increasing the memory size when there are many TCP connection requests to the server. But as soon as I press the minimize button, the memory abruptly returns to 400K and again starts building up. For testing case, we are using the debug version. Does the debug version have a bug like this (which otherwise means that the release version will not have this bug?)? Is there a much bigger problem in my code?
Please help me.
Thanks in advance
Regards
Varchas R S
|
|
|
|
|
The memory footprint for Debug versions will be larger than Release versions, but this isn't what you are seeing. This is most likely a bug in your code and you should investigate it (sounds like a memory/resource leak from what you described).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
OK . .But why is it when I minimize, I always go back to the minimum possible memory ..i.e. 384K ..then it starts building up. The server receives something like around 10 connections per second and this can cause memory leaks that also I agree, but how come when minimizing it returns to 384K? When I restore it, because of SHOW_WINDOW, it takes another 300K and the memory becomes 700K. But it again starts increasing. .to a huge number. .even 110MB .. :-S but one minimize click . .returns to 384K. ..
Will look at memory leaks too!
Thanks
Varchas R S
|
|
|
|
|
Varchas R S wrote: ...the memory abruptly returns to 400K and again starts building up.
How are you verifying this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|