|
THe CWAitDialog wil be created on the VC side. the user presses a menu item: MAke DAtabase
THe handler creates a CWait object. All I get from the dll is the loop counter. IT does no UI generation. Unless I'm misunderstanding, if I can get my sendmessage to work, I think (optimist!) that CWait will work. Brcause then I can do stuff like:
void OnButtonREceivingMessage
{
FunctionCalledInButtonHandler;
}
void FunctionCalledInButtonHandler() each time the message is sent
{
BOOL bContinue = TRUE;
CWaitDialog dlg (&bContinue);
globalCounter +=1;
int nPercent = globalCounter something;
dlg.SetPercentComplete (nPercent);
dlg.Pump ();
}
}
Does that make sense?
Thanks,
ns
|
|
|
|
|
Yes, it should work. You may also get rid of this VB-style button-press method invocation. Why don't you use (WM_APP + n) as special message which CWaitDialog would handle and call its SetPercentComplete and Pump?
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
just wary of messing with message map entries, but I shall be brave!
Thanks,
ns
|
|
|
|
|
I've been trying to sendmessage to the status bar progress bar all day today. I can send it to the progressbar on the form ,but not to the one in the status bar...
Thanks,
ns
|
|
|
|
|
Although I was able to sendmessage to progressbar directlly PBM_STEPIT. But looks like WM_COMMAND has different requirements..
Thanks,
ns
|
|
|
|
|
Everything works as advertised. You send PBM_STEPIT to control which does something in response. Controls send WM_COMMAND (or WM_NOTIFY) messages to their parents to notify parents about events.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
The sendMessage in the VB dll is not coming from a control. Its in a for loop. I'm trying to aim it at a progressbar in the VC. So maybe I cant use WM_COMMAND since its not a control sending it?
Thanks,
ns
|
|
|
|
|
Whew! It was a five day struggle, but the darn thing works now. I couldnt use the CP class that embeds the progressbar into the status bar (too bad), and I couldnt send a message triggering a button to try CWaitClass (which has the cancel feature). Just as a last straw, I did the whole business of embedding a control manually (string table and indicators and all that stuff). THis way I was able to get a good handle apparently, that the dll liked:
long CMHandle = (long)(((CMainFrame*)AfxGetMainWnd())->m_wndStatusBar.m_WzdProgressCtrl).GetSafeHwnd();
Someone is bound to ask for a cancel feature in my app, so I'll keep plugging away at the sendmessage user defined message idea. So for the moment this problem is resolved. Thank goodness!
Appreciate all the time you spent on this and the interest. Now onto the next challenge!
Thanks,
ns
|
|
|
|
|
ns wrote:
Someone is bound to ask for a cancel feature in my app,
Another reason to check out TaskTimer[^] (see the section "Responding to user input while performing a long task").
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
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
|
|
|
|