|
Anyone has any idea how to initialize a listbox with file names matching a given criterion? I'd like the listbox to display all .txt files in a directory. Thanks,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
|
Because it doesnt work! I am suspecting that maybe I dont have the right parent for a control on a CFormView form.
THe SendMessage API is being called with handles obtained from:
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
CProgressBarCZipView *pView = (CProgressBarCZipView *) pChild->GetActiveView();
long parentHandle = (long)pView->GetSafeHwnd();
CButton *pBar = (CButton*)GetDlgItem(IDC_BUTTON3);
long hPbHandle = (long)pBar->GetSafeHwnd();
_CllRemoteCall p;
p.CreateDispatch("DllwithForm.Class1");
p.TestButton(hPbHandle,parentHandle);
This call suposedly causes the SendMessage to execute (or not !)
SendMessage(parentHAndle, WM_COMMAND, 0, buttonHandle)
but I'm still doing something wrong.
Any ideas ?
Thanks,
ns
|
|
|
|
|
wParam (3rd arg) in SendMessage call should be the button ID, not the button handle. It should look more or less like this:
SendMessage(parentHandle, WM_COMMAND, IDC_BUTTON3, 0);
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
It didnt like the ordering of the parameters and crashed. I found from MSDN:
WM_COMMAND
The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd,
WM_COMMAND,
WPARAM wParam,
LPARAM lParam
);
so I did
SendMessage(parentHAndle, WM_COMMAND, 0, buttonHandle)
Doesnt crash now, but alas my poor lowly button remains untriggered(I havent graduated to your idea of custom messages yet )
I fear its maybe time to look into shared memory, which is not going to be easy.
If only the sendmessage worked...BTW I also tried sending in the ID of the button instead of the handle so that the SendMessage could use it, but still not.
You have really put a lot of time into my problem and I want to say that I appreciate it very much.
Thanks,
ns
|
|
|
|
|
Try with both ID and handle:
SendMessage(parentHandle, WM_COMMAND, ID_BUTTON, buttonHandle);
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
That made it very unhappy....crashed grandly.
Thanks,
ns
|
|
|
|
|
Try this:
<br />
SendMessage(parentHandle, WM_COMMAND, MAKELONG( IDC_BUTTON3, BN_CLICKED ), buttonHandle );<br />
Chris Richardson
|
|
|
|
|
Does anyone here have an example of a User Interface library for AD Schema modifications?
I am working on some additional attributes for a user and need to place a new tab in the properties window (like Exchange does) so the admin has a way to set the properties.
|
|
|
|
|
I am trying to get to get a tree conrol to place the text that it selects at the very top of its corresponding view. I have tried the following code (as is, and with adding/subtracting a value to it) and the result is always that the highlighted text is 1 line above the visible line. Without the LineScroll code, then the selection (highlight) may/may not appear within the visible view, depending upon the direction of the next line.
sSecondPart = sItemData.Right(sItemData.GetLength()-sFirstPart.GetLength());
CMainFrame* pMDIFrame = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMDIFrame);
CChildFrame* pMDIChild = (CChildFrame*)pMDIFrame->MDIGetActive();
ASSERT(pMDIChild);
CEJOrganizerView* pView = (CEJOrganizerView*) pMDIChild->m_wndSplitter.GetPane(0,1);
CRichEditCtrl& rCtrl = pView->GetRichEditCtrl();
int iStart = rCtrl.LineIndex(atoi(sSecondPart));
int iEnd = rCtrl.LineIndex(atoi(sSecondPart)+1);
int iFirstVisible = rCtrl.GetFirstVisibleLine();
// This doesn't work as intended,
rCtrl.LineScroll(rCtrl.LineIndex(atoi(sSecondPart)) - iFirstVisible,0);
rCtrl.SetSel(iStart,iEnd);
if I use: rCtrl.LineScroll(-iFirstVisible,0) then the selected text is always in view, but it is always toward the bottom of the view.
Thanks
Wade Holt
|
|
|
|
|
Ok, so how do I get from:
double x = .0625;
CString s;
s.Format("???",x);
so that s looks like: 6.25000000000000000E-02
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
s.Format("%.16E",x) - i think...
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
|
Try this:
double fp = .0625;<br />
CString s;<br />
s.Format( "%e", fp );
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Nitron wrote:
so that s looks like: 6.25000000000000000E-02
This should do it:
s.Format(_T("%.15e\n"), x);
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
Nitron
_________________________________________--
message sent on 100% recycled electrons.
|
|
|
|
|
CProgressBarCZipView *pView = (CProgressBarCZipView *) pChild->GetActiveView();
long hPbHandle = (long)pView->GetSafeHwnd();
CButton *pBar = (CButton*)GetDlgItem(IDC_BUTTON3);
long hPbHandle = (long)pBar->GetSafeHwnd();
Thanks,
ns
|
|
|
|
|
Yes, except that you mistakenly (typo) overwrote hPbHandle .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
What is the best way to set up a timer for a process that will take an hour or two?
_____________________
"So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too."
Breakfast of Champions, Kurt Vonnegut
|
|
|
|
|
By 'process' you mean Windows process which has some timeout period in your case? Or some general activity?
You have number of options - classic Window timers, waitable timers, WaitForXXX APIs.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
The user sets the timeout period.
_____________________
"So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too."
Breakfast of Champions, Kurt Vonnegut
|
|
|
|
|
The timeout of what? Do you create other process by spawning some executable, or are you performing some activity in your own app?
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Tomasz Sowinski wrote:
The timeout of what?
When the videotape ends. A friend wants me to write him an app to stop his video capture program after a period of time so he can run the program overnight without filling his harddrive and crashing.
I know how to use SetTimer() for short delays, but I want to know if there is a better solution for long delays (like an hour or more).
_____________________
"So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too."
Breakfast of Champions, Kurt Vonnegut
|
|
|
|
|
I'd use WaitForSingleObject with timeout in this case.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Thanks.
_____________________
"So in the interests of survival, they trained themselves to be agreeing machines instead of thinking machines. All their minds had to do was to discover what other people were thinking, and then they thought that, too."
Breakfast of Champions, Kurt Vonnegut
|
|
|
|