|
where do you need it? It differs according to your need. Btw, VC++ is not something totally different from C++. C++ is still inside VC++ . If you are making a console application using VC++, you can still use "cin,cout" if MFC (or SDK), and if you want(most probably) to get from a textbox (CEdit) ::GetWindowText(), ::SetWindowText()
:Gong: 歡迎光臨 吐 西批 :Gong:
|
|
|
|
|
To disable a menu item in an sdi app i tried
(pFrame->GetMenu)->EnableMenuItem(IDC_MY_ID,MF_GRAYED);
but it did not work. How to do this?
Thanks in advance.
KIRAN PINJARLA
|
|
|
|
|
Hi Kiran,
try this :-
pFrame->GetMenu)->EnableMenuItem(IDC_MY_ID,MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
Regards,
vinsankar
|
|
|
|
|
Thank you.
But it did not work.
KIRAN PINJARLA
|
|
|
|
|
Then try to post more info about...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
You can use the following Macro ,
ON_UPDATE_COMMAND_UI( MENU_ID, memberFxn ) and in the definition
void memberFxn( CCmdUI* pCmdUI )
{
pCmdUI->Enable(false);
}
Regards,
vinsankar
|
|
|
|
|
|
hi
ok as guys are not able to understand what i am asking i will try to be specific
run spy++ and in windows section(ctrl+w) you see different windows handel values,
i want to use one of those value in my program and send a message to that particular window, defined by the window handel id,
exm:
in spy++ one appliction window has id 2222
i want to send message to 2222 window handel id
how to do tht,
as far i know u simply cant do like this HWND h=2222;
my app
for suppose there is xyz window or application, i query for HWND in Spy++, it returns me 2222, i want to use tht value in my application to send a message to tht window,
SendMessage( hwnd a, ...,...,...);
how to do hwnd a = 2222;
any idea or suggestion,
the basic doubt is how to use a handel value provided by spy++, if app does nt have a window or a hidden application or tray icon.
-- modified at 17:10 Sunday 17th December, 2006
|
|
|
|
|
swarup wrote: it returns me 2222, i want to use tht value in my application to send a message to tht window,
SendMessage( hwnd a, ...,...,...);
how to do hwnd a = 2222;
You can use this value as handle in SendMessage .
swarup wrote: if app does nt have a window or a hidden application or tray icon.
How would you get handle , if there is no window ?
|
|
|
|
|
Actually he can, if the app has the window hidden.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
why cant you , if you dont see a window tht does mean one ap does nt hv a window, anyway tht is not my problem what is ma problem is i knw from external program the hwnd value and i want to use tht value in ma application to send message to tht hwnd value, any idea
|
|
|
|
|
As said earlier. You can use SendMessage . if you have handle to that window. No matter if its hidden.
swarup wrote: knw from external program the hwnd value and i want to use tht value in ma application to send message to tht hwnd value, any idea
Then what problem?
|
|
|
|
|
i know i have to use sendmessage, but how to code it in my application, now dont tell me use this way SendMessage(2222, "any message","any message","any message");
how to use a hwnd value returned or shown by spy++, in the VC++ program programaticaly
|
|
|
|
|
swarup wrote: how to use a hwnd value returned or shown by spy++, in the VC++ program programaticaly
Mentioning SPY++ from start leads to confusion. You can look in to this[^] article, to see how to get windows handle.
Alternatively, you can use FindWindow() , if you have title to window in question.
|
|
|
|
|
no i dont want sample for spy, i can make spy++,
1st ? can there be a window with out name
2nd dont u think there are windows or application who has a window but hidden.
so in tht case how to get there handel
you query in SPY++ and you come to know about the handel value
now you want to hard code tht value in your app and send some message
for this do u have any idea or it cant be done ?
|
|
|
|
|
CPallini wrote: Actually he can, if the app has the window hidden.
Yes, But I was concerned about "if application does not have window" statement.
|
|
|
|
|
In fact, his words where a bit inaccurate. Anyway what he was asking was enough clear, at least to me...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Anyway what he was asking was enough clear, at least to me
It was not clear, atleast for me ..
I was assuming from start, he has way to get window handle. But he was asking for it in actual.
|
|
|
|
|
thanks guys,
i dont need the program anymore
|
|
|
|
|
Hi everybody,
I have encountered a strange problem, and I don't even know why it is happening. Anyways, I have a dialog box that has a progress bar, and some static controls that show the elapsed time, percentage...and such. Now, I start a new thread and do the work, and update the static controls with SetDlgItemText (this is no MFC app, just Win32 and ATL). Now the static controls displays the text correctly only the first time, and later on the new text draws over the previous one, and after a while static controls just show a complete mess! I discovered that if I open any other window in front of my window, and then move it away, the static controls will briefly show the text correctly, but then again is the same. I suppose it got something to do with the messages those controls are receiving, but can't figure out why. It is as if the controls are drawing the text, but not deleting the previous one.
Thank you.
|
|
|
|
|
You could try forcing a repaint by calling
::InvalidateRect(hwdDlg, NULL, TRUE);
::UpdateWindow(hwdDlg);
each time you update the status (change the controls).
|
|
|
|
|
No, it didn't help, but thank you.
|
|
|
|
|
Why InvalidateRect or UpDateWindow didnt work?
|
|
|
|
|
I really don't know. This is what I have done:
::InvalidateRect( hWndPercent, NULL, TRUE );
::UpdateWindow( hWndPercent );
If I do this:
Invalidate(TRUE)
then the static controls are displaying text correctly, but I am redrawing the whole dialog so I also have a terrible flickering.
Thanks.
|
|
|
|
|
mike holleywell wrote: Invalidate(TRUE)
then the static controls are displaying text correctly, but I am redrawing the whole dialog so I also have a terrible flickering.
Try ::InvalidateRect(hWndPercent, NULL, FALSE) so the background doesn't get redrawn every time.
Sorry about that.
|
|
|
|
|