«_Superman_» wrote:
In that case, the string is a unicode string.
Um, if you don't mind me asking, how do you *know*. I was just guessing on how it (the PIDL) works internally.
«_Superman_» wrote:
In that case, the string is a unicode string.
Um, if you don't mind me asking, how do you *know*. I was just guessing on how it (the PIDL) works internally.
«_Superman_» wrote:
uOffset is declared as UINT (unsigned int). So it is not a string.
uOffset is an offset to a string. I was wondering whether the string it's "pointing" to was ANSI or Unicode.
«_Superman_» wrote:
ANSI or UNICODE is not dependent on the OS. It depends on whether the macro UNICODE or _UNICODE is declared or not. For example, LPTSTR (TCHAR*) becomes LPSTR (CHAR*) if UNICODE is not declared and LPWSTR (WCHAR*) if UNICODE is declared.
I know about the TCHAR stuff. The reason I mentioned the OS was because I was thinking since Win9x used ANSI internally (mostly, I think) and WinNT used Unicode (but supported programs compiled for ANSI for compatibilty), the string inside the PIDL where uOffset is "pointing" would be that type.
When uType is STRRET_OFFSET, MSDN doesn't say whether the string uOffset is pointing to is an ANSI or Unicode string. Is it always ANSI or always Unicode? Is it ANSI on Win9x systems and Unicode on WinNT systems? Thanks.
MSDN says the requirements for timeKillEvent are
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
but the requirements for timeSetEvent are
Windows XP: Included in Windows XP only.
Really? Since timeKillEvent uses the return value of timeSetEvent, this doesn't seem to make sense.
Will calling CreateFont(-8, 0, 0, 0, 0, FALSE, FALSE, FALSE, 0, 0, 0, 0, 0, TEXT("small fonts")) always create the exact size font on all systems (assuming the "small fonts" font is present)? For example, would the zero character always be exactly 4 pixels wide and 6 pixels high?
I subclassed a listview to try and get the HDN_TRACK notification from the header control, but the only notifications that seem to come are NM_RELEASEDCAPTURE and NM_CUSTOMDRAW. Is there any way to get the others?
I hope this is the right forum... I'm confused about how you get new headers from a newsserver. I guess when you first suscribe to a group you get what is already on the server by sending a GROUP command to get the the low and high article numbers and send an XOVER command with these two values. But to get new headers later, do you add 1 to that high article number and send the GROUP command again to get the new high article number and then send the XOVER command with these two values? If this is the case, what happens when the high article number is greater than the maximum int value? Does it wrap around from 0, which would make the high article number lower than the low article number? - thanks
Yep. I guess I was hesitant to write my own because I don't know how to account for leap years, but I guess it's not critical. I'll probably use that other article and write something similar to your example for months/years. Thanks.
DavidCrow wrote:
nm_114 wrote: How? By using SystemTimeToFileTime().
Well I knew that much! :-D I was asking how you do the adding/subtracting...
DavidCrow wrote:
That article is exactly what you need.
Well not really, as it doesn't handle months/years.
DavidCrow wrote:
That's because a month does not have a constant value (i.e., 28, 29, 30, or 31 days) like the other items do.
I knew that too! :-D But it's ok, I guess what I was looking for doesn't exist (a tested/bug-free exact replica of DateAdd() in C++). Oh well :sigh:. Thanks anyway.
:confused: How? I found an article at http://www.codeproject.com/datetime/winapi_datetime_ops.asp[^] but it doesn't work with months/years, and I have no idea if it works right with leap years etc.
DavidCrow wrote:
Why would you need a function, when one statement will work:
It was a bad example I guess. It needs to be arbitrary. Like DateAdd(Month, 309, mydate)
, DateAdd(Day, -909, mydate)
etc. I'm not sure if I'm explaining it right.
DavidCrow wrote:
Take a stroll through the other date/time functions to see what is available to you.
I did. I didn't see anything like DateAdd.
I don't know of any function that does this. I was looking for something like VBScript's DateAdd where I could do something like DateAdd(Month, 24, &stMyDate)
and it would add 24 months to the date (2 years), taking into account leap years etc..
SYSTEMTIME.
SYSTEMTIME stDateIWantToAddDaysOrMonthsTo;
FILETIME ft, ftLocal;
GetSystemTimeAsFileTime(&ft);
FileTimeToLocalFileTime(&ft, &ftLocal);
FileTimeToSystemTime(&ftLocal, &stDateIWantToAddDaysOrMonthsTo);
GetSystemTime() (then converting it to local time).
DavidCrow wrote:
If you are using MFC, see the COleDateTime class.
Nope, pure Win32 :(
Is there a c++ equivalent of vbs's DateAdd where you can add or subtract any amount of hours, days, months etc. to a date? - thanks
Sheldon Narrow
I'm trying to show the shell context menu for a file when only having the file name. I got the menu to come up but not all the menu items are showing up - like the ones virus scanners or zip utilities add to all files ("Scan File", "Add to Zip" etc.). Is there anything I'm missing:typedef HRESULT (WINAPI *lpfnSHBindToParent)(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast); LRESULT OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { lpfnSHBindToParent pSHBindToParent = (lpfnSHBindToParent)GetProcAddress(GetModuleHandle(TEXT("SHELL32.DLL")), "SHBindToParent"); if (pSHBindToParent) { LPOLESTR pwszFileName; #ifdef UNICODE pwszFileName = strFullFileName; #else WCHAR wsz[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, strFullFileName, -1, wsz, ARRAYSIZE(wsz)); pwszFileName = wsz; #endif LPSHELLFOLDER pDesktopFolder; if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) { LPITEMIDLIST pidl; if (pDesktopFolder->ParseDisplayName(hMainWnd, NULL, pwszFileName, NULL, &pidl, NULL) == S_OK) { LPSHELLFOLDER pParentFolder; LPCITEMIDLIST pidlLast; if (pSHBindToParent(pidl, IID_IShellFolder, (void**)&pParentFolder, &pidlLast) == S_OK) { IContextMenu* picm; if (pParentFolder->GetUIObjectOf(hMainWnd, 1, &pidlLast, IID_IContextMenu, NULL, (void**)&picm) == S_OK) { HMENU hMenuPopup = CreatePopupMenu(); if (hMenuPopup) { if ( SUCCEEDED( picm->QueryContextMenu(hMenuPopup, 0, 1, 0x7fff, CMF_NORMAL) )) { // when menu is shown not all the menu items are there... } DestroyMenu(hMenuPopup); } picm->Release(); } pParentFolder->Release(); } CoTaskMemFree(pidl); } pDesktopFolder->Release(); } } return 0; }
- thanks
XanaNews is the best (free) one I've used: http://www.wilsonc.demon.co.uk/delphi.htm[^] Another one called microplanet gravity or something was ok.
Thanks for the reply. Unfortunately it uses SHBindToParent() which requires Win2k+ :sigh: