|
|
thanks
i also discovered (based on experiment only) that whilst using SYSTEMTIME
(without converting to FILETIME) adding 1400 to the higher value of the DWORD will do the trick for me....
i guess in a math way 1400 related to the 10000000x60x60x24x7 somehow
thanks again for reply
Yaron
|
|
|
|
|
wooooppppssss
sorry what i ment to say is to add the 1400 to the higher value of the FILETIME as follows:
SYSTEMTIME st;
FILETIME ft;
GetLocalTime(&st);
SystemTimeToFileTime(&st,&ft);
ft.dwHighDateTime += 1400;// adding the 7 days
i think your way was to work on the ULARGE_INT i.e __int64 i.e:
__in64 uli;
memcpy(&uli,&ft,sizeof(uli));
uli += 10000000x60x60x24x7;
and then convert it again to FILETIME with memcpy:
memcpy(&ft,&uli,sizeof(ft));
am i correct?
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Well, you were fudging the calculation, not doing it exactly like I was.
10000000x60x60x24x7 = 0x0580 28E4 4000
0x580 == 1408, so you were close
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Hi!
I find in vs.net impossible to use user defined type for function parameter.
In the COM function i declare some user defined type. for example
typedef unsigned char d8u;
in vc6, i only need include a header descriping d8u in the idl file.
But in vs.net, i create a ATL control, find the idl file is dynamic generated when you compile it. Not a static file as in vc6 that you can edit it manually. And it will never include the header i need, so there are always error of shorting of such type.
Why vs.net take this solution? is there any place i can make midl to include the header?
I have blocked there for 2 days. If there isn't a good solution i have to reinstall vc6 to work. sigh...
Any idea,pals?
|
|
|
|
|
You don't have to use attributes - there's a checkbox in the AppWizard that controls whether the project uses attributes or the VC 6 style with the IDL and other files.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
aef392rDFA#@(#*@%@#$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
How can I calculate the required size of text which can be placed in one column of CListCtrl object and fits in.
when I tried to use the next code, some text did not appear all, I get three dots at the end of the appeared text on the column.
Can you help me please what is wrong with code ?
void CMyDialogDlg::AdjustColSize(int ColNo,CString s)
{
CClientDC dc(this);
CSize sz;
CFont *f = m_ListControl.GetFont();
dc.SelectObject(f);
sz = dc.GetTextExtent(s,_tcslen(s));
sz.cx += GetSystemMetrics(SM_CXBORDER);
if( width[ColNo] < sz.cx )
{
m_ListControl.SetColumnWidth(ColNo,sz.cx);
width[ColNo]=sz.cx;
}
}
Dr Abudawood
|
|
|
|
|
Use LVM_GETSTRINGWIDTH to get the width in pixels of a string. The docs say:If you use the returned string width as the column width in the LVM_SETCOLUMNWIDTH message, the string will be truncated. To retrieve the column width that can contain the string without truncating it, you must add padding to the returned string width. so you have to fudge the return value by a few pixels (I guess the exact number depends on the font, bigger font means more padding).
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
aef392rDFA#@(#*@%@#$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Tanke you very mush Mr .Michael Dunn for your help. And I'll try to do your advice.
Dr Abudawood
|
|
|
|
|
Now I got the answer. after your help it was very easy as next:
void CTestScrolDlg::AdjustColSize(int ColNo,CString s)
{
//Global variable Array width[ColNo]
int Gab = 15;
int size=m_ListControl.GetStringWidth(s)+Gab;
if( width[ColNo] < size )
{
m_ListControl.SetColumnWidth(ColNo,size);
width[ColNo]=size;
}
};)
Dr Abudawood
|
|
|
|
|
I just realized this, but if you want the column to be wide enough to show all strings in the column, use the LVSCW_AUTOSIZE or LVSCW_AUTOSIZE_USEHEADER value with LVM_SETCOLUMNWIDTH .
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
I am attempting to use the parallel port for output control. I thus write a simple code to test the outp() as follow:
#include <conio.h>
void main (void)
{ int i;
i = outp(888,1);
}
VC6.0 returned the followign error msg :
error LNK2001: unresolved external symbol _outpw
Would appreciate any help to solve this. Thanks!!
|
|
|
|
|
You have to link your project with whichever library outpw is in - i think it's LIBC.LIB but i'm not sure
=====
Phlip
Always proofread carefully to see if you any words out
|
|
|
|
|
First, what OS are you planning to run this on? inp and outp do not work on Windows NT based systems (NT, 2000, XP, 2003, etc..)
Second, you need to link to the right lib file.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
come on, someone must know this...
How can you send a char that's not on the keyboard using SendInput?
To send '¯', for example, you hold alt and type 0175 on the num pad.
So I guessed this, but it doesn't work
int i;
INPUT input[10];
ZeroMemory(input, sizeof(input));
for (i = 0; i < 10; i++)
input[i].type = INPUT_KEYBOARD;
input[0].ki.wVk = 18;
input[1].ki.wVk = input[2].ki.wVk = 0x60;
input[3].ki.wVk = input[4].ki.wVk = 0x61;
input[5].ki.wVk = input[6].ki.wVk = 0x67;
input[7].ki.wVk = input[8].ki.wVk = 0x65;
input[9].ki.wVk = 18;
input[2].ki.dwFlags = input[4].ki.dwFlags = input[6].ki.dwFlags =
input[8].ki.dwFlags = input[9].ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(10, input, sizeof(INPUT));
using a keyboard logger, i can see that it does exactly what I want, ie press alt, type 0175, release alt, but it doesn't send '¯' to the active app
Any ideas?
thanks in advance
=====
Phlip
Always proofread carefully to see if you any words out
BTW: Why doesn't replying bump messages to the top of the forum?
|
|
|
|
|
Undoubtedly "cin" is one of those quick ways you can use to receive data. But how reliable is it?
I ask the question because I noticed at times I'd get the right amount of data inputted, and at other times, not only would I receive one ot two characters less, but they'd be in the wrong order in which they were entered.
It is NOT a permanent situation I'm talking about for which I'm using "cin", but if it's reliability is in question during development, I'd just as soon not bother using it. (Or is there some way I can improve its reliability? Yes, I do use "cin.clear()" right before I start inputting, and "No", I don't enter more data than the buffer can hold.)
Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
forget that stuff, use C
char input[80];
printf("Enter a string: ");
gets(input);
printf("\nYou Typed: %s\n", input);
puts(""); // line return;
puts("press any key to continue");
getc(stdin);
|
|
|
|
|
Thanks for your answer, but the ONLY reason why I used "cin" was because of the characters it delivered from the "istream" buffer, I could use in test like, "isspace", "isalpha", "ispunct" (etc.) as they were coming in.
Nonetheless, your suggestion does have merit to it. Thanks.
William
Fortes in fide et opere!
|
|
|
|
|
Using gets() is about as unsafe as you can do it. What if the user types more than 80 characters? Buffer overflow. That it what causes crashes. At least use fgets() where you can actually specify the size of the buffer.
There is nothing wrong with using the STL streams. I would choose it every time over gets() .
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
types more than 80 characters? Buffer overflow. That it what causes crashes. At least use fgets()
I think that's pretty obvious, you can use fgets() too, although normally for file i/o, but it doesn't really matter as long as you know what your doing.
|
|
|
|
|
|
sure, but if you're writing a quick application that requires inputs like names, it's pretty safe to assume 80 or 100 chars will be ok.
I don't get paranoid about that stuff. You can however use fgets() with stdin as the file handle as you said.
|
|
|
|
|
I don't know who I'm quoting at the moment, but I need to let you know:
"Programming nowdays is a contest of making the best idiot proof program, against the universe making bigger idiots!"
(2 thums up to the one who thought of that sentence )
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I managed to put together a very cool looking
.chm file using the program FAR. How can I
execute the .chm from my program? I used the
code:
CreateProcess(NULL, "help.chm, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
But it didn't work, even though it works for all the
other .exe files that I have. Is there something
special I need to do to run a .chm file?
Please, please, any response any one can give me
will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
ShellExecute(NULL, _T("Open"), _T("help.chm"), NULL, NULL, 0);
|
|
|
|