|
Hi,
I have the following situation:
I hide some columns of a CListCtrl derived object. I do this by setting the column width to zero
with the code :
BOOL CXListCtrlHead::SetStdColWidth(int nCol, int nWidth)
{
ASSERT((nCol >= 0) && (nCol < GetItemCount()));
ASSERT(nWidth >= 0);
HDITEM hdi;
memset(&hdi, 0, sizeof(HDITEM));
hdi.mask = HDI_WIDTH;
hdi.cxy = nWidth;
return SetItem(nCol, &hdi);
}
when I want to do the drawing by overridding OnCustomDraw()
the code :
CRect rc;
GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rc);
TRACE(_T("Width = %d\n"), rc.Width());
gives me an output of "Width = 16"
The subitem for which I am asking the bounding rectangle is the column I set to zero earlier.
btw I am using the code from http://www.codeproject.com/listctrl/xlistctrl.asp
How is this possible ?
tia
|
|
|
|
|
You might consider posting this under the xlistctrl article - you may get help quicker there.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Dramas,
I've subclassed CToolBar to custom draw toolbars & I've worked around most of the quirks but I'm somewhat stuck when it comes to drawing the down arrow on a button with the BTNS_WHOLEDROPDOWN style or BTNS_DROPDOWN with TBSTYLE_EX_DRAWDDARROWS on the toolbar.
From a bit of experimenting in XP I've found:
BTNS_WHOLEDROPDOWN with TBSTYLE_AUTOSIZE on increases a button's width by 6
BTNS_WHOLEDROPDOWN with TBSTYLE_AUTOSIZE off increases a button's width by 7
BTNS_DROPDOWN with TBSTYLE_AUTOSIZE on increases a button's width by 19
BTNS_DROPDOWN with TBSTYLE_AUTOSIZE off increases a button's width by 18
(I'm assuming some of the 18/19 is padding but how much?).
After playing with CToolBar::SetMetrics, I can confidently say that the toolbar & button padding settings do not affect the drop-down width but I can't find any documentation on how to query the O/S for the drop down width, or whether any system settings (e.g. themes) or other O/S versions will give different values.
Is there something I've missed? Or can anyone confirm whether the drop down widths listed above are always true?
-- modified at 10:02 Friday 10th August, 2007
T-Mac-Oz
|
|
|
|
|
You can easily use FindFirstChangeNotification() in your MFC applicaton just like you would with any other Win32 API.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
On creating registry key, a string value named "(Default)" is automatically generated, whose data is "value not set" means no value, how can I assign some data to that value programmatically.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Mushq wrote: how can I assign some data to that value programmatically.
By using RegSetValue(hKey, "", ...) .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
David, Thanks a lot
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Hey I'm trying to use the Accessible Object API to find out when an event happens in an IM window, I've got some visual basic code for it but when i try to do this in a console applications it doesn't work. I know its probably something to do with the infinite for loop but i have no idea how else to do this and wait for some events to be printed into the console, heres the code i mainly got from msdn.
<br />
HWINEVENTHOOK g_hook;<br />
<br />
void CALLBACK HandleWinEvent(HWINEVENTHOOK hook, DWORD event, HWND hwnd,<br />
LONG idObject, LONG idChild,<br />
DWORD dwEventThread, DWORD dwmsEventTime)<br />
{<br />
printf("called\n");<br />
IAccessible *pAcc = NULL;<br />
VARIANT varChild;<br />
HRESULT hr = AccessibleObjectFromEvent(hwnd, idObject, idChild, &pAcc, &varChild); <br />
if ((hr == S_OK) && (pAcc != NULL))<br />
{<br />
char *classname;<br />
classname = (char*)malloc(15);<br />
GetClassName(GetParent(hwnd),(LPTSTR)classname,14);<br />
printf("Classname: %s\n", classname);<br />
if(strcmp(classname,"IMWindowClass") == 0){<br />
printf("found\n");<br />
}<br />
<br />
}<br />
}<br />
<br />
void InitializeMSAA()<br />
{<br />
CoInitialize(NULL);<br />
g_hook = SetWinEventHook(<br />
EVENT_SYSTEM_ALERT , EVENT_OBJECT_ACCELERATORCHANGE,
NULL,
HandleWinEvent,
0, 0,
WINEVENT_SKIPOWNPROCESS);
}<br />
<br />
int main(array<System:(Smilie)tring ^> ^args)<br />
{<br />
InitializeMSAA();<br />
printf("init'd\n");<br />
while(1);<br />
system("pause");<br />
return 0;<br />
}<br />
Any help would be great!
|
|
|
|
|
I am using TextOut() fun but it's taking Black as a default colour
can anybody tell me how to change it's colour????
Thanks!!!
There Is Nothing Right & Wrong
|
|
|
|
|
Use of SetTextColor for text color and SetBkcolor for background color.
|
|
|
|
|
Hello every1,
I m trying to develope an application in MFC which deletes all Internet cookies .I am using Firefox. Can u plz suggest me how can I do that?
Plz reply me as soon as possible.
Thanks.
s_v_patel
|
|
|
|
|
|
tht's fine for IE ..but that is not gonna work for FireFox... want some functions in MFC which actually retrives cookies stored on my machine n delete them.
Thanks.
s_v_patel
|
|
|
|
|
Where are those cookies stored? This is not a rhetorical question. You just might have to search the HD to find them. But without that information, deleting said files won't be possible.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Of course those cookies r stored on my machine. I want a fuction in MFC which retrieves internet cookies and delete them.
I have mane application for Internet explorer but not for FireFox..
Thanks.
s_v_patel
|
|
|
|
|
s_v_patel wrote: I want a fuction in MFC which retrieves internet cookies and delete them.
Such a function does not exist. You will need to create your own.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
tht's wat i m asking for..that how may i create that..cuz there is no way i can access it using MFC...(spent entire day searching)..lol...
Cud u plz tell me how may i develope it?
|
|
|
|
|
Firefox stores your cookies in the automatically generated file cookies.txt under your specific Profile folder. Just delete the cookies.txt file from that folder.
char szPath[MAX_PATH];
SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, szPath);
PathAppend(szPath, "Mozilla\\cookies.txt"); At this point, verify that szPath contains the correct value.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have a program (which i didn't create) that have a built in timer.
the timer count backwards and i want to prevent the timer from hitting zero.
i tried compiling this c program:
<pre>
#include "stdafx.h"
#include <time.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
size_t main( int argc, char *argv[] )
{
SYSTEMTIME time;
GetSystemTime(&time);
while(!kbhit())
SetSystemTime(&time);
if(!getch())
getch();
return 0;
}
</pre>
and its stopping the windows (win xp sp2) clock but not the program timer, do anyone have a suggestion how to make the timer stop counting back?
thanks to anyone who actually read the post
|
|
|
|
|
shja88 wrote: ...but not the program timer...
Which is what?
More importantly, just what exactly are you trying to accomplish?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sorry i didn't understand the question, can you rephrase that?
my english skills isn't that good
|
|
|
|
|
You've got a program containing a timer. That timer counts backwards.
Now you run another program that resets the Windows time as fast as it can.
And you are astonished that the first program still counts backwards?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
yep.
are you saying that the timer is getting his updates not from the windows clock?
if so then from what clock does it updates? (bios????)
|
|
|
|
|
shja88 wrote: are you saying that the timer is getting his updates not from the windows clock?
Surely not. Especially if it just counts some numbers backwards, and not a time.
There are a plethora of different timers in Windows:
SetTimer and WM_TIMER are the most basic ones.
But there are High-ResolutionTimers and MultimediaTimers...
You definitly need to read the MSDN Topic "About Timers".
Hacking a shareware program?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: Hacking a shareware program?
actually not, its something far more simpler then that.
BTW you have any idea if i can actually change the timer?
and thanks for all your help, ill go check msdn.
thank you very much
|
|
|
|