|
How are all these progressbars we see around implemented? They suddenly pop up so its a modeless dialog. Then the app send them messages about the current progressbar position. Am I on the right track? Then after the app is done with whatever it was tracking, the dialog gets another message that terminates it.
Thanks,
ns
|
|
|
|
|
|
Wow! Its exactly what I want. I have to get my sendmessags working though, because they tell the bar how much to move. THats been a struggle for the last 5 days!!!!!!
Thanks,
ns
|
|
|
|
|
Also see this article[^] if you'd like to be able to show your users the estimated time remaining!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Wondering about the SendMessage to hidden button that you taught me. (I know I know - hidden menu next time):
<
code>pView->SendMessage(WM_COMMAND,IDC_BUTTONHIDDEN1,0);</code> that works great.
But for the API to simulate a button click apparently (not tried yet) I should do:
BM_CLICK
An application sends a BM_CLICK message to simulate the user clicking a button. This message causes the button to receive the WM_LBUTTONDOWN and WM_LBUTTONUP messages, and the button's parent window to receive a BN_CLICKED notification message.
To send this message, call the SendMessage function with the following parameters.
SendMessage(
(HWND) hWnd, // handle to destination window
BM_CLICK, // message to send
(WPARAM) wParam, // not used; must be zero
(LPARAM) lParam // not used; must be zero
);
So how come the WM_COMMAND triggers the button? It does, thats for sure, but the API equivalent with WM_COMMAND doesnt.....
Thanks,
|
|
|
|
|
When the user clicks a button, the parent window is eventually sent a WM_COMMAND message with the button's id as the wParam . MFC routes this message to the appropriate handler using the message map mechanism. So you can simply post a WM_COMMAND instead of simulating a button click the hard way.
ns wrote:
So how come the WM_COMMAND triggers the button? It does, thats for sure, but the API equivalent with WM_COMMAND doesnt.....
I'm not sure I follow. What do you mean by "API equivalent with WM_COMMAND"? Assuming the button's id is IDC_BUTTONHIDDEN1 , the way to execute the button's handler is:
CWnd* pWnd = ...;
pWnd->SendMessage (WM_COMMAND, IDC_BUTTONHIDDEN1);
which is what I believe you're doing.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm in the VB world when sending so no MFC at that end
Call SendMessage(hBtnHandle, BM_CLICK, byval 0&, byval 0&)
with:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
I think its the API that MFC uses under the covers...sorry if I confused you.
|
|
|
|
|
Ah! So, instead of sending a BM_CLICK message to the button, send a WM_COMMAND message to the view, like so:
Call SendMessage(hViewHandle, WM_COMMAND, IDC_HIDDEN_BUTTON_1, 0);
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Tried your idea - wasnt happy with that either. The BM_CLICK works. I'll be using this feature if/when i have to implement the cancel . ONly thing I'm wondering about is how do you terminate my dll at cancel . I need to look at the task timer before I ask any more questions...
Have fun!
|
|
|
|
|
ns wrote:
Have fun!
I will - I'm in the process of closing a deal with a startup! Hello 24 hour work days, goodbye sleep!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
From a design point of view, it's better to keep the knowledge of the hidden button (or menu) id within the view itself, by creating a public method that anyone can call. That way, you don't share resource ids across classes or (heaven forbid!) DLLs! Here's how:
Declare a public method in your view, eg:
void doSomething();
The implementation should send the view the hidden button command message, eg:
void CMyView::doSomething()
{
SendMessage (WM_COMMAND, IDC_BUTTONHIDDEN1);
}
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi! I'm using a Form, derived from FormView, and, by code i'm dynamically filling it with static objects, i would like the form (has a vertical scrollbar) to resize as the objects are being created.
|
|
|
|
|
Use SetScrollToFitSize()
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Thank you Roger, but i could not find such function in MSDN (i'm using .NET).
Do that function really resizes my form?
Thanks
|
|
|
|
|
Hi
I need an example for AIFF WAV convertion
thank you
|
|
|
|
|
I asked this I think a very long time ago and cant find the thread. Basically in the create function for a CProgressCtrl,
BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
The nID is something we have to generate via the string table or the resource symbols,since we dont have a control on a dialog or anything... is that correct?
Thanks,
ns
|
|
|
|
|
ns wrote:
since we dont have a control on a dialog or anything
If you don't have any controls except progress bar, then use any integer value for nID.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
I've so far used this format
pView->SendMessage(WM_COMMAND,IDC_BUTTONHIDDEN5,0);
because all I wanted was to trigger the handler. Now i want to give the handler an integer value from the sender to process.
Now if I did put the integer value into the sendMesssage, how would my handler access it? Or cant I use this technique for what I want to do?
Thanks,
ns
|
|
|
|
|
Unfortunately you can't do this thru SendMessage() because it's handled in a stock way.
However, if you're using a doc/view interface (as I think you are), you can call UpdateView() and pass it a "hint" (an application specific DWORD ). The hint allows the receiving view to respond in an appropriate manner (eg: execute the IDC_BUTTONHIDDEN5 handler with a certain context).
The identifier IDC_BUTTONHIDDEN5 leads me to believe you're using the hidden button to respond to app specific messages. This is a common technique, but you may find it easier to use a custom menu command instead of adding buttons to the view/dialog. Just create a new menu resource (I call mine MENU_HIDDEN_COMMANDS ) that contains all your hidden commands. A major benefit to doing this is that your hidden command ids will always be unique, allowing these messages to be posted to any view/dialog. Buttons ids are only guaranteed to be unique within the dialog on which they reside.
Hope this helps!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Great idea.....
Meanwhile, another sendmessage question...
I want to send the progressbar a 1026 which is PBM_SETPOS. I am trying to see if this sendmessage works since my PBM_STEPIT isnt working I think.
SO how do I send the pos in this API sendmessage (unfortunately its from a VB dll). This is what I have to send and I dont know how to find out what the progressbar recognises as its position (wParam or LParam);
How does one get a hold of such info (sendMessage parameters)
Thanks,
|
|
|
|
|
From VC++'s online help, PBM_SETPOS treats wParam as the new position and ignores lParam (which should be zero).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Sir,
I am developing the code for rotation of the Rectangle and ellipse in my projects.I have seen hat SetWorldTransform() cannot function in 98.So I am searching for alernative method to rotate my rect.I should be able to save the rotated rect in my List containg the CRect objects.I would be thankful to you if I get The solution as soon as possible as it is to be embedded immediately
..............
I have rotated the rect by using XFORM structure and calculated the new values and have drawn the rotated rect using Polygon() function.But I am unable to modify my List rect object with these coordinates as that draws from the TOPLEFT to BOTTOMRIGHT
Sir u can provide any of the solution.
Waiting for ur reply
|
|
|
|
|
|
It sounds like you will simply need to create a new list and a new structure that can hold the four points that you need to store your rectagle. Or you could use your CRect class and the XFORM class, and you could generate the new rectangle on the fly with a conversion function that returns the translated points.
There is not a whole lot of native support for anything in windows that is not axis aligned.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi
I want to use DirectSound with different file formats.
For Instance I need to play AIFF AIFC formats and some other.
I would appreciate any information regarding my question as well as samples of C++ code for conversions from AIFF AIFC to WAV files
Thank you
Klim
|
|
|
|