|
|
|
When i prepared the reply your second question, you have deleted your post. What happend? Well, anyway i'm posting the prepared reply.
If you find trouble in using CBitmap , then i'll recommend you SDK functions to do the same. Well, you can use LoadImage()[^] to load the bitmap and you'll get a handle. Then by using GetBitmapBits()[^] you could access the bitmap data. Well check this article[^] about how to load the image by using LoadImage() .
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I have tried creating DialogBar in MDI application using VC 2008 with steps mentioned in Dialog Bars[^]. But when running application only document is there but not the Dialogbar.
The code generated by MFC in CMainFrame::OnCreate() is different from the sample as follows:
<br />
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
BOOL bNameValid;<br />
<br />
CMDITabInfo mdiTabParams;<br />
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
mdiTabParams.m_bActiveTabCloseButton = TRUE;
mdiTabParams.m_bTabIcons = FALSE;
mdiTabParams.m_bAutoColor = TRUE;
mdiTabParams.m_bDocumentMenu = TRUE;
EnableMDITabbedGroups(TRUE, mdiTabParams);<br />
<br />
if (!m_wndMenuBar.Create(this))<br />
{<br />
TRACE0("Failed to create menubar\n");<br />
return -1;
}<br />
<br />
m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY);<br />
<br />
CMFCPopupMenu::SetForceMenuFocus(FALSE);<br />
<br />
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||<br />
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))<br />
{<br />
TRACE0("Failed to create toolbar\n");<br />
return -1;
}<br />
<br />
CString strToolBarName;<br />
bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD);<br />
ASSERT(bNameValid);<br />
m_wndToolBar.SetWindowText(strToolBarName);<br />
<br />
CString strCustomize;<br />
bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE);<br />
ASSERT(bNameValid);<br />
m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);<br />
<br />
<br />
if( !m_wndToolbox.Create(this,<br />
IDD_TOOLBOX,<br />
CBRS_LEFT | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY,<br />
IDD_TOOLBOX) )<br />
{<br />
TRACE0(_T("Failed to create the toolbox\n"));<br />
return -1;<br />
}<br />
m_wndToolbox.SetWindowText("Toolbox");<br />
<br />
<br />
<br />
if (!m_wndStatusBar.Create(this))<br />
{<br />
TRACE0("Failed to create status bar\n");<br />
return -1;
}<br />
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));<br />
<br />
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);<br />
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);<br />
<br />
m_wndToolbox.EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);<br />
<br />
EnableDocking(CBRS_ALIGN_ANY);<br />
DockPane(&m_wndMenuBar);<br />
DockPane(&m_wndToolBar);<br />
<br />
<br />
CDockingManager::SetDockingMode(DT_SMART);<br />
EnableAutoHidePanes(CBRS_ALIGN_ANY);<br />
<br />
EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);<br />
<br />
EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR);<br />
<br />
CMFCToolBar::EnableQuickCustomization();<br />
<br />
return 0;<br />
|
|
|
|
|
I have 20M data to transfer through the net without one bit error,so i have to use the Hamming code to check and correct the data.
anyone can provide the implementation of Hamming code with C/C++,suppose the transfer input data is : unsigned char* buff=new char[1024*1024*20];
thanks.
|
|
|
|
|
|
Sure is a shame that there's no way to search for such stuff...
|
|
|
|
|
Does the latest Visual C++ redistributable, 2008 SP1, contain cumulative binaries of earlier C++ binaries, for instance 2003 and 2005 ones?
Or each redistributable package is a standalone installation?
Regards.
|
|
|
|
|
The Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) installs runtime components of Visual C++ Libraries required to run applications developed with Visual C++ SP1 on a computer that does not have Visual C++ 2008 SP1 installed.
So I doubt it it's got any more than the C and C++ run-time libraries supplied with Visual C++ 2008 SP1.
You could of course download it and try installing it in a clean VM?
|
|
|
|
|
Hi all,
in message box the buttons are looking as flat button i want to show button of message box like dialog box button,or xp style button.
is it possible.
please tell me .
i m waiting for your valuable suggestions.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Message boxes are xp/vista style by default.
If you're seeing flat buttons maybe that's because of the parent window. Don't use HWND_DESKTOP (or 0) and make sure you have created and initialized the parent window to use.
Hope it helps
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: Shall we change button style of messagebox?
Yes we shall. When?
lol anyway you need something like MessageBoxIndirect API?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Hi,
i want a simple code, to get some information of system.
windows type(x64 or x86 - version - service pack and ...) - cpu information
and ...
i am in a hurry for it
please help me,
Zo.Naderi-Iran
|
|
|
|
|
|
Did that article help you?
www.logicsims.ir
|
|
|
|
|
hi!
no, i want a quick and simple way!
Zo.Naderi-Iran
|
|
|
|
|
Hi, All
I am Creating a Thread Using CreateThread() Function and in it's procedure I am performing my Task
But on a Specific Condition i want Terminate it and for it I am using TerminateThread() Function but it Return 0 Which indicate Failure as per msdn it require that my CreateThread() handle must have THREAD_TERMINATE access How Can i Set it?
Thanks
Mitesh
~Khatri Mitesh
khatrimitesh@hotmail.com
Bikaner (Rajasthan)
INDIA
|
|
|
|
|
~Khatri Mitesh~ wrote: But on a Specific Condition i want Terminate it and for it I am using TerminateThread() Function
You should never end a thread this way. A much better approach is to simply set a flag that is checked regularly by your thread. When the flag is set, the thread knows it has to end and it will do it naturally (instead of being killed in the middle of something).
|
|
|
|
|
You should never use TerminateThread(), since it can easly cause deadlock in your application. Check this[^] and the documentation from MSDN below.
MSDN: TerminateThread is a dangerous function that should only be used in the most extreme cases. You should call TerminateThread only if you know exactly what the target thread is doing, and you control all of the code that the target thread could possibly be running at the time of the termination. For example, TerminateThread can result in the following problems:
Well, you could use event object to implement same behavior. Well, in the mean while i found this thread[^] also. May be useful to you.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
As previous replies stated, you should never call TerminateThread (since there are better ways to handle your scenario). Anyway, if you're stuck on your (bad) idea, what about reading the documentation [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
we have four threads which have to call with milliseconds interval (66.67ms,200ms,10ms,100ms these are time intervals for resuming threads)
"windows timers" does not provide accuracy (perfect) by using windows timers results are not well accurate but if we use multimedia timers then there is problem of synchronization. processor does not takes windows event (mean mouse click or key pressed or repaint window etc etc these event take log time of interval to process )
we need much accuracy and fast user intraction with my application (mean click and key press etc etc)
what can be solution? and how can sychronize windows events with multimedia timers??
|
|
|
|
|
Are you trying to pass multimedia timer events into your window handling code or the other way round?
If it's the first option and you're using timerSetEvent , you could do this:
- For each timer events, create a kernel event.
- Create the the timer event using the flag
TIME_CALLBACK_EVENT_SET and pass the kernel event handle as the callback procedure. - Create a thread with a function that (in a loop) does a
WaitForMultipleObjects , waiting for any one of the kernel events set by the timers. - When an event is detected in the thread function, POST a window message as appropriate.
The general pattern of setting kernel events with timer events allows you to transfer the timer event into another thread.
BTW - do you realise that the multimedia timer API is obsolete and could easily disappear soon? You might be better off using timer queues (see this article for a description[^]) that, as far as I can tell, have the same resolution and accuracy as multimedia timers. Also, it looks like they're better tied into the Windows synchronisation functionality.
|
|
|
|
|
Stuart Dootson wrote: do you realise that the multimedia timer API is obsolete and could easily disappear soon?
Hi Stuart,
Where did you hear that? Link?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Hi Stuart,
Where did you hear that?
I told him.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|