|
Hello,
how to disable item(one or more items) from a CMenu that is shown as popup menu?
Diable normal menu items i do with this:
m_cMenu.EnableMenuItem(IDC_CLEAR, MF_BYCOMAND | MF_DISABLED | MF_GRAYED);
but how to do this when i show the same menu as an popup menu?
I call my popup menu like this:
cMenu.GetSubMenu(1)->TrackPopupMenu(1, posMouse.x, posMouse.y, this);
and all menu items are active! How to disable them?
thanks in advance
break
|
|
|
|
|
You got:
CMenu* pMenu = cMenu.GetSubMenu(1);
//do stuff
pMenu->EnableMenuItem(...);
//show
pMenu->>TrackPopupMenu(1, posMouse.x, posMouse.y, this);
Greetings from Germany
|
|
|
|
|
Hello,
thanks, that works!
break;
Greetings from Germany to!
|
|
|
|
|
|
|
Programm3r wrote: now that this some of the code CLI
then ask the right forum. you should be flamed to asking the wrong forum knowing perfectly what you do
|
|
|
|
|
This one works for me
Stings
/krissi
|
|
|
|
|
in my application's app class initinstrance i am creting a thread as
(new CMYThread)->CreateThread();
in the run() of that thread i am wrote
CSocket mySock;
mySock.Create(1234,SOCK_DGRAM);
when the execution passes the line mySock.Create(...) it's giving an exception saying access violation and in the debug it takes the point to
void* CMapPtrToPtr::GetValueAt(void* key) const
{
if (m_pHashTable == NULL)
return NULL;
UINT nHash = HashKey(key) % m_nHashTableSize;
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc->value;
}
return NULL;
}
and showing
this pointer as NULL in the 'watch'.
Can u guide me the way out.
Thank you.
KIRAN PINJARLA
|
|
|
|
|
The construction of the socket seems to fail.
Does this help (surprisingly, I do not know if it is really the same):
CSocket mySock();
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
It Doesn't help me.
Thank you.
KIRAN PINJARLA
|
|
|
|
|
my replys will certainly not help, but when you do this :
(new CMYThread)->CreateThread();
do you see the memory leak ???
you allocate dynamically a CMyThread object (using new ), but as you don't store the address returned (in a CMyPointer pointer), you'll never be able to delete it, thus the leak.
store the address in a pointer, or try this :
(CMYThread())->CreateThread();
this will call the default constructor of the class (just like new does), but allocated the object on the stack instead of on the heap.
|
|
|
|
|
First, I'll assume CMYThread is derived from CWinThread and you know
(new CMYThread)->CreateThread();
won't be a memory leak because the object is self-deleting.
Second, CSocket needs a window when you call Create() so you'd need to use a user interface
thread. An easier method would be to create the socket on the app's UI thread and pass it
into (or make it accessible by) CMyThread.
Mark
|
|
|
|
|
Hello
I am creating a file with a particular name (its a simple txt file). The properties of this file should be such that the user should not be able to rename the file. Is is possible to create a file such that the computer user is not able rename it ??
This is basically because, my application needs some information from this specific file, and it would fail in case the user has changed the file name (because the application would not be able to find that file in its working directory)
Thanx,
Vipin.
|
|
|
|
|
vipin_nvk wrote: Is is possible to create a file such that the computer user is not able rename it
I do not think it is, unless this is a general administration policy, but that would be true for all files.
Anyway, I think you should rethink your design, it seems that your application must be robust enough to handle the fact that the property file does not exist. If the user is dumb enough to move or rename files that comes with your app, he deserves nothing more than an error message.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
vipin_nvk wrote: This is basically because, my application needs some information from this specific file, and it would fail in case the user has changed the file name (because the application would not be able to find that file in its working directory)
In general, if a user rename a file used by an application, chances are that the application will fail to start (or use this file). The user is simply not supposed to rename these files or change the contents.
The best you can do is first check if the file exist and then show an error message if not (and take the appropriate action, e.g. exit the program). Then you can also check if the contents of the file are valid.
|
|
|
|
|
Thanx, yes, this is wat the behaviour of my application is currently, but I jst wanted to know, whether there is a way that we can avoid the user from renaming the file.
|
|
|
|
|
vipin_nvk wrote: Is is possible to create a file such that the computer user is not able rename it ??
Yes, but you'll need to do so at the OS level (i.e., it's not enough to simply make the file read-only). See Access Control List (ACL) for more.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi
What are the differences between kernel,user and gdi objects?and hadles?
I read that
1-)kernel objects are created in system adress space but user are in program adress space but gdi?And also i read that kernel objects are can be shred accross processes but user and gid can not.Are these true?I am not sure.
2-)kernel objects handles are for per-process but user and gdi are system-wide.If thhese are system wides why cant we share accross proccess.Bu also we can share kernel objects?
I think i mixed everthing and confused a lot.
CAn you please tell me concept of object and differences between object types(kernel,user,gdi)
Thanks a lot.
|
|
|
|
|
When a process is cretaed ; windows create a process handle table (right?) and kernel objects store here.
But where do windows store other objects handles.
For example:
I run a process and then win. cretae a process handle table then, program call these functions
CreateThread() returns handleForKernel
CreateBitmap() returns handleForGdi
CeateWindow () returns handleForUser.
Where are these handles?
All of them in process handle table?If not which one process handle table which ones are not?
in system adress space or program adress space?
|
|
|
|
|
Hi:
i m new to Crystal Reporting , and don't know how to use it in VC++ . can any one help me.
|
|
|
|
|
|
|
Hello. I'm new to vc++.(So sorry if i ask something simple) I'm trying to make a program that will connect to a machine's modem using the pc's internal modem by telephone.
But i can't find a way to establish the connection. I keep seeing that i should use "at" commands. But i can't find any way to do that.
Can please anyone tell me of a tutorial or some code to do that?
(I have managed to do the job using rs232 connection but i have to also do it with a modem)
Thank you very musch in advance
|
|
|
|
|
In general, you send command strings to the modem, and then reads the answer from the modem.
The commands (all of them) starts with the letters "AT" (without the quotes).
That's the reason why they are called AT commands.
(AFAIK, it started with modems from Hayes, so the command set is also known as Hayes command set".
You can also use Windows Tapi (telephone api) to communicate with modems (and other related gadgets).
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Communicating with a modem is a real tough job.
There are some samples here.
The biggest problem is that you have to wait for response.
Greetings from Germany
|
|
|
|