|
actually i didn't try it but sscanf was just fine
Thanks for ur valuable time ur all great
thanks
emma
|
|
|
|
|
you can do:
k = strtol(s, &pStop, 16);
where pStop is a char pointer (see strtol documentation).
of course you'll get k=0x1E .
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.
|
|
|
|
|
u know sscanf worked for me but sure i'll try all the solutions to have them all
Thanks for ur valuable time ur all great
thanks
emma
|
|
|
|
|
First of all, I'm still using MFC4.2 with VC6. But the problems I ran into are probably the same since Win3.x .
I have a CDialog, made with the dialog editor. Beside other controls I have a tab control in this dialog, which is attached to a CTabCtrl Object.
Now I want to mask out a part of this tab control. Easy, isn't it?
So I created dynamically a CStatic object, "Static1", with the background color corresponding to the dialog background color and sized and positioned the window to cover the area that I want to mask out. This static is a child of the TabControl.
So far so good.
But as soon as the tab control is repaintd my static control disappeared behind the tab control.
I made a second static control, "Static2", this time with the resource editor. This static is not a child of the TabControl.
Same behaviour.
I tried to adjust the z-order of "Static1". No effect.
I even called SetWindowPos with the wndTopMost pointer after each button down-, selection change- and WM_PAINT notifictaion, just for the case that the z-order is changed somehow somewhere. No success.
The behaviour is:
Upon startup or completely repaint of the dialog I see "Static1" and "Static2" ("Static2" is above "Static1").
After changing the Tabs (or hovering) I see the tab control. (Static 1 & 2 are behind the tab control).
If the statics are just covered by a window and drawn again afterwards, the result is indetermined, mostly all three controls are only drawn partitially in the overlapping area.
What can I do to nail my static on top of the tab control and that it gets repainted AFTER every repaint of the tab control?
Regards
Leo
|
|
|
|
|
Here an alternative solution, how about in the OnPaint() handler of your CTabCtrl derived class you draw the background part that you are interested in? This would theoretically make the extra CStatic obsolete by drawing all within one object.
void CTabCtrlSpecial::OnPaint()
{
CTabCtrl::OnPaint();
dc.FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
}
Just a an idea, would that work?
|
|
|
|
|
Thx.
I will try it out. Even if don't think that it will work since the class only encapsulates the api and propably does not implement any drawing itself. But it's worth a try and I have no better idea myself.
I want to undestand why it behaves the way it does.
Unfortunately I do not even know what I should look for.
And it must somehow be possible. I'm for sure not the first one who has the problem .
So maybe some guru has additional ideas.
Regards
Leo
|
|
|
|
|
Functionality-wise (not implementation-wise) what are you trying to do? I am unsure that I understand the reason for your task, perhaps there are other ways to achieve the functionality you need.
|
|
|
|
|
I want to hide a part of a tab control: The left and right arrows that are displayed when more tabs exist than can be displayed at once.
I'm trying to do this by painting backgrond color over the area I want to hide.
Actually I was not really painting, but I set a static control (without text) over the position I wanted not to be seen.
|
|
|
|
|
I see, I would go for an ownerdraw tab control without those spin buttons... examples see [1] and [2] (you must disable the drawing/handling of the buttons yourself).
Hope it helps
|
|
|
|
|
I was off with the family this weekend, so my reply is a little bit later than usual.
-> I just made a quick try of your suggestion and it did not work.
Interestingly as soon as I make a command handler for WM_PAINT, the control is not painted at all.
No mather if the OnPaint function body is empty or I call the base classes OnPaint (class wizard makes comment: don't call bas class), the control is not painted.
By the way, it seems, that CTabControl has no OnPaint function so that CWnd::OnPaint is called which more or less forwards the last command (WM_PAINT) to the window (control). That's what I ment with encapsulating API: sending a message to a control instead of doing any painting inside the class.
I have not thought about owner drawn tabs yet, because my documentation said that owner drawn tabs have fixed size. But I plan to change to VC2003 next week (to avoid to bother with problems or bugs that are solved allready in newer MFC versions. And for flat button support ). Also I might have time to go through the articles about owner drawn tab controls.
I did not try emediately to derive from CTabControl because I want to avoid to make da deviation of each class I use. Otherwise things get very hard to overview quiet quickly.
But ofcourse it's easier to spend 1min every time I open the project to get an overview than wasting hours for programming .
But I still want to understand what's happening and found out, that I have some fundamental wholes in my windows knowledge. It was no joke when I mentioned that the cause of the problem exists since Win 3.xx.
Regards
Leo
|
|
|
|
|
Chilli71 wrote: Interestingly as soon as I make a command handler for WM_PAINT, the control is not painted at all.
Have you tried:
class CTabCtrlLeo : public CTabCtrl { };
void CTabCtrlLeo::OnPaint()
{
Default();
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
}
|
|
|
|
|
It doesn't work yet, but I will get it work.
Thx!
The call to the base class CTabCtrl::OnPaint calls the base class function CWnd::OnPaint, which calls Default() and forwards the last message to the control.
So: yes, I tried to call Default() without success.
But due to your lates reply I double checked my try and found out, that the first line of my OnPaint was
CPaintDC dc(this);
and the second line
CTabCtrl::OnPaint();
So I just exchanged the order and, surprise, the tab control is painted again.
Finding out why I see no rectangle (following your proposal) should be a matter of a couple of minutes.
Maybe I can drop you a final success notice this week (rather at the weekend becaus I will be on a bussiness trip this week).
many thanks for your patience
Leo
|
|
|
|
|
So finially I've found a solution for the problem, even though I do still don't know the answer to my original question.
extern "C" UINT WINAPI RealGetWindowClassA (HWND, char*, UINT);
void CTestTabCtrl::OnPaint()
{CWnd* UpDownButton;
char Test[256];
UpDownButton = GetTopWindow();
RealGetWindowClassA (UpDownButton->m_hWnd, Test, sizeof(Test)-1);
ASSERT(!strcmp(Test, "msctls_updown32"));
if (UpDownButton)
{
UpDownButton->EnableWindow(FALSE);
UpDownButton->ShowWindow(SW_HIDE);
}
CTabCtrl::OnPaint();
}
So instead of overpainting the buttons I never display them.
Take care: UpDownButton is really a temporary window: It is dynamically created, when the number of tabs exceeds the number of displayable tabs. So if tabs are dynamically added and removed, retriving of the UpDownButton window pointer can not be done only once at initialization.
Regards
Leo
Edit: Typo in topic
|
|
|
|
|
Hi All.
With Crystal report 10 I go to generate the report file and through the DLL to runtime I go to modify the logon parameters....
With this code I go to set up the parameters of logon of the report...but there is a problem
when I set password ConnectionProperty has not been set..only password connection property....
void CDlgRptConnectionProperty::OnBnClickedOk()
{
_bstr_t bstParameterName,
bstParameterValue;
_variant_t vtValue;
IConnectionPropertyPtr pConnectionProperty = NULL;
IDatabaseTablesPtr pDatabaseTables = NULL;
INameValuePairsPtr pNameValuePairs = NULL;
IDatabasePtr pDatabase = NULL;
_bstr_t bstConnection;
HRESULT hr;
try {
pDatabaseTables = m_pReport->GetDatabase()->GetTables();
IDatabaseTablePtr pDatabaseTable = pDatabaseTables->GetItem(1);
pNameValuePairs = pDatabaseTable->GetConnectionProperties();
if( (m_typeRptConnection == ModifyConnectionADO) || (m_typeRptConnection == ModifyConnectionDAO) ) {
for( int nIndexParam = 0; nIndexParam < m_lstParameterConnection.GetItemCount(); nIndexParam++ ) {
bstParameterName = m_lstParameterConnection.GetItemText(nIndexParam,COL_0);
CString sParameterName(bstParameterName.GetBSTR());
if( sParameterName.Compare(ADO_PARAMETER_5) != 0 ) {
bstParameterValue = m_lstParameterConnection.GetItemText(nIndexParam,COL_1);
}else {
bstParameterValue = GetUserPassword(nIndexParam,COL_1);
}
IConnectionPropertyPtr pConnectionProperty = pNameValuePairs->GetItem(bstParameterName);
pConnectionProperty->PutValue(bstParameterValue);
}
}else if( (m_typeRptConnection == ReplaceConnectionADO) || (m_typeRptConnection == ReplaceConnectionDAO) ) {
pNameValuePairs->DeleteAll();
_bstr_t bstDllName;
if( m_typeRptConnection == ReplaceConnectionADO )
bstDllName = DLL_ADO;
else if( m_typeRptConnection == ReplaceConnectionDAO )
bstDllName = DLL_DAO;
m_pReport->GetDatabase()->GetTables()->GetItem(1)->DllName = bstDllName;
for( int nIndexParam = 0; nIndexParam < m_lstParameterConnection.GetItemCount(); nIndexParam++ ) {
bstParameterName = m_lstParameterConnection.GetItemText(nIndexParam,COL_0);
CString sParameterName(bstParameterName.GetBSTR());
if( sParameterName.Compare(ADO_PARAMETER_5) != 0) {
bstParameterValue = m_lstParameterConnection.GetItemText(nIndexParam,COL_1);
}else {
bstParameterValue = GetUserPassword(nIndexParam,COL_1);
}
pNameValuePairs->Add(bstParameterName.GetBSTR(),bstParameterValue.GetBSTR());
}
pDatabaseTables = m_pReport->GetDatabase()->GetTables();
long lTablesCount = pDatabaseTables->GetCount();
for( long lItem = 1; lItem <= lTablesCount; lItem++ ) {
IDatabaseTablePtr pDatabaseTable = pDatabaseTables->GetItem(lItem);
_bstr_t bstTableName = pDatabaseTable->GetName();
pDatabaseTable->PutLocation(bstTableName);
}
}
hr = m_pReport->Save(m_bstReportPathFileName);
}catch(_com_error e) {
theApp.DisplayComError(e,TRUE);
return;
}
OnOK();
}
Any idea...
Too many plans make the health badly!!
|
|
|
|
|
Hi
This is my first post to code project.When we copy some thing from word and click on Edit menu and select office clipboard, we will able to see content which we have copied in latest.If i open excel and go to Edit->Office Clipboard same data is available .And i am able to paste the data by selecting that data on office clipboard.
Actually this is vulnerability as my data is shared from word to excel when i want it only to available in word files only.What i want is to either clean office clipboard through some api or to disable sub menu item Edit->Office Clipboard so that no one is able to open offcie clipboard.
Let me tell you i have tried EmptyClipboard() which cleans windows clipboard but not office clipboard.I also tried OleSetClipboard(NULL) which is no way effective.
Please suggest some way to handle this office clipboard data.
Thanks in advance.
|
|
|
|
|
Pankaj Bohra wrote: ...so that no one is able to open offcie clipboard.
Are you on a shared PC?
Pankaj Bohra wrote: Please suggest some way to handle this office clipboard data.
According to Microsoft, there is no way to programmatically manipulate it.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No i am not on shared PC.
|
|
|
|
|
Then why are you worried about someone else accessing your clipboard data?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David, actually i am working on encryption and securtiy of data.And word is secured document for my scenario and excel is unsafe document.That's why i want to clear office clipboard or want to control over it.
|
|
|
|
|
Hi,
I am using Web Browser Control (IWebBrowser2) in C++ and renders a html page in it. In my html page I have a tree view control. I want a pointer to this tree view control (embedded in html page) in my C++ code. How would I get the pointer to this tree view control.
Any help would be appreciated.
Regards,
Paresh.
|
|
|
|
|
I want to built a DLL in which we can pass parameters to call a jar file and the return values of the Jar file should be available to the calling application.
Do anyone know How to perform this ?
Thanks in advance.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: ...pass parameters to call a jar file...
What do you mean by "call a jar file?"
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: What do you mean by "call a jar file?
I meant to say that I want to unpack(Execute) a jar file from visual C++ app. and then get the result in the visual c++ for furthur processing. Suppose I am using jar file to generate an auth. number by passing a variable to the jar file, and want the auth number back in the visual c++ app. so that I can process it according to my requirement.
Thanks for your answer.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: I meant to say that I want to unpack(Execute) a jar file from visual C++ app. and then get the result in the visual c++ for furthur processing.
Use CreateProcess() for this.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi everyone! good day!
i just wanted to ask whats the difference between declaring a variable like this
TEST* pTest;
with
LPTEST pTest; // see code below
typedef struct
{
...
} TEST, *LPTEST;
thanks!
newbie
|
|
|
|