|
well... that sucks...
thanks anyway!
|
|
|
|
|
Hi everybody,
I have created an PopUp Menu in a CDialog...it works OK.
Now I want to create a PopUp Menu inside an ActiveX every time I click Button RIGHT of the mouse...
I have copied the code inside the function WM_RBUTTONDOWN...The problem is that it shows the Menu but it is DISABLED (it is shown but I can not select an option).
How can I do it to solve it...to make it enable?
Thanks
Here the code :
HMENU hMenu = ::CreatePopupMenu();
if (NULL != hMenu)
{
// add a few test items
::AppendMenu(hMenu, MF_ENABLED | MF_STRING & !MF_GRAYED, 1, "Change Color");
::AppendMenu(hMenu, MF_ENABLED | MF_STRING & !MF_GRAYED, 2, "Hide");
::AppendMenu(hMenu, MF_ENABLED | MF_STRING & !MF_GRAYED, 3, "Item 3-");
ClientToScreen(&point);
int sel = ::TrackPopupMenuEx(hMenu,
TPM_CENTERALIGN | TPM_RETURNCMD,
point.x,
point.y,
m_hWnd,
NULL);
CString s;
s.Format("The selected item is %d", sel);
TRACE(s);
:estroyMenu(hMenu);
|
|
|
|
|
javi_jmc wrote:
& !MF_GRAYED
These parts are not necessary, and will actually screw it up and make it not work.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How do I implement 'delay' in VC++?
I also need to find out a way to get the "time elapsed" between two commands like when the data on the serial port goes high.
Can some one also give me info on the following -
GettickCount
Dword
VERIFY
ASSERT
dwcount
Thanks in advance.
-hithesh
|
|
|
|
|
Sleep is the command to make your app stop for a bit.
hithesh wrote:
Can some one also give me info on the following -
msdn.microsoft.com can.
hithesh wrote:
GettickCount
The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. ( first hit on google )
hithesh wrote:
Dword
A DWORD is an unsigned long. It's a really big number.
hithesh wrote:
ASSERT
An ASSERT is a construct that will fail if the condition you pass it fails. This means that in debugging, you can check the assumptions that your code makes about the state of your application at any point. It is not included in release builds, and should be used for debugging only.
hithesh wrote:
dwcount
Is probably a variable called count, that is of type DWORD, and has been created using Hungarian notation ( where the first few letters of a camel case variable name denote the type of the variable )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian, Thanks for the answers.
For the delay, I knew about sleep. I need something thats similar to a timer.
like -
1. when a bit goes high
2. start timer
3. stop timer when the bit goes low.
Sleep is used when you know the amount of delay you want, right? If this is not right, plz gimme an example.
|
|
|
|
|
Anonymous wrote:
Sleep is used when you know the amount of delay you want, right?
Yes.
I don't know of any way to do this without implimenting it yourself, unless there's a variation on WaitForSingleObject that waits for a memory location to change. I'd imagine the thing to do is use sleep to sleep for small amounts of time, and then check your bit inbetween.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
chris,
How about settimer()?
I can't use sleep because, I am trying to find out the time duration during which the input is high and also the time duration during which the input is low. This is from the serial port which receives the Infra red signal from the TV remote. Then, I send the same signal out. Its kinda like learning.
|
|
|
|
|
Oh, OK. I've done stuff like that before. Yes, I used SetTimer inside my class that watches the serial port, and you can use a get time function to get the time before and after, to work out an interval. My code was in C#, and I was using the serial port as an input device.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Can you give me an example. I looked at msdn, no good.
Thanks.
-hithesh
|
|
|
|
|
|
Hi everyone,
I have a main window with a gradient background onto which client area I output text using DrawTextEx. The background of the rectangle of the drawtext function is set to transparent. I invalidate this rectangle everytime I change the text so that the new text will be visible on the gradient background. This works fine for a while and then suddenly windows seems to stop painting the window all together ....? The text still continiues to be outputed , but on a white rectangle background now. The window does not seem to repaint either. I am using straight WIN32 api and simple message handling.
Anybody have any ideas ? This is driving up the walls... help will be much appreciated.
Carpe Deum
|
|
|
|
|
Perhaps you're not freeing resources (pens, brushes) you use in your painting code? That could lead to resource exhaustion. Try adding VERIFY s to your code to verify correct operation and see if they fail.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I write the code which is given below that is getting ram and hard disk capacity from user than saving it in a file and than displaying the file. after that i jst want to display all the records entered by the user and also display the total number of computers whose records were entered by the user. plz hlp me what should i do. code is below:
//Header Files
#include <iostream.h>//header file for input output streams
#include <fstream.h>// Header for file I/O
#include <conio.h>//header file for console input output
using namespace std;
//computerspec structurre
struct computerspec {
int ram;
int hdisk;
}compuspec;
int main()
{//start main
char ch;
ofstream out("computerspec.txt");//creating file name
out<<"RAM"<<"\t"<<"Hard disk"<<endl;
do=""
="" {="" start="" of="" while="" loop
="" prompt="" the="" user="" to="" enter="" ram="" capacity
="" cout<<"enter="" capacity"<<endl;
="" cin="">>compuspec.ram;
//for new line
cout<<endl;
prompt="" the="" user="" to="" enter="" hard="" disk="" capacity
="" cout<<"enter="" capacity"<<endl;
="" cin="">>compuspec.hdisk;
//for new line
cout<
|
|
|
|
|
|
While it is not hurting anything, why do you have the computerspec structure if you are using the member variables individually? I would think you'd want something like:
struct computerspec
{
int compnum;
int ram;
int hdisk;
};
void main( void )
{
computerspec compuspec;
compuspec.compnum = 1;
compuspec.ram = 1024;
compuspec.hdisk = 80;
out << compuspec;
compuspec.compnum = 2;
compuspec.ram = 4096;
compuspec.hdisk = 40;
out << compuspec;
...
compuspec.compnum = -1;
compuspec.ram = 0;
compuspec.hdisk = 0;
out << compuspec;
out.close();
...
do
{
in << compuspec;
} while (compuspec.compnum != -1);
} Note that this is untested and may not be syntactically correct but I am just trying to give you an idea.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Still i m not getting what i want to know!!! plz smebody hlp!!
|
|
|
|
|
rose aashii wrote:
Still i m not getting what i want to know!!!
What is it that you are still wanting to know?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am farily new to c++ and have been trying to compile something but it is giving errors about converting the two different types of char. Is there anyway that I can actually convert the char to a char* or have I got completley the wrong idea?
|
|
|
|
|
I think that you are off base.... post the code that you are having a problem with so we can help you better.
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
CIni ini;
ini.SetPathName(_T("D:\\Programs\\Microsoft Visual Studio\\MyProjects\\Prog12\\Debug\\IniDemo.ini"));
char test = ini.GetChar(_T("History"), _T("Input"), TCHAR("NoneSet"));
char* Program = "";
char* Paramaters = "";
char* workingDirectory = "";
// Now just use ShellExecute to run it
ShellExecute( NULL, "open", Program, Paramaters, workingDirectory, SW_SHOW );
The char test is the one that I need to be char* otherwise the ShellExecute will not work properly. I dont really understand all of that code yet which is probably why I cant do it correctly.
|
|
|
|
|
talkster5 wrote:
The char test is the one that I need
Since test is not being used, why do you need it at all?
What does CIni::GetChar() return? More importantly, what is the third parameter supposed to be? I'm not sure why the class differentiates between getting a char vs. getting a string , but in any case, you need to change your code to the following in order to pacify the compiler:
char test = ini.GetChar(_T("History"), _T("Input"), ' '); Why are you mixing _T() and TCHAR() ? That in itself doesn't hurt anything but it does make your code hard to read.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The information for the shellexecute is going to be stored in an ini file so at the moment I am just testing getting the information from an ini file which is why the char test is there but now I need it to be a char* so I can actually use it in the shellexecute as when I compile it says shellexecute can only use char* and not char.
|
|
|
|
|
You cannot use the GetChar() method to retrieve a char* value. Which parameter of ShellExecute() is in error?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The Program, Paramaters and working directory all do not work if its just char.
|
|
|
|