|
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.
|
|
|
|
|
Feralrath wrote: but i cant figure out how to set the parameters
What do you mean by that ? They are simply passed when your program is executed. If you double-click on your program in explorer, they will be empty. If you start your program through the console, you can provide arguments by typing them after the name of your program.
|
|
|
|
|
How Cedric Moonen says, in Command Line you can start your application with parameters like this
c:\>myprog param1 param2 param3 --> Where "myprog" is your application's Executable file
You can add more than 3 parameters
In Windows-Mode you can set the parameters like this :
http://developer.valvesoftware.com/w/images/6/63/Game_shortcut.jpg[^]
the "-game" is for example a parameter
|
|
|
|
|
Feralrath wrote: i cant figure out how to set the parameters.
I get the impression that you want to start your application from another application that you've written as well.
You should use ::ShellExecute() for that, or ::CreateProcess() . Both of these functions have a formal parameter where you should provide the desired command line arguments for the newly launched application.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
i guess i should have been a little more clear(5:30am). i know how to launche the program with parameters.
my question is how do i set the parameters in the program
i.e.
if(lpCmdLine != 12345)
{
return 0;
}
how can i set the variable for lpCmdLine to accept
|
|
|
|
|
Feralrath wrote: i guess i should have been a little more clear(5:30am)
Well, perhaps you should get some sleep because you're still not very clear...;)
Feralrath wrote: my question is how do i set the parameters in the program
How can you ask this question if you say that you know how to launch the program with parameters?
Is this question about the program that is supposed to be started, or about the program that starts the other program?
Feralrath wrote: how can i set the variable for lpCmdLine to accept
I interpret lpCmdLine as the string containing the command line arguments in your program that is supposed to be started. You don't assign anything to this string, you should parse it to extract the arguments from it.
If this is about how to compose the string containing the command line arguments in the program that starts the other, you can use ::sprintf() for that.
See here[^] for info about how to use ::sprintf() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
the question is about the application being lauched, how to i set it so that i will not launch when double clicked only when the correct command like argument is given?
|
|
|
|
|
|
You can't prevent the program being launched. In the program being launched, validate the command line parameters. If they aren't correct, simply exit immediately.
Software Zen: delete this;
|
|
|
|
|
Gary summarizes it quite well: you cannot prevent the application from being launched.
Think about it this way:
You have put the logic that determines whether the application is allowed to run or not inside the application itself. How could that piece of code make any decision without being executed?
Perhaps this is not really what you want, but then you might consider the design of your solution and where to put the logic that allows the application to start.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|