|
Hi does anyone know how to convert from the time_t type to a VARIANT DATE type? The problem is I can't use MFC and so COleDateTime can't be used.
Cheers
|
|
|
|
|
Look at Chris Sells CComDate
http://www.sellsbrothers.com/tools
|
|
|
|
|
Here's one way to do it:
Convert from time_t to FILETIME like this (Q167296):
void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
Then, convert from FILETIME to SYSTEMTIME by calling FileTimeToSystemTime().
Then, convert from SYSTEMTIME to VARIANT TIME by calling SystemTimeToVariantTime().
This is kind of like playing "Six Degrees of Kevin Bacon".
|
|
|
|
|
yah i know an installer will do that for me but i dont want this app to use an installer ... its static linked and has to be a single .exe file
i want to check if there is a start-menu shortcut and add one if not from within the exe
i know its prolly a no-brainer but i keep finding WSH references in msdn ... windows scripting host???
clues appreciated
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
|
Mike Nordell wrote:
IShellLink
Short and sweet
"When a friend hurts us, we should write it down in the sand, where the winds of forgiveness get in charge of erasing it away, and when something great happens, we should engrave it in the stone of the memory of the heart, where no wind can erase it"
Nish on life [methinks]
|
|
|
|
|
|
Look at the following KB it shows how to do it
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q90493
|
|
|
|
|
yes,it can only read from a disk file
but an already running process?
|
|
|
|
|
GetModuleHandle(NULL) would give you the starting address of the process in the memory. The layout of the process is same in memory as on disk.
|
|
|
|
|
I am making a multi language application and therefore prefer to add static text strings to dialogs by using CStatic::Create rather than the resource editor. When I do this I allways get a bold typeface. I want to have the same font as I get by using the resource editor. How can I achieve this?
Haakon S.
|
|
|
|
|
first off ... multi-language doesnt mean u have to do things the hard way ... use the resource editor for your captions ... when you change languages you simply make a new resource dll and load it at run time ... thats the 'preferred' way afaik
to set the font for controls on a dialog use the SetFont(...) on the dialog box window ... to override specific controls u should trap the OnCtlColor(...) message and do the stuff you want there
hmmmm
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
I am indeed making a new resource dll for other languages. But I put all my text strings in the string table and use LoadString() to show the strings in the CStatic controls. Hence the use of CStatic::Create(). Isn't that the right way? I know I can open the RC file as a text file and edit it, but that seems to be rather dodgy.
SetFont() takes a pointer to a new font. Is there an easy way to get a pointer to the standard font for static controls, like you do when you use SelectStockObject()?
Haakon S.
|
|
|
|
|
Found it....
1. Give each static control a separate ID
2. Allocate a control variable to each of them (m_Static1)
3. Use m_Static1.SetWindowText((LPCSTR)string);
Thanks for your help anyway.
Haakon S.
|
|
|
|
|
There is a good article in MSDN, titled:
"Instrumenting Windows NT Applications with Performance Monitor".
I have downloaded the samples and registered the counters.
However, the counters are not displayed in the monitor and an error code 1003 is displayed in the event viewer.
This is the error description:
"The object length of an object returned by Extensible Counter DLL "...D:\Work\PerfCounter1\ExtCountFinServer" for the "FinServer" service was not correct. The sum of the object lengths returned did not match the size of the buffer returned. Performance data returned by counter DLL will be not be returned in Perf Data Block. Count of objects returned is data DWORD 0. "
Could anyone, please, try this sample and check what is wrong?
How can i solve the problem?
Thanks,
Dudi
|
|
|
|
|
Hi.
I'm trying to create a function which would load text into a array.
Like
Text[100][100]
I'm making a kind of phonebook, char Text[will hold the name][will hold the phone number]
I'm trying to create a function which will scan a text file and place the name of a person and the phone number of a person in the Array.
Ex:
text.txt
name: blah 1 phone: numbers 1
name: blah 2 phone: numbers 2
name: blah 3 phone: numbers 3
name: blah 4 phone: numbers 4
The function should scan the file, and add the name to the first part of the array, and the phone number to the last part of the array..
How could I do this?
|
|
|
|
|
You'll have to read line by line and parse it manually!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
thanks.
But what functions could do this?
How might I do this?
Thanks
|
|
|
|
|
Joan Yan wrote:
But what functions could do this?
How might I do this?
Can you use MFC?
If so use CStdioFile
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nope, I do not use MFC..
Any other way?
|
|
|
|
|
Joan Yan wrote:
Nope, I do not use MFC..
Any other way?
OK. You can use fopen to open the file. Then use fgets to read line by line.
For each line you'll need to parse out your fields. If you were using some fixed separator like say a comma, you could use strtok. But here you'd have to do some manual work You can use strchr and strstr.
Regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
THANKS
I got it to work
|
|
|
|
|
i have got different images which i want to write using '0nDraw' function.i want to call these images from menu.what is the procedure to follow.
There is a hope for an honest error not for an icy perfection.
|
|
|
|
|
Use the appwizard to make handlers for each of the menu items, then set some member variable I'll call it "selectedimage" to a number one for each image. Once you've set the variable, then call Invalidate() (this will repaint the view and call OnDraw()). Then you just have a switch(selectedimage), and a case stament for each image:
class CMyView : public CView
{
public:
protected:
int selectedimage;
}
CMyView::CMyView()
{
selectedimage = -1;
}
void CMyView::OnPicture1()
{
selectedimage = 1;
Invalidate();
}
void CMyView::OnDraw(CDC *dc)
{
switch(selectedimage)
{
case 1:
DrawImage1();
break;
case 2:
etc...
break;
}
}
Hope thats helpful
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Hi There,
I'm in the process of writing an MFC MDI application. I would like to have views in a docking window - getting the views into the docking window is not a problem, but getting pointer to document etc. is proving a little tricky. I originally though the easiest way to solve my problem was simply use the CCreateContext which I thought would be stored in lpCreateStruct in OnCreate in the CMainFrame, but it seems because the app is MDI that lpCreateStruct has NULL in its lpCreateParams. This raises questions: 1. How do I get pointers to the document? 2. How can I get my docking view to respond when the active document changes? 3. is it possible, or would I be better of using SDI? Thanks for your time...
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|