|
I have been looking all over the web(or at least as far as google takes you) for the source of a tab view. All i need are these nice Execl like tabs. I found some source on the codeproject for something similar, but these flicker way too much to be usefully.
Does anyone have an idea, where I can get a source for a Tab-view.
Thank You,
SD
|
|
|
|
|
|
I need help with showing me how to draw a bitmap that i have in the resources, into my application upon run time. CAn someone help me out and explain in detail please. Thanks
the meek shall inherit thee earth.......but they wont get the ball
|
|
|
|
|
If you want to draw the bitmap onto a window using a DC here is how you would do it:
PAINTSTRUCT ps;
HDC hdc;
hdc = ::BeginPaint(hWnd, &ps);
HBITMAP hBitmap;
::LoadImage(::GetModuleHandle(NULL),
MAKEINTRESOURCE(IDB_RESOURCEID),
IMAGE_BITMAP,
0,
0,
LR_DEFAULTSIZE
);
if (!hBitmap)
{
}
HDC memDC;
memDC = ::CreateCompatibleDC(hdc);
HBITMAP hBmpOld;
hBmpOld = (HBITMAP)::SelectObject(memDC, hBitmap);
BITMAP bm;
::GetObject(hBitmap, sizeof(BITMAP), &bm);
if (FALSE == ::BitBlt(hdc, 0,0, bm.bmWidth, bm.bmHeight, memDC, 0,0, SRCCOPY))
{
}
::SelectObject(memDC, hBmpOld);
::DeleteDC(memDC);
::DeleteObject(hBitmap);
::EndPaint(hWnd, &ps);
If you would like to paint a bitmap outside of the paint handler, you can replace the following code:
PAINTSTRUCT ps;
hdc = ::BeginPaint(hWnd, &ps);
...
::EndPaint(hWnd, &ps);
with this:
hdc = ::GetDC(hWnd);
...
::ReleaseDC(hWnd, hdc);
If you have any other questions, feel free to ask.
|
|
|
|
|
How can i pass a variant type data to a activex control in a mfc app?
the msdn says i need use COlevariant class, but how?
thanks for help
|
|
|
|
|
ALl you need to do is create a COleVariant object using the appropraite constructor, and either Detach it (to get a VARIANT) or use the LPVARIANT operator (to get a pointer to a VARIANT). For example, if you have an Automation function like:
HRESULT SomeFunction([in] VARIANT avtLabel, [in] VARIANT *apvtTimes);
you should be able to:
COleVariant vvtLabel(_T("My STring"));
COleVariant vvtInt(1000, VT_I4);
HRESULT vhRet;
vhRet = SomeFunction(vvtLabel.Detach(), vvtInt);
<pre>
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks very much, that's would be very helpful.
|
|
|
|
|
Hi. Im starting de development of a new program and it will access files from a server protected directory, so it cant be accessed directly (except by admin). The program will be used by standart users, which, depending on their permissions, can only access some files. How can i access the directory from the program?
a) creating a user "administrator" that is actually the program (is that possible??)
b) Using a kind of FTP server that doesnt allow direct access, but allows authorized users to get the files
c) ...
|
|
|
|
|
How I can find if my application is running under debugger?
|
|
|
|
|
|
class x
{
typedef vector<string > STRINGLIST;
STRINGLIST y;
}
My question is: Is STRINGLIST seen outside the class?
I always wrote the typedefs outside, but recently I saw a few classes with typedefs like this. So, I thought it may have something to do with the scope.
And, is it advisable to do it this way? Any pros/cons?
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
If you make it public, you can say..
x::STRINGLIST z;
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
The default access specifier in a class is private, therefore you will not be able to see STRINGLIST ourside of your class.
However like Tim said, if you declare the STRINGLIST like this:
class x
{
public:
typedef vector<string > STRINGLIST;
STRINGLIST y;
};
it will be public and can be accessed by this:
X::STRINGLIST slVariable;
|
|
|
|
|
I try to compare if the user is hitting a white or another color on a CStatic when ´the user hits the CStatic control:
POINT point;
::GetCursorPos(&point);
::ScreenToClient(GetDlgItem(IDC_STATIC1)->GetSafeHwnd(),&point);
COLORREF curcolor = GetPixel(::GetWindowDC(this->GetSafeHwnd()), point.x, point.y);
COLORREF white = RGB(255,255,255);
if(curcolor != white)
AfxMessageBox("Yes");
else
AfxMessageBox("No");
}
The problem is that it always says 'Yes'... even if I click on a white color..... how to do avoid this!?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
This code should work...The only difference is that the image was bound to a static control but it should still work for an image blitted straight onto the window.
CDC * pDC = NULL;
CStatic * pStatic = NULL;
COLORREF crPixel = NULL;
CPoint pt = CPoint( 0, 0 );
pStatic = ( CStatic * ) GetDlgItem( IDS_TEST );
pDC = pStatic->GetDC( );
if( pDC == NULL )
{
ASSERT( FALSE );
return;
}
GetCursorPos( & pt );
pStatic->ScreenToClient( & pt );
crPixel = pDC->GetPixel( pt );
if( crPixel == RGB( 255, 255, 255 ) )
{
AfxMessageBox( TEXT( "white" ) );
}
else
{
AfxMessageBox( TEXT( "other" ) );
}
pDC->DeleteDC( );
|
|
|
|
|
It WORKS!!!
Weeeeee!! I love ya!! (don't missunderstand me )
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
hi there,
just need a little help. In Visual C++, there is a tool in the toolbar that enables you to insert a picture box but not the actual picture itself. It doesn't allow you to find the picture right away. Im guessing you have to use some kind of function on the OnPaint() but im not sure how to. Can somebody please help me?
|
|
|
|
|
If you mean the picture control I can help. If you want to specify the pic at run time just change the type from frame to bitmap/icon (whatever one you are using) and change the image field to the resouce ID of you pic. If you want to load it while the app is running (i.e. Change it) I have that too but I can dig it out for you this afternoon.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
I'm a little fuzzy on what to do. Can you maybe explain things a little more and go into detail better? If you want you can e-mail me at bh_bad@hotmail.com
|
|
|
|
|
I sent you an email with a jpg screen shot and hopefully clear help.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
†
|
|
|
|
|
Hey. In an apwizard MFC app there is a menu item to show and hide the default toolbar and status bar. How would i make another menu item to hide a new toolbar added by myself.
I have tried the .....
void CMainFrame::OnShowAllBar()
{
// TODO: Add your command handler code here
m_bColorVisible = !m_bColorVisible;
ShowControlBar(&m_wndAllBar,m_bColorVisible,FALSE);
}
void CMainFrame::OnUpdateShowAllBar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable();
pCmdUI->SetCheck();
}
...way of doing it but it will only hide the toolbar when i click the menu item twice.
Another way would be very much appreciated.
.NET or not .NET? MFC is the question......
|
|
|
|
|
void CMainFrame::OnShowAllBar()
{
// TODO: Add your command handler code here
m_bColorVisible = !m_bColorVisible;
ShowControlBar(&m_wndAllBar,m_bColorVisible,FALSE);
RecalcLayout();
}
void CMainFrame::OnUpdateShowAllBar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->Enable();
pCmdUI->SetCheck(m_bColorVisible ? 1 : 0);
}
|
|
|
|
|
That hasnt worked for some reason. HOwever I think i may have a way around it. How can i get the current state of a toolbar in a variable whether bool or int.
Like
m_myVar = ...state of bar....;
.NET or not .NET? MFC is the question......
|
|
|
|
|
BOOL bVisible = ((m_wndMyBar.GetStyle() & WS_VISIBLE) != 0);
|
|
|
|
|
Why doesn't BN_CLICKED work when I try to handle a click event on a CStatic control that shows a bitmap??
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|