|
How to get last access time of some directory?
On files, I use GetFileTime() function and it is
working property, but on folder, it returns null.
Thanks in advanvce.
|
|
|
|
|
MirkoMax wrote:
...but on folder, it returns null.
And what does GetLastError() return?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am a beginner in the windows programming world, and am having a bit of trouble figuring out how to determine the state of my checkbox when it's ownerdraw.
If I use BM_GETCHECK it always returns 0, even if I send BM_SETCHECK a line above passing BST_CHECKED. I also tried ORing BS_CHECKBOX and/or BS_AUTOCHECKBOX with BS_OWNERDRAW but BM_GETCHECK still returned 0.
I then attempted to use BM_SETIMAGE as general storage (a pointer) but BM_GETIMAGE always returns 0 as well.
Is it due to the fact my checkboxes are ownerdraw, or is there some other problem I'm unaware of?
thanks
|
|
|
|
|
May we see a code snippet?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hTempWnd = CreateWindowEx (
0,
"Button",
"Compression",
WS_VISIBLE | WS_CHILD | BS_OWNERDRAW,
clientRect.right - MM_DBUTTON_WIDTH - MMPADDING_RIGHT,
clientRect.top + MMPADDING_TOP + MM_GROUPPADDING_BOTTOM,
MM_DBUTTON_WIDTH, MM_DBUTTON_HEIGHT,
hWnd,
(HMENU) MMENU_BUTTON_COMPRESSION,
GetModuleHandle ( NULL ),
NULL
) ;
LPDRAWITEMSTRUCT lpdis from lParam in WM_DRAWITEM
long lResult = 0;
lResult = SendMessage ( lpdis->hwndItem, BM_GETCHECK, (WPARAM) 0, (LPARAM) 0 ) ;
if ( lResult == BST_CHECKED ) ...
When I was trying BM_GETIMAGE I used the same procedure as the second code snippet
edit: It seems that BM_GETCHECK and BM_SETCHECK just don't work with ownerdraw, so that solves that issue, but I'm still unsure why BM_SETIMAGE doesn't work.
|
|
|
|
|
What happens if you create a checkbox like:
CreateWindowEx(..., WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX, ...); In other words, does the owner-draw style have any affect? I wouldn't think so but I'm just trying to pare the problem down.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have tried using BS_AUTOCHECKBOX with BS_OWNERDRAW (I do draw them myself so I need that) but it doesn't seem to have an effect, and BM_GETCHECK still always returns 0.
|
|
|
|
|
c. s. wrote:
I have tried using BS_AUTOCHECKBOX with BS_OWNERDRAW (I do draw them myself so I need that) but it doesn't seem to have an effect...
Right, but does the problem persist for non owner-drawn checkboxes?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
c. s. wrote:
hTempWnd = CreateWindowEx (
0, // no extended style
"Button",
"Compression", // toggles chunk compression
WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, // make a visible child window, that we draw ourself (see void DrawCheckbox)
clientRect.right - MM_DBUTTON_WIDTH - MMPADDING_RIGHT, // create it near the top right corner
clientRect.top + MMPADDING_TOP + MM_GROUPPADDING_BOTTOM,
MM_DBUTTON_WIDTH, MM_DBUTTON_HEIGHT, // use our standard checkbox button height and width
hWnd, // our parent window is this popup menu
(HMENU) MMENU_BUTTON_COMPRESSION,
GetModuleHandle ( NULL ),
NULL // pass no extra parms on creation
) ;
According to this[^], an owner-drawn button "has no predefined appearance or usage. Its purpose is to provide a button whose appearance and behavior are defined by the application alone."
Furthermore, your call to Create isn't even specifying one of the possible check box styles (BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, BS_AUTO3STATE), so it's no wonder the control doesn't react to BM_SETCHECK messages. Try adding BS_CHECKBOX, and if that doesn't work (which may be due because of the owner draw style), I suggest subclassing the control so that you can handle the BM_GETCHECK and BM_SETCHECK messages yourself.
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
Furthermore, your call to Create isn't even specifying one of the possible check box styles (BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, BS_AUTO3STATE), so it's no wonder the control doesn't react to BM_SETCHECK messages.
Did you miss this:
"I also tried ORing BS_CHECKBOX and/or BS_AUTOCHECKBOX with BS_OWNERDRAW but BM_GETCHECK still returned 0."
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
Did you miss this:
"I also tried ORing BS_CHECKBOX and/or BS_AUTOCHECKBOX with BS_OWNERDRAW but BM_GETCHECK still returned 0."
Yes, I missed it. Sorry.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I was hoping to avoid using my own storage, but it seems not too feasible.
I will subclass it and see how it turns out, thanks all.
|
|
|
|
|
c. s. wrote:
I was hoping to avoid using my own storage, but it seems not too feasible.
I will subclass it and see how it turns out, thanks all.
Well, subclassing it would have an additional benefit, since it would allow you to handle the drawing in the control, rather than doing so in the parent. That's in my opinion a better alternative because it's easier to reuse the control with different parents.
Good luck
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Greetings:
I have a simple ListCtrl box in Report mode. I want the parent window (a dialog) to be notified when any vertical scroll operations are requested.
I can't see anyway to do this. Is it a WM_NOTIFY? If so, which code ID is used?
Thank you,
Mark
|
|
|
|
|
|
Hi JLR, thanks for your response...
My application must support Windows down to Win 95. Is there anything I can do?
Mark
|
|
|
|
|
Jethro63 wrote:
My application must support Windows down to Win 95. Is there anything I can do?
What's your need exactly? I mean, you said you need a parent window to receive notifications about scrolling in a listview, but what do you need this for? Perhaps there's another way to do what you actually need.
For example, would subclassing the control with a class derived from CListCtrl help? Doing that would allow you to handle any windows message...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi Jose:
My problem is that I must provide a list control in report mode that displays records with about five sub-items per row. This view must potentially display a LARGE number of records, sometimes over 200,000. Normally, if the record count was lower, I would just insert all the rows I need and fill out all of the records then the user is free to scroll away. But when the number of records is large, it takes WAY too long to initialize all of those records.
I found that if I simply create the number of rows that I need without filling out any of the record data in the columns, then the amount of time it takes is tolerable (like 30 seconds with a friendly progress bar to amuse the user in the mean time).
My next move, if I can figure out how to do this, is to simply fill out only the records that are currently visible in the view window. Each time the user scrolls by whatever means, I would fill out any rows that become exposed but have not been filled out. This all hinges on me being notified when the user has caused the list control to scroll and to then find out which rows are now visible.
That's my plan. Feel free to rip it apart.
Thanks,
Mark
|
|
|
|
|
Jethro63 wrote:
My problem is that I must provide a list control in report mode that displays records with about five sub-items per row. This view must potentially display a LARGE number of records, sometimes over 200,000.
I figured it was something like that, hence the question
This article seems to be what you need:
Using virtual lists[^]
I haven't tried it, but it's the approach I'd suggest in your case (letting the list ask you for the info as it needs it).
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hi Jose:
Thanks, I'll have a look.
Mark
|
|
|
|
|
I have a menu on my dialog app. I want to be able to turn on and off debugging (which is a submenu on my main menu). My menu is setup like this:
File
->Timeouts
->Debug
However when I try and check it I get an assertion error. Can anyone give me some help on this? Here is my code on the event OnSettingsDebug()
<br />
CMenu menu;<br />
CMenu *MainMenu = NULL;<br />
<br />
VERIFY(menu.LoadMenu(IDR_SETTINGSMENU));<br />
MainMenu = menu.GetSubMenu(1);<br />
UINT mState = MainMenu->GetMenuState(ID_SETTINGS_DEBUG, MF_BYCOMMAND);<br />
ASSERT(mState != 0xFFFFFFFF);<br />
if (mState & MF_CHECKED)<br />
{<br />
MessageBox("Checked");<br />
MainMenu->CheckMenuItem(ID_SETTINGS_DEBUG, MF_BYPOSITION |MF_CHECKED);<br />
}<br />
else<br />
{<br />
MessageBox("Unchecked");<br />
MainMenu->CheckMenuItem(ID_SETTINGS_DEBUG, MF_BYPOSITION |MF_UNCHECKED);<br />
}<br />
When stepping thru it, I see that I am not getting back the mState correctly. Is there a different way I should be doing this?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
|
nope....looks like I was missing a pointer to me main menu. Once I got that it worked out. Thanks anyways
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi all,
I am writing an application to download files from FTP server, but when the connection fails (from the FTP server side)during downloading a file the application stops working.
i used CFTPConnection::GetFile() but it didn't work, also i tried to use CInternetFile::Read() but the function also stop responding when the connection fails during the files download.
can anyone help me , thanx.
|
|
|
|
|
I would like to pass a variable in a edit box from a child dialog box to an other edit box whitch is in a parent dialog box.
My probleme is that the 2 class (child and parent) don't know there variable each other.
How can I do to get a variable from a class to an other class ?
Thank in advance for the answer
|
|
|
|