|
|
Sanroop wrote: ...my problem is to find the difference between current date and any otherdate what ever i give.
Which is what COleDateTimeSpan does, assuming you are using MFC. Otherwise, check out difftime() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What format are your dates in?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For converting to FILETIME you may use:
1) LocalFileTimeToFileTime()
2) "Converting a time_t Value to a File Time" article in MSDN
3) DosDateTimeToFileTime()
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
This time format is the most sensitive I ever met in Windows.
You may just construct an INT64 numbers and subtract them.
Every 10000 units == 1 millisecond (1/1000 second)
So I second contains 1000*10000 units.
Good Luck!
|
|
|
|
|
Hi,
I have a project to do which consists on implementing a solution to make firewalls more dynamic.
The code which I should write it must be integrated in XP firewall, free BSD,... .
How can I find an API compatible with different OS and which can manage firewall rules.
Thanks.
|
|
|
|
|
Search for UPnP. It has limited use in opening and closing ports and manipulating port
forwarding on UPnP-enabled devices.
If firewalls were programmable they'd be kinda useless
|
|
|
|
|
|
From what i've understood, the mainframe title is stored in the string table. How can i change it at runtime?
Here's what i want to do:
Let's say the application title is MyApp. For some reasons it becomes MyApp USERID. Doing this for the main window is easy with setwindowtext, but when i open a document it switches back to MyApp and the title switches from "MyApp USERID" to "My App - Document1"
How do i change it so that it doesn't change back?
|
|
|
|
|
eusto wrote: the mainframe title is stored in the string table.
CDocument::SetTitle . Read the docs too.
|
|
|
|
|
I was talking about the main window title. I would have to use CDocument::SetTitle() for every document that i open and...that's a bit too much
|
|
|
|
|
eusto wrote: I was talking about the main window title. I would have to use CDocument::SetTitle() for every document that i open and...that's a bit too much
That's how it's to be done in DV architecture.
If you want to force a different behavior override UpdateFrameTitleForDocument which again is not a virtual function.
You would like to look up FWS_ADDTOTITLE and FWS_PREFIXTITLE .
|
|
|
|
|
Nibu babu thomas wrote: If you want to force a different behavior override UpdateFrameTitleForDocument which again is not a virtual function.
If its not virtual, how different behaviour can be forced ?
|
|
|
|
|
eusto wrote: I would have to use CDocument::SetTitle() for every document that i open and...that's a bit too much
One line of code is too much. How so?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
AfxGetMainWnd()->SetWindowText("My Title");
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Override CFrameWnd::OnUpdateFrameTitle() . The application framework calls this method whenever it needs to update the frame's caption. On-demand updating is preferred to setting a modified title. (Why? Because it reduces the chance of programmer error and centralizes the title logic to a single location.)
/ravi
|
|
|
|
|
Hi all
I have loaded (a copy just in case) of my project from VS2003 at VS 2005, it was converted fine with just a few errors that I fixed but I still have this one that I dont understand. I´m not an expert, I´ve few months programming MFC self learning and still a lot to learn.
The error Line :
static CALLBACK CallbackProc(HWND hwnd, UINT msg, LPARAM lp, LPARAM lpData);
The compiler error:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Can I continue with my MFC project at VS2005 with no problems at all?
Why I cant see my dialogs, main form , etc.. just the code?
Where are they!!?
thx in advance.
Jdg
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
jarleydg wrote: The error Line :
static CALLBACK CallbackProc(HWND hwnd, UINT msg, LPARAM lp, LPARAM lpData);
The compiler error:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Modify this declaration to,
static int CALLBACK CallbackProc(HWND hwnd, UINT msg, LPARAM lp, LPARAM lpData);
jarleydg wrote: Why I cant see my dialogs, main form , etc.. just the code?
Where are they!!?
They are in resource explorer. Aren't they ?
|
|
|
|
|
Done thanks.
ups... sorry resource explorer! was hidden.. stupid me. =/
Well the previous part compiled ok, but I´m using too this code from MSDN by Paul DiLascia where he encapsulated SHBrowseForFolder in a class FolderDlg... http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/default.aspx
At VS2003 it was working ok... but now I´m having this fatal error...
So my project still can´t compile
please any help apretiated .
thanks in advance.
FolderDlg.obj : error LNK2019: unresolved external symbol "class ATL::CStringT<char,class strtraitmfc_dll<char,class="" atl::chtraitscrt<char=""> > > __cdecl _DbgName(long)" (?_DbgName@@YA?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@J@Z) referenced in function "protected: virtual long __stdcall CFolderDialog::QueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CFolderDialog@@MAGJABU_GUID@@PAPAX@Z)
FolderDlg.obj : error LNK2019: unresolved external symbol "class ATL::CStringT<char,class strtraitmfc_dll<char,class="" atl::chtraitscrt<char=""> > > __cdecl _DbgName(struct _GUID const &)" (?_DbgName@@YA?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@ABU_GUID@@@Z) referenced in function "protected: virtual long __stdcall CFolderDialog::QueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CFolderDialog@@MAGJABU_GUID@@PAPAX@Z)
FolderDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CInterfaceNames::CInterfaceNames(struct DBGINTERFACENAME *,unsigned int)" (??0CInterfaceNames@@QAE@PAUDBGINTERFACENAME@@I@Z) referenced in function "void __cdecl `dynamic initializer for '_initMyDBI''(void)" (??__E_initMyDBI@@YAXXZ)
.\Debug/adquisition.exe : fatal error LNK1120: 3 unresolved externals
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
jarleydg wrote: FolderDlg.obj : error LNK2019: unresolved external symbol "class ATL::CStringT > > __cdecl _DbgName(long)" (?_DbgName@@YA?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@J@Z) referenced in function "protected: virtual long __stdcall CFolderDialog::QueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CFolderDialog@@MAGJABU_GUID@@PAPAX@Z)
FolderDlg.obj : error LNK2019: unresolved external symbol "class ATL::CStringT > > __cdecl _DbgName(struct _GUID const &)" (?_DbgName@@YA?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@ABU_GUID@@@Z) referenced in function "protected: virtual long __stdcall CFolderDialog::QueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CFolderDialog@@MAGJABU_GUID@@PAPAX@Z)
Probably you are using _DbgName , but linker is not getting its definition. In release build its definition is suppressed.
jarleydg wrote: FolderDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall CInterfaceNames::CInterfaceNames(struct DBGINTERFACENAME *,unsigned int)" (??0CInterfaceNames@@QAE@PAUDBGINTERFACENAME@@I@Z) referenced in function "void __cdecl `dynamic initializer for '_initMyDBI''(void)" (??__E_initMyDBI@@YAXXZ)
.\Debug/adquisition.exe : fatal error LNK1120: 3 unresolved externals
Same case is with class CInterfaceNames . Its for debug configuration only. In release confiruation, its defn's are suppressed, hence error.
|
|
|
|
|
In fact it is in debug configuration where the linker errors came.
When I compile in release, all is ok...
So I´m missing something in my debug config?
this line is a comment in the code
// You must link shlwapi.lib for StrRetToBuf
could this be the problem? If it is... how do I link shlwapi.lib ?
thx again.
jdg
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
Linking error are generated, because linker could not resolve certain function calls. From code of article you have mentioned, _DbgName
is meant to compile in debug configuration(#ifdef _DEBUG) only.
Can you show how you have used _DbgName in your code ?
jarleydg wrote: this line is a comment in the code
// You must link shlwapi.lib for StrRetToBuf
could this be the problem? If it is... how do I link shlwapi.lib ?
No. It is already linked
|
|
|
|
|
I´m not using it, I just #include "FolderDlg.h" and use it this way :
BOOL CDlgEnsayoObs::BrowseForDataStore ()<br />
{<br />
CCableOkApp* pApp = (CCableOkApp*)AfxGetApp();<br />
CFolderDialog dlg(this);<br />
CString path;<br />
LPCITEMIDLIST pidl;<br />
BOOL bRet = FALSE;<br />
<br />
pidl = dlg.BrowseForFolder(_T("Seleccione el directorio de Almacén de datos"), <br />
BIF_USENEWUI <br />
|BIF_RETURNONLYFSDIRS <br />
| BIF_STATUSTEXT ,NULL ,TRUE);<br />
path = dlg.GetPathName(pidl);<br />
if (path.IsEmpty ())<br />
{<br />
return bRet;<br />
}<br />
else<br />
{<br />
pApp->m_sDataFilePath = path + "\\";<br />
pApp->m_sDataStorePath = path + "\\";<br />
SetDlgItemText(IDC_FILEPATH, "Seleccione un grupo de cables o Dir. de captura");<br />
SetDlgItemText(IDC_DATASTORE, pApp->m_sDataStorePath);<br />
pApp->m_DataBase.SetDataStore(pApp->m_sDataStorePath);<br />
bRet = TRUE;<br />
}<br />
dlg.FreePIDL(pidl);
return bRet;<br />
}
In my project is not _DbgName in any place. It´s only in the DiLascia code inside a debug.h
file. I´m not including nor added to my project this two files, debug.h and debug.cpp. I´m only including FolderDlg.h, FolderDlg.cpp, where the functions I want to use are declared/implemented. Anyway FolderDlg header is already including debug.h ...
This one debug.h :
<br />
#ifndef _DEBUG_H<br />
#define _DEBUG_H<br />
<br />
#ifndef countof<br />
#define countof(x) (sizeof(x)/sizeof(x[0]))<br />
#endif<br />
<br />
#ifdef _DEBUG<br />
<br />
#pragma comment(linker, "/defaultlib:ole32.lib")<br />
<br />
<br />
#define _TR(x) (LPCTSTR)_DbgName(x)<br />
<br />
extern CString _DbgName(CWnd* pWnd);
extern CString _DbgName(UINT uMsg);
extern CString _DbgName(REFIID iid);
extern CString _DbgName(SCODE sc);
<br />
struct DBGINTERFACENAME {<br />
const IID* piid;
LPCSTR name;
};<br />
<br />
class CInterfaceNames {<br />
protected:<br />
static CInterfaceNames* s_pFirst;<br />
CInterfaceNames* m_pNext;<br />
DBGINTERFACENAME* m_pEntries;<br />
UINT m_nEntries;<br />
public:<br />
CInterfaceNames(DBGINTERFACENAME* pdin, UINT n);<br />
static const DBGINTERFACENAME* FindEntry(REFIID iid);<br />
};<br />
<br />
#define DEBUG_BEGIN_INTERFACE_NAMES() \<br />
static DBGINTERFACENAME _myDBI[] = { \<br />
<br />
#define DEBUG_INTERFACE_NAME(iface) \<br />
{ &IID_##iface, _T(#iface) }, \<br />
<br />
#define DEBUG_END_INTERFACE_NAMES() \<br />
}; \<br />
static CInterfaceNames _initMyDBI(_myDBI, countof(_myDBI)); \<br />
<br />
#define DbgName(x) (LPCTSTR)_DbgName(x)<br />
<br />
#else // Below NOT _DEBUG ----------------------------------------------------<br />
<br />
#define _TR(x) ((LPCTSTR)NULL)<br />
#define DbgName(x) ((LPCTSTR)NULL)<br />
<br />
#define DEBUG_BEGIN_INTERFACE_NAMES()<br />
#define DEBUG_END_INTERFACE_NAMES()<br />
#define DEBUG_INTERFACE_NAME(iface)<br />
<br />
#endif // _DEBUG<br />
<br />
#endif // _DEBUG_H<br />
thx and sorry the long code..
PD: debug.cpp is longer so I will not post it.
---------------------------------------------
"Don't panic!. All will become clear in time"
WYS Is Not always WYG
|
|
|
|
|
May be you can mail across code. Can't fgure out problem.
|
|
|
|
|
CallbackProc has to have a return type specified. If it does not return anything then specify a void return type.
static CALLBACK void CallbackProc(...)
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
i'm in the process of writing a program that i want only to be able to run with the correct command line parameters.
basicly i want the program only go run when it is called by another program.
i'm using the win32 api and opengl, i know that lpCmdLine accepts the command line parameters but i cant figure out how to set the parameters.
|
|
|
|