|
Why "FlatSB" is useless in WTL?
::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...return 0.
Create a Dialog(or Edit Control、List Control...),
Set show HorizontalScrollBar and VerticalScrollBar,
in OnInitDialog(...):
BOOL bRet = ::InitializeFlatSB(m_hWnd);
bRet = ::FlatSB_EnableScrollBar(m_hWnd,SB_BOTH,ESB_ENABLE_BOTH);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VSTYLE, FSB_FLAT_MODE, TRUE);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_HSTYLE, FSB_FLAT_MODE, TRUE);
// change scrollbar color
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_HBKGCOLOR, 0x008000ff, TRUE);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VBKGCOLOR, 0x0000ff80, TRUE);
this works on MFC!
|
|
|
|
|
Hi,
dancingfish wrote: Why "FlatSB" is useless in WTL?
WTL support for flat scroll bars in atlctrls.h:
#if (_WIN32_IE >= 0x0400) && !defined(_WIN32_WCE)
template <class T>
class CFlatScrollBarImpl
{
template <class TBase>
class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl<CFlatScrollBarT< TBase > >
{
typedef CFlatScrollBarT<ATL::CWindow> CFlatScrollBar;
As Comctl32.dll versions 6.00 and later do not support flat scroll bars check (WTL::RunTimeHelper::IsCommCtrl6() == false) before use
cheers,
AR
Edit: Added CommCtrl version check suggestion.
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Wednesday, November 10, 2010 5:15 AM
|
|
|
|
|
hi
I know the class CFlatScrollBarImpl, i've got a failed try, so i directly call these APIs(::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp...), but still same problem.
BOOL bRet;
bRet = ::InitializeFlatSB(m_hWnd);
bRet = ::FlatSB_EnableScrollBar(m_hWnd,SB_BOTH,ESB_ENABLE_BOTH); // bRet = 0
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VSTYLE, FSB_FLAT_MODE, TRUE);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_HSTYLE, FSB_FLAT_MODE, TRUE);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_HBKGCOLOR, 0x6fa1d9, TRUE);
bRet = ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VBKGCOLOR, 0x00ff00, TRUE);
or
private:
CFlatScrollBar* m_pScrollbarFlat;
m_pScrollbarFlat= new CFlatScrollBar(m_hWnd);
bRet = m_pScrollbarFlat->FlatSB_Initialize();
bRet = m_pScrollbarFlat->FlatSB_EnableScrollBar(SB_BOTH); // bRet = 0
bRet = m_pScrollbarFlat->FlatSB_SetScrollProp(WSB_PROP_VSTYLE, FSB_FLAT_MODE, TRUE);
bRet = m_pScrollbarFlat->FlatSB_SetScrollProp(WSB_PROP_HSTYLE, FSB_FLAT_MODE, TRUE);
bRet = m_pScrollbarFlat->FlatSB_SetScrollProp(WSB_PROP_HBKGCOLOR, 0x6fa1d9, TRUE);
bRet = m_pScrollbarFlat->FlatSB_SetScrollProp(WSB_PROP_VBKGCOLOR, 0x00ff00, TRUE);
bRet return 0 on "FlatSB_EnableScrollBar".
it works in MFC.
I don't know what's wrong with this.
|
|
|
|
|
Hi,
dancingfish wrote: I know the class CFlatScrollBarImpl, i've got a failed try
As you don't explain what you tried and what you mean by failed it is difficult to help you.
Use WTL::CFlatScrollBar this way:
class CFlatScrollBarWnd : public CWindowImpl<CFlatScrollBarWnd, CFlatScrollBar>
{
public:
DECLARE_WND_CLASS(NULL)
BEGIN_MSG_MAP(CFlatScrollBarWnd)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
END_MSG_MAP()
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& )
{
FlatSB_Initialize();
FlatSB_SetScrollProp(WSB_PROP_VSTYLE, FSB_ENCARTA_MODE);
FlatSB_ShowScrollBar(SB_BOTH);
FlatSB_SetScrollRange(SB_HORZ, 0, 2000);
FlatSB_SetScrollRange(SB_HORZ, 0, 1000);
return 0;
}
};
Remember that the Flat SB control is not supported on WinXP and later, so nothing happens there.
Good luck,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
"Remember that the Flat SB control is not supported on WinXP and later, so nothing happens there."
but the Flat Scrollbar is shown in MFC.(::InitializeFlatSB,::FlatSB_EnableScrollBar,::FlatSB_SetScrollProp... all return 1)
Maybe this is the point!("not supported on WinXP and later" just in WTL? i can't understand this.)
my OS is Windows XP.
I just try to show Flat Scrollbar, but ::FlatSB_EnableScrollBar return 0 however i do in WTL.
|
|
|
|
|
To have it working on XP remove the manifest from the executable, and indeed it is supported.
You may check it this way:
With the WTL AppWizard create a FlatScrollBar project with all default selections.
Change FlatScrollBarView.h to:
#pragma once
class CFlatScrollBarView :
public CWindowImpl<CFlatScrollBarView, CFlatScrollBar>
{
public:
DECLARE_WND_CLASS(NULL)
BEGIN_MSG_MAP(CFlatScrollBarView)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
END_MSG_MAP()
LRESULT OnCreate(UINT , WPARAM , LPARAM , BOOL& )
{
FlatSB_Initialize();
FlatSB_SetScrollProp(WSB_PROP_VSTYLE, FSB_ENCARTA_MODE);
FlatSB_SetScrollProp(WSB_PROP_CXVSCROLL, 100);
FlatSB_SetScrollProp(WSB_PROP_HBKGCOLOR, RGB(0x80, 0, 0x80));
FlatSB_ShowScrollBar(SB_BOTH);
FlatSB_SetScrollRange(SB_HORZ, 0, 2000);
FlatSB_SetScrollRange(SB_HORZ, 0, 1000);
return 0;
}
LRESULT OnDestroy(UINT , WPARAM , LPARAM , BOOL& )
{
FlatSB_Uninitialize();
return 0;
}
};
In (VS2008) Project->FlatScrollBar Properties->Manifest Tool->Input and Output Set Embed Manifest to No.
Compile and run under XP, you will get a flat SB
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Friday, November 12, 2010 5:39 AM
|
|
|
|
|
Dear CodeProject
I'm developing an OLE DB Provider using Microsoft OLE DB Provider templates.
I have some problems with this project when I want to add bookmark capability to it.
My question:
Is it necessary to include bookmark column in column rowset schema in session object?I mean when we popultae rowset with information of columns of a table,should we add a record for bookmark (specially for a self bookmark with orddinal 0)?
Thank you very much
Reza As'adi
mreza_asadii@yahoo.com
|
|
|
|
|
hello
i want to catch divide by zero and bad pointer exception how i can do it ? why these codes don't work?
#include<iostream><br />
#include<csetjmp><br />
#include<stdexcept><br />
<br />
using namespace std;<br />
int main(){<br />
int a=0;<br />
int b;<br />
try{<br />
b=12/a;<br />
}<br />
catch(...){<br />
cout<<"an exception acurred :"<<endl;<br />
b=12;<br />
}<br />
}
#include<iostream><br />
#include<stdexcept><br />
using namespace std;<br />
int main(){<br />
int *r;<br />
try{<br />
if(r[0]=23)<br />
;<br />
}<br />
catch(std::exception &e){<br />
cout<<"error"<<endl;<br />
}<br />
}<br />
modified on Sunday, November 7, 2010 2:57 PM
|
|
|
|
|
The try/catch statements are able to handle synchronous exceptions, i.e. exceptions that are explicitly thrown by the guarded code using the throw instruction.
What you are trying to catch are asynchronous exceptions that are thrown by the microprocessor under certain conditions.
What you want to do require platform specific API; on Windows systems you can do it in three different ways:
- use the
__try/__except statements (see try-except Statement (Windows)[^]) - install a vectored exception handler (see Vectored Exception Handling (Windows)[^])
- translate asynchronous exceptions to C++ (synchronous) exceptions (see /EH (Exception Handling Model) (C++)[^] and _set_se_translator (CRT)[^])
|
|
|
|
|
ok thanks a lot.do you know how to do it in linux(fedora?)
|
|
|
|
|
#include<iostream>
#include<csetjmp>
#include<stdexcept>
using namespace std;
int main(){
int a=0;
int b;
try{
if(a==0)
throw "Denominator should not be zero"
b=12/a;
}
catch (const char msg[])
{
MessageBox(msg,"Exception",MB_OK | MB_ICONEXCLAMATION);
}
catch(...){
cout<<"an exception acurred :"<<;endl;
b=12;
}
}
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I have outlook add-in developed using ATL C++. It has 2 button in outlook standard toolbar.
it will work in all versions of outlook (outlook 2000 onwards) fine. After clicking new mail (another window will appear) there buttons not appearing. please tell the way how to add a button for that window.
|
|
|
|
|
Hi,
I have an hdf (extension )file , i need to read that file and convert it into an ASCII format using C program.
The problem is small but not finding a way.
Thanks
|
|
|
|
|
You have to describe HDF file format
|
|
|
|
|
Does this page[^] help at all?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
|
Very thanks for your reply....
Only documentation is not helpful,
I need a way to read that particular file in a format it is written to convert it to text.
Thanks
|
|
|
|
|
Hi Friends,
Iam new to VC++, i have 2 dialogs with me ... every time i run it Dialog 1 is opening. I want to run Dialog 2 as a startuo dialog.. where i have to change the code... Please help me...
|
|
|
|
|
Look in your WinMain procedure where it calls the dialog, and change the reference as required.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have a CTreeViewCtrl, it has 2 item, "Item1", "Item2", when I move mouse to "Item1", show tip message "this is Item1", when I move mosue to "Item2", show tip message "this is Item2", how can I realize this with WTL, thanks a lot.
|
|
|
|
|
If your tree control has TVS_INFOTIP style it will send it's parent the TVN_GETINFOTIP [^] notification.
Handle it in the parent message map with the
NOTIFY_CODE_HANDLER(TVN_GETINFOTIP, OnGetInfoTip) macro and a matching
LRESULT OnGetInfoTip(int , LPNMHDR pnmh, BOOL& )
{
LPNMTVGETINFOTIP pgit = (LPNMTVGETINFOTIP)pnmh;
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I got it,thank you very much
|
|
|
|
|
shg104 wrote: I got it,thank you very much
Then please upvote the answer
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi,
At my workplace we have a number of programs (sub systems) which make up our software. Some of these programs need functionality from other programs and I'm trying to find a good way to perhaps modularize each program so that common code/resources can be used "globally". The current example forcing me to find a solution is the need to launch a dialog from our Accounting package from another sub system. The big problem is that this is quite a large dialog and depends a lot on things from the Accountings MainFrame.
I was thinking that for each sub system I could create a DLL which contained common dialogs, etc that could be used by other programs. The problem I face is that a lot of the dialogs have dependencies on their parent programs MainFrame and I'm not sure how to get around it. I guess one solution might be to take everything out of the MainFrame and put it into its own class which can then be passed to the DLL.. but I don't even know if that would work as I still need to Initialise this new class the same way it would be done in the parents program, but now in the other sub system.. though in saying that the DLL should probably be responsible for setting itself up.
Your thoughts?
Cheers
|
|
|
|
|
I do not know whether or not this has anything to do with "ATL / WTL / STL", as it seems purely a question of "Design & Architecture". I would suggest posting it in the latter forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|