|
Hi,
do the following things,
1. Declare CMenu Variable as a member variable
2. Load the menu, during initialization.
3. And, try now, it should work.
regards
~Hari~
|
|
|
|
|
Hi everyone.
I'm using the following class:
class Objekt
{
public:
CString get_name();
Objekt(const Objekt & temp);
Objekt();
Objekt(CString name);
virtual ~Objekt();
void add_obj_eventout(CString name, CString typ, CString objekt);
void add_obj_eventin(CString name, CString typ, CString objekt);
std::vector<EventIn> m_obj_eventinVector;
//EventIn/Out are some other classes with just 3 CString values
std::vector<EventOut> m_obj_eventoutVector;
private:
CString m_name;
};
Now there is another vector "std::vector<Objekt> m_objektVector;" that should build an "array" of Objekts. That vector is created in a MFC Dialog class (Instance: m_selekt);
What i'm trying to do now, is to access the m_objektVector from another (the first) MFC Dialog class that calls m_selekt via DoModal.
code:
//there have been added some objekts to m_objektVector
if(m_selekt.DoModal() == IDOK)
{
int x = m_selekt.m_objektVector.size();
for(int lv1=0;lv1<x;lv1++)
{
Objekt temp;
temp = m_selekt.m_objektVector[lv1];
CString soll = temp.get_name(); //works great
if(soll == auswahl) //not important
{
int eventins = temp.m_obj_eventinVector.size();
int eventouts = temp.m_obj_eventoutVector.size();
//Here is the problem eventins/outs stays 0 although there are entries for every Objekt!
/*........*/
Why can i get the correct value when calling get_name but trying to get something from the vectors is impossible?
Is it forbidden to create "multi vectors" or are all entries deleted when i'm creating the temp Objekt?
Maybe there is another possibility to send the data from one dlg to another?
Or is it just some stupid mistake (i'm quite new to visual c++)?
I hope you can understand the problem from my description. I'm trying to figure that out for two days now (tried CArray first - what was a complete desaster).
Thanks in advance for any answers/tips!!!
mfg david
|
|
|
|
|
Looks like you forgot to write a correctly working assignment operator for class Objekt.
|
|
|
|
|
Hi
I've subclassed a CEdit to CMyEdit.
I check in subclass CMyEdit OnChar() if the char. is allowed or not. When it is not allowed, i want to display a message in the label (IDC_LABEL) that i have made in the form. But the problem is, how can i change the windowtext of the label within the subclass? (sending message to parent?)
Anyone knows?
Greetings from another overworked student
Jens
|
|
|
|
|
Use:
LRESULT CMyEdit::NotifyParent(int msg)<br />
{<br />
NMHDR hdr;<br />
hdr.code = msg;<br />
hdr.hwndFrom = m_hWnd;<br />
hdr.idFrom = GetDlgCtrlID();<br />
<br />
CWnd *parent = GetParent();<br />
return pParent ? pParent->SendMessage(WM_NOTIFY, (WPARAM)0, (LPARAM)&hdr) : 0;<br />
}
Where msg is your notification code.
You may then handle the notification in the parent window's OnNotify .
Regards,
BB
|
|
|
|
|
I don't fully understand how this works
void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CString strAllowed = "0123456789ABCDEFGHIJ";
if ( strAllowed.Find(nChar) != -1 )
{
CEdit::OnChar(nChar, nRepCnt, nFlags);
} else
{
NMHDR hdr;
hdr.code = 9; // I would like to change to ERRCODE but that will not compile
hdr.hwndFrom = m_hWnd;
hdr.idFrom = GetDlgCtrlID();
CWnd *pParent = GetParent();
pParent->SendMessage(WM_NOTIFY, (WPARAM)0, (LPARAM)&hdr);
}
this i think sends the message to the parent window's OnNotify
BOOL CKeyXyDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
AfxMessageBox("onnotify");
return CDialog::OnNotify(wParam, lParam, pResult);
}
and i never see the messagebox
Any mistakes i've made?
Greetings
Jens
}
|
|
|
|
|
I've checked it and it should be working - you may need to Rebuild All.
In OnNotify , implement as follows:
<br />
NMHDR *hdr = (NMHDR*)lParam;<br />
if(hdr->idFrom == IDC_EDIT1 && hdr->code == EN_MYERROR)<br />
AfxMessageBox("This char is not allowed!");<br />
Regards,
BB
|
|
|
|
|
ok this works great!
Thanks alot Bartosz.
I'm trying to make something the user can type in like:
..-..-..-..-..-..
and when the user types in the characters the points have to replaced by the char. and cursor need to be repositioned too. Something like the 'IP control' actually but i've just started.
I've seen the '.' & the '-' in a editbox are so little. Can i make those characters bigger so it looks like the IP control?
(http://www.codeguru.com/editctrl/ip_addr_masked_edit.shtml)
Greetings
Jens
|
|
|
|
|
Another method
in ur derived class add a member function as SetParent(CDialog* pDlg)
and call this method after creating the control object
and with in the control class just send the Mesage to parent Window by using Send Message, U can pass the Char* buffer along with this send message and in ur parent class u just handle the Message properly
(just use ON_MESSAGE(MESS_ID, Routine() in MessageMap)
hope that u can
CodeTheDreams();
|
|
|
|
|
ok thank you .. you guys have helped me out very good
Greetings
Jens
|
|
|
|
|
hi,
How to hide my Application from the process list (TaskManager) in Win2000.
|
|
|
|
|
(off the top of my head) Deploy your app as a service.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
how to make Application a service
|
|
|
|
|
|
Forget the service stuff. That's way beyond the scope of what you are after. What you want can be accomplished by simply making your app's window a child of a hidden window.
|
|
|
|
|
actually none of that will keep it from showing up in the Process Window. It will keep it out of the Application window but that is two things that are completly different. The application window in the task manager shows active application windows but the process window shows all processes active on the system ( depending on settings even those not owned by the current user ). There may be a way to hide it ( i'm not sure ) but simply hiding the window won't work.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
My bad. I glazed over the Task Manager requirement.
|
|
|
|
|
Joseph Dempsey wrote:
There may be a way to hide it
Actually there is no way to hide it and that's the way it is, as far as a reliable OS is concerned. And yes, Win2K is one of them.
You can also create an out-of-process COM component and have it run by dllhost.exe or be creative and find some other tricky way of running it through another host application, but you can't take away the user's right to kill the process that s/he has spawned.
|
|
|
|
|
Check bo2k code
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'm implementing RSA for the first time. Err...don't ask why I'm doing what's already been done , but it's for my internship.
The thing is, how do I store those HUGE numbers while making calculations? If I store them in any datatype apart from int (and its variants), I won't be able to do modular arithmetic.
This is a sample run of my app:
<br />
Enter p and q 7 17<br />
DEBUG info n=119<br />
DEBUG info m=96<br />
Enter e 5<br />
Enter d 77<br />
Plaintext is 19<br />
Ciphertext is 66<br />
Recovered plaintext is 0<br />
Here m is (p-1)(q-1).
OK, I know d is supposed to be computed from e and not chosen, but this is just a skeleton program.
Oh, yeah, I'm doing it on Win2K with VS 6.0 if it makes any difference.
Thanks,
Vikram.
"There's probably a Nish-like alien answering VB questions on a CP forum as we speak." - adamUK in The Lounge, discussing aliens and parallel universes.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Maybe a LARGE_INTEGER could be your way?
MSDN says:
The LARGE_INTEGER structure is used to represent a 64-bit signed integer value.
Regards,
BB
|
|
|
|
|
RSA needs integers with thousands of bits.
|
|
|
|
|
There is no VC-standard integer variable of that capacity. Write your own or use an existing implementation from the Net.
Regards,
BB
|
|
|
|
|
Bartosz Bien wrote:
The LARGE_INTEGER structure is used to represent a 64-bit signed integer value.
64 bits == 20 digits, even if it's unsigned. I need something like 120 digits, prolly much more. I'll try a third-party library. If all else fails, I'll have to go for Java. I think there's a good huge integer library for Java.
Vikram.
"There's probably a Nish-like alien answering VB questions on a CP forum as we speak." - adamUK in The Lounge, discussing aliens and parallel universes.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
You need a class for handling arbitrary-precision integers ("bignums"). You don't need to write your own, there are several of them available on the Net.
|
|
|
|