|
Hello,
I've created an implementaion of virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) for my CFrameWnd derived class. In this way, I can later vary which view is displayed:
BOOL CChildWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_pReportView = new CReportView;
m_pReportView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault, this,
VIEW_REPORT, pContext);
SetActiveView(m_pReportView);
m_pReportView->ShowWindow(SW_SHOW);
m_pReportView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
return TRUE;
}
This works, and works well. However, when I do this, for whatever reason I lose the Frame's previous style - The toolbar becomes sunken. Commenting out my implementation, the style immediately returns to normal. How can I do all this, while not having the toolbar become sunken?
Thanks,
Sternocera
|
|
|
|
|
My CToolbar derived class is created like this - I'm not sure how relevant that is, but I include it case it is:
int CChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | TBSTYLE_TRANSPARENT | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_CHILD_FRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// attach the hicolor bitmaps to the toolbar
AttachToolbarImages (IDB_HICOLORTOOLBAR_CHILD,
IDB_HICOLORTOOLBARDISABLED_CHILD,
IDB_HICOLORTOOLBARHOT_CHILD);
return 0;
}
Thanks,
Sternocera
|
|
|
|
|
Problem solved. Merely had to append this to int CChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct):
...
CWnd::OnCreate(lpCreateStruct);
DWORD dw = ::GetWindowLong(GetSafeHwnd(), GWL_EXSTYLE);
dw &= ~WS_EX_CLIENTEDGE;
::SetWindowLong(GetSafeHwnd(), GWL_EXSTYLE, dw);
}
|
|
|
|
|
hello frnds
plz help me regarding how to change font of Caption of Window Text.
Also whts the procedure to hide icon on task bar.
thanks
|
|
|
|
|
himuskanhere wrote: Hinding from TASK bar.
To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
himuskanhere wrote: and font chang of caption TEXT.
See here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
modified on Thursday, August 7, 2008 5:24 AM
|
|
|
|
|
hi ,
I have an application where in i need to change the speed of the file ,
am able to change tat using MCIWNDSETSPEED() where in it is changing the pitch of the file along with the
speed,...but i need to change only the speed like in windows media player...where in speeding up the file just changes the frames per second of the file...
and also could anyone help me changing the speed of an wav file...
thanks in advance,
Hari
|
|
|
|
|
This isn't a direct answer to your question, but I've heard of a product called "Seventh String", which changes the speed of music WITHOUT changing the pitch. There was a discussion about the technology used, which involved forrier transforms.
|
|
|
|
|
can you show me a sample ???
|
|
|
|
|
|
Hi all
I need to clarify a point with the usage of mutex locking .
mutexlock(&mutexobj);
Function1(socket &lnk);
mutexunlock(&mutexobj);
In Function1()
{
mutexlock(&mutexobj);
globalvar1= globalvar2;
mutexunlock(&mutexobj);
}
My questions :
-> Is it right/necessary to mutex lock inside Function1()? I understand a global lock/unlock surrounding the call to Function1() will ensure that the whole code / critical resources are thread safe .
I find such occurance of such locking/unlocking in many areas of the code I am working with . Is it not a problem ? .
redindian
|
|
|
|
|
You can re-enter the same mutex twice from the same thread: as you are owning it, you won't block when you try to lock it from the same thread. This prevents deadlock situation (if it you block, then re-entering it would cause a deadlock).
|
|
|
|
|
Thanks . But what I am curious about is - why should there be a lock/unlock inside Function1() when the whole function call is already locked ?.
redindian
|
|
|
|
|
In that particular case it doesn't make any sense. But sometimes, when you have a function with multiple 'paths' and some of them call Function1(), then you would like to still lock the full function. But I agree, it is a bit messy...
|
|
|
|
|
In the case of Mutex, Multiple Lock will not be a problem, but Mutiple unlock creates some problem. The first mutexunlock ( I guess mutexunlock is internally calling ReleaseMutex() ) will release the mutex and so the rest of the code will not be having any effect of the mutex.
|
|
|
|
|
Naveen wrote: The first mutexunlock ( I guess mutexunlock is internally calling ReleaseMutex()) will release the mutex
No, this is not correct. From MSDN[^]:
After a thread obtains ownership of a mutex, it can specify the same mutex in repeated calls to the wait-functions without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex that it already owns. To release its ownership under such circumstances, the thread must call ReleaseMutex once for each time that the mutex satisfied the conditions of a wait function.
|
|
|
|
|
Ho ho..
I didn’t know that. Thanks for correcting
|
|
|
|
|
I think its specifically for wait functions called inside a thread . But the code I am listing does not contain any wait functions . There is a second lock/unlock when there is an access to a global variable .
Cedric
I think Naveen's point that the first call to mutexunlock will unlock the mutex object and the rest of the call to Function1() will not be threadsafe . What do you say ?
I am taking an important decision to affect many critical functions which have these occurances..
redindian
|
|
|
|
|
Read the link I provided: there's no such thing as lockmutex and unlock mutex in the Win32 API but it is a WaitForSingleObject and a ReleaseMutex instead. The wait function will have the same effect as a lockmutex when the mutex becomes available.
I don't know how you implemented the lock and unlockmutex functions but they should normally follow those rules.
|
|
|
|
|
During a function call DoEvents is not fired from a timmer, but I want to redraw / refresh the UI during the function call. pls advice
|
|
|
|
|
DoEvents? Do I smell VB?
Steve
|
|
|
|
|
No C++
void DoEvents()
{
MSG oMSG;
while(::PeekMessage(&oMSG, NULL, 0, 0, PM_NOREMOVE))
{
if(::GetMessage(&oMSG, NULL, 0, 0))
{
::TranslateMessage(&oMSG);
::DispatchMessage(&oMSG);
}
else
{
break;
}
Sleep(100); // Try to minimize CPU usage
}
}
|
|
|
|
|
What is the problem exactly ? Just call this DoEvent function in your lenghty function whenever you want to refresh your UI. I would remove the Sleep, because it is not really needed.
Anyway, I think it would have been a bit easier if you would have used a thread.
|
|
|
|
|
Thanks for responce. This DoEvent call itself is from thread
since the UI is almost frized, I am using waitableTimmer from a thread to update the progress bar, it is fine,but if I min & Maximize; the window, progress bar is ok but UI(App main window , Dlg box) in not refreshed/redrawn untill the currentl lengthy operation is done. Can not put the length process in thread. Any wise advice pls
|
|
|
|
|
ptr_Electron wrote: Can not put the length process in thread.
Why is this not possible can you explain??
Regards,
Sandip.
|
|
|
|
|
No no, Techinical possible, but not as per the req, if I need to do that much of the code required changes.
|
|
|
|