|
How would I detec if left mouse button is down in OnMouseMove while other key is down also?
nFlags == MK_LEFT works except if I press right button down also it wouldn't work anymore
I need to create a flag in OnLButtonDown?
|
|
|
|
|
Anonymous wrote:
I need to create a flag in OnLButtonDown?
yes. that's how i always handle it. set a flag when the button is pressed, and flip it when the button is released.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
|
well here is an another suggestion.....(but a longer one)
create a bool variable say "m_clickon"(and initialize it with the value=FALSE) and make it true when ever ur leftbotton os down by using the OnLButtonDown....
make sure u handle thiz variable when the OnlButtonup as well (to set it back to FALSE).....
so whenever u move ur mouse..
the movemove handle is called.....then just check the status of this variable to say wheter the leftbutton is clicked or not...
happy programmin.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
Hi, i wish to use the CxImage libary in my project i am working on. Sadly due to me being a complete muppet and not knowing hardly any visual c++ or knowing how the compiler works properly, i can seem to get the libary to work.
Anyone know a decsent tut on how to use libaries as this would help me a lot.
Thanks a lot
|
|
|
|
|
Hi,
how do I find out how much free store (memory when you call new/delete) is available to my program? If that's not possible how can I tell how much RAM is installed on the machine?
Thanks.
|
|
|
|
|
One way would be to walk the application's heap using the Heap32First() /Heap32Next() pair. You could also use PdhOpenQuery() , PdhMakeCounterPath() and related functions to look at the Memory object. There's also the Win32_PhysicalMemory class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Wow. I thought there was some simple win32 function that I can just call to get the physical memory size.
The first set of functions looks like it returns the current free-store usage? I wanted to get the limit of the free store. The second set of functions I don't even understand. Finally Win32_PhysicalMemory looks insane. You need to use COM to query some Windows Management Instrumentation (which I don't think I have because none of the MSDN sample code works - missing headers).
I did some more searching and found GlobalMemoryStatus(). This one looked very easy to use and it works on my Win2k machine so far. As long as the computer doesn't have 4G+ of memory I should be covered for now. GlobalMemoryStatusEx() would be ideal but my compiler can't find it.
Thanks for your help.
|
|
|
|
|
Budric B. wrote:
GlobalMemoryStatusEx() would be ideal but my compiler can't find it.
Do you have latest Platform SDK? Also, this is only available under W2K and XP.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Budric B. wrote:
I thought there was some simple win32 function that I can just call to get the physical memory size.
GlobalMemoryStatus() returns that in MEMORYSTATUS::dwTotalPhys , however that doesn't tell you how much memory you can allocate. Virtual memory != physical memory. The amount depends on how much RAM you have, how much swap space is available, and what your process's current VM usage is like. Eg, if you try to allocate 1G of memory, your 2GB process space probably won't have 1G of continuous address space available, so the alloc won't work regardless of how much RAM you have.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Yes, I figured that was the case. Originally I asked if it was possible to find out how much memory I can allocate. Using the RAM size was something to fall back on. I'll use it to make crude estimations.
|
|
|
|
|
When I create a MSDE database within my application, I call OpenProcess() to open up a Access project file. This project file then starts up form that calls a subroutine. This subroutine needs the variable from my Visual C++ application in order to connect to the newly created database and display the tables. How do I go about doing this? Thanks!
|
|
|
|
|
How to crate new frame that independent with it parante.
|
|
|
|
|
Make your frame class and derive it from CFrameWnd. Create an object using your constructor. Then call CFrameWnd::Create(..) function on your object. Here's an example: CFrameWnd::Create(NULL, "", WS_POPUP, location,NULL,0,NULL);
I pass NULL as the argument for parent. Look up on MSDN what the other parameters are.
|
|
|
|
|
|
Form your method how i can call this frame.
|
|
|
|
|
Hi,
I'm trying to create a memory manager. And I'm doing that in such a way that using the new or malloc functions is out of the question.
The memory manager is allocating memory in the pagefile. First the manager allocates chunks of memory and then split that up into objects.
The problem I have is that I need to initialize the allocations with the custructor for the object requesting the memory.
Now how do I "call" or invoke the constructor for the object, without using new or malloc(or etc...)?
Any help or opinion would be appreciated...
Thanks,
|
|
|
|
|
A form of new called placement new [^] is exactly meant for what you need.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thanks! That really works! Amazing!
|
|
|
|
|
Estoy intentando usar el GUI de microsoft para seleccionar directorios, de momento he usado el CFileDlg pero no me deja seleccionar un directorio , he probado varias opciones pero no me ayudan ¿alguna sugerencia?
Gracias
I want to use the GUI of microsoft to select directories, i try it with the CFileDlg class but it don´t let mi select one directorie ¿Can somebody help me?
Thanks
|
|
|
|
|
This link will help you out
http://www.codeproject.com/shell/cxsbrowsefolder.asp
"I Think this Will Help"
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
|
I want to set specific font for my tree, so I use CUSTOMDRAW event. I've write two functions that must set my own font, but they do not work
Please, help me. What is incorrect in my functions?
<br />
<br />
void CMyTree::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
LPNMTVCUSTOMDRAW pNMTVCD = (LPNMTVCUSTOMDRAW) pNMHDR;<br />
HWND hWndTreeView = pNMHDR->hwndFrom;<br />
if (pNMHDR->code == NM_CUSTOMDRAW)<br />
*pResult = handleCustomDraw(hWndTreeView, pNMTVCD);<br />
<br />
*pResult = handleCustomDraw(hWndTreeView, pNMTVCD);<br />
}<br />
<br />
<br />
long CMyTree::handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)<br />
{<br />
if (pNMTVCD==NULL)<br />
{<br />
return -1;<br />
}<br />
switch (pNMTVCD->nmcd.dwDrawStage)<br />
{ <br />
case CDDS_PREPAINT:<br />
{<br />
return (CDRF_NOTIFYPOSTPAINT | CDRF_NOTIFYITEMDRAW);<br />
}<br />
case CDDS_ITEMPREPAINT:<br />
{<br />
LOGFONT lf;<br />
lf.lfHeight = 20;<br />
lstrcpy(lf.lfFaceName, "Time New Roman");<br />
lf.lfWeight = FW_HEAVY;<br />
lf.lfItalic = TRUE;<br />
HFONT gh = CreateFontIndirect(&lf);;<br />
SelectObject(pNMTVCD->nmcd.hdc, &gh);<br />
return (CDRF_NOTIFYPOSTPAINT | CDRF_NEWFONT);<br />
}<br />
case CDDS_ITEMPOSTPAINT:<br />
{<br />
LOGFONT lf;<br />
lf.lfHeight = 20;<br />
lf.lfItalic = TRUE;<br />
lstrcpy(lf.lfFaceName, "Time New Roman");<br />
lf.lfWeight = FW_HEAVY;<br />
HFONT gh = CreateFontIndirect(&lf);;<br />
SelectObject(pNMTVCD->nmcd.hdc, &gh);<br />
return CDRF_DODEFAULT;<br />
} }<br />
<br />
}<br />
return 0;<br />
}<br />
<br />
Thank to everybody very much in advance..
|
|
|
|
|
What do you mean they "do not work"? Why are you creating a new font every single time? Have you checked your return values? (specifically that of CreateFontIndirect() )
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
You are right. I simply tried to create font every time. I'll do it another way, now I only want it to work.
|
|
|
|