|
Hi all
In CTree control according to MSDN i try to insert image of Recycle bin.But how can i get Int Imge number of Recycle bin?
m_tree..InsertItem("Recycle bin",int Image,hRoot);
I try to find int Image number.
Help me
|
|
|
|
|
One way, albeit antiquated, would be to look in your C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Win95 folder.
A better solution would probably be to use SHGetFolderLocation(CSIDL_BITBUCKET) and SHGetFileInfo(SHGFI_PIDL | SHGFI_ICON) .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
The int is an index into the associated CImageList[^]. That in turn has to be created by you, and you can add resource items or load items from other sources at runtime. There are no predefined images for the CTreeCtrl .
|
|
|
|
|
If you're looking to get the icon that belongs to the recycle bin you can use SHGetStockIconInfo API.
This will work only on Windows Vista and above.
To support earlier OS versions you must use the SHGetFolderLocation and SHGetFileInfo APIs.
|
|
|
|
|
CreateFile function is fail to create a file on windows 7 (login user has administrative right)
Createfile also fail to open any drive
any solution for that
|
|
|
|
|
MKC002 wrote: any solution for that
Check GetLastError() .
Also, turn UAC off and see what that does.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
If you're creating the file in any of the locations not recommended like C:\ , C:\Windows etc. your program will need to run with elevated privileges. Try executing the program elevated by right clicking and selecting Run as administrator .
|
|
|
|
|
i run my program as administrator (right click on exe and select run as administrator).but still it fails to creat file
how to programatically run my program as administrator?
i think there is UAC problem but i dont know how to solve it
|
|
|
|
|
We are upgrading to VS2010 (C++) and on XP machines it is dog slow. Sometimes the IDE will hang the PC for 30 seconds or more. Right click a mouse button, and 30 seconds later the popup menu appears. And this is not while compiling. VS 2010 seems fine on Windows 7. Does anyone have any ideas what the problem is? I assume it is something like intellisense getting its knickers in a twist, or some other background task. Oddly enough the Task Manager shows near zero CPU usage during these hangs. We do have plenty of RAM so virtual memory paging is not thrashing.
|
|
|
|
|
You might also want to ask here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
Create mfc dialog base application and put an activex control on dialog (calender control or web browser control). Initialize activex control with some data
execute the application. activex control on Dialog box displays the data.
right click on activex control-> context menu appears
how to avoid this context menu and any other mouse/keyboard operations on activex control
|
|
|
|
|
check whether activex control exposes any functions to suppress menus.
If not, override PreTranslateMessage() function for your parent window, and simply do return for the messages that generates menus on ativex control
for eg, for Mouse right button click/double click:
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_RBUTTONDOWN || pMsg->message == WM_RBUTTONDBLCLK)
return TRUE;
return CDialog::PreTranslateMessage(pMsg);
}
you may do further filtering by checking pMsg->pt or pMsg->hwnd members also.
|
|
|
|
|
it's not working for windows media player activex control
|
|
|
|
|
"check whether activex control exposes any functions to suppress menus"
on windows media player activex, set enableContextMenu property to False.
or call put_enableContextMenu(FALSE)
|
|
|
|
|
hello guys...lets suppose we have 3 buffers, how can we allocate and lock memory for these three buffers?? thanx for ur thoughts
|
|
|
|
|
|
have a look at the VirtualAlloc, VirtualLock API ...
M.
Watched code never compiles.
|
|
|
|
|
You ought to explain what you mean by "lock." Depending on who you are it might mean "allow only one thread to access the memory", "disable paging for the memory", "don't allow memory to move in the virtual address space" or one of several others.
Cheers,
Ash
|
|
|
|
|
You can use the GlobalAlloc and GlobalLock APIs.
Or you can use HeapAlloc which is what is internally called by the new operator .
|
|
|
|
|
Hi all, I am using Visual Studio 2005 with MFC application. I have create a transparent window with following codes:
HINSTANCE hInst = ::GetModuleHandle(NULL);
WNDCLASSEX wc;
wc.cbSize=sizeof(WNDCLASSEX);
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject( NULL_BRUSH );
wc.hCursor = LoadCursor( NULL, IDC_CROSS );
wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wc.hInstance = hInst;
wc.lpfnWndProc = (WNDPROC) CCaptureDlg::WndProc;
wc.lpszClassName = L"Test";
wc.lpszMenuName = 0;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.hIconSm = NULL;
m_hWnd=::CreateWindowEx(WS_EX_TRANSPARENT|WS_EX_TOPMOST,L"Test",0, WS_VISIBLE|WS_POPUP,0,0, m_ComputerResolutionX, m_ComputerResolutionY,0,0,0,this);
In that Window "Test", I can drag and draw a rectangle but when I keep dragging and moving the mouse around the screen, it does not clear off my previous drawing, is there a way to clear off my previous drawing? I have tried FillRect as following but still does not work:
case WM_MOUSEMOVE:
{
if (pClass->m_MouseDown==1)
{
HDC hdc;
hdc = ::GetWindowDC(hwnd);
RECT re;
SetRect(&re, 0,0,pClass->m_ComputerResolutionX,pClass->m_ComputerResolutionY);
HBRUSH brush =(HBRUSH)::GetStockObject(NULL_BRUSH);
if (pClass->m_tempPoint.x!=p.x && pClass->m_tempPoint.y!=p.y)
{
static int count = 0;
TRACE(L"Test %d\n", count++);
FillRect(hdc,&re,brush);
pClass->m_tempPoint=p;
}
CPen mypen(PS_DOT, 1, RGB(0,0,0));
HPEN pen = (HPEN)mypen;
SelectObject(hdc, pen);
SelectObject(hdc, brush);
::Rectangle( hdc, pClass->m_InitPoint.x, pClass->m_InitPoint.y, p.x , p.y);
}
break;
}
Or is there another way to remove my previous drawing on this transparent window other than FillRect? I would be pleased to learn about it. TQ~
Teaching and learning is a cycle...
Learning something new enable to teach others;
Teaching others enable self learning.
|
|
|
|
|
You should not be drawing to your window in the message handler for the mousemove. The mouse move code should set the limits and other details of your shape, but the actual drawing should be done in your OnDraw() or OnPaint() handler. There are lots of samples on MSDN[^].
It's time for a new signature.
|
|
|
|
|
what if i use bitblt to draw the rectangle?
However, there is a problem i faced, after i've bitblt, the background turns to be black color. I just don't why?
"BitBlt(Hdc, 0, 0, pClass->m_ComputerResolutionX, pClass->m_ComputerResolutionY, pClass->m_MemDC, 0, 0, SRCCOPY);"
The bitblt was done in WM_PAINT.
Anyone has any ideas?
|
|
|
|
|
I'm not sure why this question was posted to me.
It's time for a new signature.
|
|
|
|
|
Additional to the words of Richard
this "dotted rectangle"[^] could be used...
virtual void BeHappy() = 0;
|
|
|
|