|
Dan I do not have an answer for you. But I have been working on the same problem for two days. SetForeground() does not always work, especially if some other app has a system modal message displayed.
If I find the answer, I will email you. And if you find the answer, would you please email me.
Phil
at
LynnPhil@Qwest.net
|
|
|
|
|
Hello,
Im sure this has been asked before but i couldnt find it in any of the recent post.
I am looking for a good online tutorial over MFC network Programing. Either with CSocket or
CAsyncSocket.
It appears this tutorial needs to be written for a dummy cuase I've gone through Several Sample Apps and MSDN and Cant get seem to get it down.
If it was a simple chat server/client like the one included in MSDN, but with the CSocket stuff explained a little it would be perfect.
If you know of a tut like that please respond.
Thanks for any help,
HAM
|
|
|
|
|
I want to bring on top a browse item dialog box when login to my app is successful while my main frame window is hide but I can't.
Thanks for your assistance.
Do Quyet Tien
|
|
|
|
|
The main window not being visible stops SetWindowPos from working ? If you've not tried that, in your dialog it's
SetWindowPos (&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOZORDER);
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
|
Hello, the codegurus around the world.;) (Copy Right 2001 Masaaki Onishi)
SetWindowPos didn't work in OnInitDialog to hide its own dialog.
But, MoveWindow works.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Make the dialog box modeless.
|
|
|
|
|
Is it possible to use DateTimePicker
control in non-MFC Win32 application?
|
|
|
|
|
The DTP control is a built-in common control, as long as you have an updated comctl32.dll, so yes it's possible.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
I want to change the appearance of the scroll bar in a List View
Control.
1.How can I change a scrollbar palette?
The following code doesn't work:
InitializeFlatSB(hListViewWindow);
FlatSB_SetScrollProp(hListViewWindow,WSB_PROP_PALETTE,(int)palette,false);
2. The following code also doesn't do anything:
FlatSB_SetScrollProp(hListWindow,WSB_PROP_CYVTHUMB,10,false);
3. Is it possible to make an appearance of the scroll bar in a List View
Control based on bitmaps?
|
|
|
|
|
How can I set a bitmap on List View Control's background. And I need
to make it the way that when the user scrolls the list, bimap must
stay on it's place and doesn't scroll with the list.
|
|
|
|
|
Handle the WM_ERASEBKGND message. Of course, you have to implement all bitmap painting manually, there's no magic 'SetBackgroundBitmap' call
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I cannot modify by turn off WS_VISIBLE in PreCreateWindow, neither call ShowWindow(SW_HIDE) in OnCreate, window will hide but it still flash once before hide.
Thanks for your assistance.
Do Quyet Tien
|
|
|
|
|
Turn off WS_VISIBLE in PreCreateWindow and call ShowWindow(SW_HIDE) in your InitInstance.
|
|
|
|
|
i have a problem with file open dialog(CFileDialog),i want it allow multiselect with the following code:
CFileDialog dialog(TRUE,_T("mid"),
_T(""),FN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,
"MIDI files(*.mid)|*.mid|All files(*.*)|*.*||", NULL);
if (dialog.DoModal() != IDOK) return;
but if i select files more than 15,an error occur;
the MFC Library Reference say that i need to initialize the m_ofn.lpstrFile and m_ofn.nMaxFile.But how to initialize them?
Thanks in advance.
julia
|
|
|
|
|
Hello, the codegurus around the world.;)
Try this.
char szFN[256];
memset (szFN, 0, sizeof(szFN));
CFileDialog dlg (TRUE);
dlg.m_ofn.lpstrFilter = "Text Files (*.txt)\0*.txt;*.lst\0All Files (*.*)\0*.*\0";
dlg.m_ofn.lpstrTitle = _T("Open Text Files");
dlg.m_ofn.lpstrFile = szFN;
dlg.m_ofn.nMaxFile = sizeof(szFN);
dlg.m_ofn.Flags = OFN_OVERWRITEPROMPT | OFN_ALLOWMULTISELECT | OFN_ENABLEHOOK;
if (dlg.DoModal() == IDOK) {
}
int CFileDialog::DoModal()
{
ASSERT_VALID(this);
ASSERT(m_ofn.Flags & OFN_ENABLEHOOK);
ASSERT(m_ofn.lpfnHook != NULL);
ASSERT(AfxIsValidAddress(m_ofn.lpstrFile, m_ofn.nMaxFile));
DWORD nOffset = lstrlen(m_ofn.lpstrFile)+1;
ASSERT(nOffset <= m_ofn.nMaxFile);
memset(m_ofn.lpstrFile+nOffset, 0, (m_ofn.nMaxFile-nOffset)*sizeof(TCHAR));
..............
}
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
it works.
but whether the buffer's size have a limitation?
julia
|
|
|
|
|
I am trying to find a way to launch a DOS program and capture any info in my program that is sent to the console from this program on the fly.
for instance, if you run the program it may ask you for a certain key
that you press to continue. I am looking for a way to capture this info and automatically sned that info to the keyboard buffer..
any suggestions/tips ?
|
|
|
|
|
I have Regular DLL which is plugin for PowerPoint XP.
My DLL works fine in Debug Mode but it makes XP crash in Release Mode.
I debugged Release DLL and found following thing
I have simple Modal Dialog
which is being called through particular exported function of my DLL.
CGTitleDialog dlgTitle;
if (dlgTitle.DoModal() == IDOK){ ...
This Calls CDialog::DoMoal()
Inside CDialog::DoModal
// disable parent (before creating dialog)
HWND hWndParent = PreModal();
This furhter calls...
HWND CDialog::PreModal()
in CDialog::PreModal()
// allow OLE servers to disable themselves
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);
inside EnableModeless...
void CWinApp::EnableModeless(BOOL bEnable)
{
#ifdef _AFX_NO_OLE_SUPPORT
UNUSED(bEnable);
#endif
// no-op if main window is NULL or not a CFrameWnd
CWnd* pMainWnd = AfxGetMainWnd();
if (pMainWnd == NULL || !pMainWnd->IsFrameWnd())
return;
#ifndef _AFX_NO_OLE_SUPPORT
// check if notify hook installed
ASSERT_KINDOF(CFrameWnd, pMainWnd);
CFrameWnd* pFrameWnd = (CFrameWnd*)pMainWnd;
if (pFrameWnd->m_pNotifyHook != NULL)
pFrameWnd->m_pNotifyHook->OnEnableModeless(bEnable);
#endif
}
My program make PowerPoint XP crash as soon as try to step
inside above function. It doesnot jump to any line instead crashes instantly
but debug version DLL jumps to
// no-op if main window is NULL or not a CFrameWnd
CWnd* pMainWnd = AfxGetMainWnd();
line in above function and works fine.
What's wrong with Release Version DLL?
This DLL is plugin for PowerPoint XP...
Also my code uses high frequency timer… Can it be a cause of
Release version failure.
I remember somewhere I read that since release version is faster
that debug version it is possible that it fails in Timer.
Vijay Khot
vijay_khot@hotmail.com
|
|
|
|
|
I want to create drop down menus in my dos programs and i'm sure there's some library with all the functions I need but which one and how do i go about creating it.
|
|
|
|
|
I have developed a CListBox based control that overrides, PreSubClass() and OnDestroy(). In PreSubCLass a worker thread is created to query a database for the data to put into the control. The deadlock occurs when the user closes the dialog and the worker thread is still running. I over rode OnDestroy() to signal the thread to terminate and then WaitForSingleObject() to get signalled that the thread has terminated. I am using events to handle this synchronization. Unfortunately the threads deadlock as the UI thread is processing a window message, OnDestroy() and the worker is trying to call AddString which in turn calls ::SendMessage() which now blocks the worker thread. I've tried using a PostMessage call instead and that seemed to solve the deadlock issue. Unfortunately, it also had the side effect that the strings added to the list box never get displayed until the worker thread is complete. Incidently the worker thread checks for the signalled event to terminate within the while loop that is processing all the data returned from the database. Everything works fine, except when the dialog is closed while the worker thread is still running. Any ideas from some more experienced folk? Thanks.
Chris
|
|
|
|
|
Hello, the codegurus around the world.;) (Copy Right 2001 Masaaki Onishi)
We can use the following function to catch the message of "CLOSE".
LRESULT CMyDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message == WM_CLOSE)
return CDialog::WindowProc(message, wParam, lParam);
}
So, if the user tries to close the dailog even though thread is still running,
the message box shows to say that you can't close this since thread is still running.
However, since we can't take a look at this kind of message in Microsoft product,
you may put some code to make the thread clean in WindowProc
But, it may be tough since while the message is in process, it may be conflict if
we deal with the different message.
Hum, but only closing the application is a problem, so you don't care about the other message?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
if i have made multiple dialog boxes and i want to link them , how do i do it ? i mean one screen asks for a user id and password, and if i enter them and press OK i show be directed to the next dialog box. Any suggestions ?
<--- this is me
|
|
|
|
|
Hello, the codegurus around the world.;) (Copy Right Masaaki Onishi)
So, CPropertySheet exists.
We use two classes like CPropertySheet or CTabCtrl.
We can use each one to create PropertySheet.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I believe property sheets have a DoWizard function either in them, or documented in the MSDN, that allows you to run a wizard style dialog easily.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|